
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-main: #fcfcfc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    direction: rtl;
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

/* Typography */
h1, h2, h3 { font-weight: 800; }
.text-muted { color: var(--text-muted); font-size: 0.9rem; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: 12px; border: none;
    font-weight: 600; cursor: pointer; transition: all 0.2s ease;
    font-size: 0.95rem;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #1d4ed8; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2); }
.btn-ghost { background: transparent; color: var(--text-main); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f8fafc; }
.btn-icon { padding: 8px; border-radius: 10px; }

/* Layout Components */
header {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 30px; border: 1px solid var(--border);
}

.logo-container { display: flex; align-items: center; gap: 12px; }
.logo-icon { width: 45px; height: 45px; background: var(--primary); border-radius: 12px; display: flex; align-items: center; justify-content: center; color: white; font-size: 1.5rem; }

/* Stats Row */
.stats-row {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px; margin-bottom: 30px;
}
.stat-item {
    background: var(--bg-card); padding: 25px; border-radius: 20px;
    border: 1px solid var(--border); box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 5px;
}
.stat-val { font-size: 1.8rem; font-weight: 800; color: var(--primary); }

/* Search & Filter Bar */
.search-bar {
    background: var(--bg-card); padding: 15px; border-radius: 15px;
    border: 1px solid var(--border); box-shadow: var(--shadow);
    display: flex; gap: 15px; margin-bottom: 25px; align-items: center;
}
.search-input {
    flex: 1; border: none; background: #f8fafc; padding: 12px 15px;
    border-radius: 10px; border: 1px solid var(--border); outline: none;
}

/* Customer Cards */
.customer-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}
.customer-card {
    background: var(--bg-card); border-radius: 20px; border: 1px solid var(--border);
    padding: 20px; box-shadow: var(--shadow); transition: all 0.3s ease;
}
.customer-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 15px; }
.card-name { font-size: 1.15rem; font-weight: 700; color: var(--text-main); }
.card-phone { font-size: 0.85rem; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }

.card-details { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 15px 0; padding: 15px 0; border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); }
.detail-item { display: flex; flex-direction: column; }
.detail-label { font-size: 0.75rem; color: var(--text-muted); }
.detail-val { font-weight: 700; font-size: 1rem; }

.status-badge { padding: 4px 10px; border-radius: 8px; font-size: 0.75rem; font-weight: 700; }
.status-paid { background: #d1fae5; color: #065f46; }
.status-partial { background: #ffedd5; color: #9a3412; }
.status-pending { background: #fee2e2; color: #991b1b; }

.card-actions { display: flex; gap: 8px; margin-top: 15px; flex-wrap: wrap; }

/* Modals */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 20px; animation: fadeIn 0.2s ease;
}
.modal-box {
    background: white; width: 100%; max-width: 500px;
    border-radius: 25px; padding: 30px; box-shadow: var(--shadow-lg);
    position: relative; max-height: 90vh; overflow-y: auto;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.9rem; }
.form-group input, .form-group textarea {
    width: 100%; padding: 12px; border: 1px solid var(--border);
    border-radius: 12px; outline: none; background: #f8fafc;
}
.form-group input:focus { border-color: var(--primary); }

/* Payments List */
.pay-history-list { margin-top: 15px; max-height: 250px; overflow-y: auto; padding-right: 5px; }
.pay-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px; border-bottom: 1px solid #f1f5f9; font-size: 0.9rem;
}

/* Toast */
.toast-container { position: fixed; bottom: 30px; left: 30px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--text-main); color: white; padding: 12px 24px; border-radius: 12px; box-shadow: var(--shadow-lg); animation: slideIn 0.3s ease; }
@keyframes slideIn { from { transform: translateX(-100%); } to { transform: translateX(0); } }

/* Floating Add Button */
.fab {
    position: fixed; bottom: 30px; right: 30px;
    width: 65px; height: 65px; background: var(--primary);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: white; font-size: 2rem; box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
    cursor: pointer; border: none; transition: 0.3s; z-index: 90;
}
.fab:hover { transform: rotate(90deg) scale(1.1); }

/* Responsive adjustments */
@media (max-width: 768px) {
    .stats-row { grid-template-columns: 1fr; }
    .customer-grid { grid-template-columns: 1fr; }
    header { flex-direction: column; gap: 15px; text-align: center; }
}

.hidden { display: none !important; }
.loading { opacity: 0.5; pointer-events: none; }
