/* ═══════════════════════════════════════════
   سفراء التحول الرقمي - محافظة كربلاء المقدسة
   ═══════════════════════════════════════════ */

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

:root {
    --teal-50: #f0fdfa; --teal-100: #ccfbf1; --teal-200: #99f6e4;
    --teal-500: #14b8a6; --teal-600: #0d9488; --teal-700: #0f766e;
    --teal-800: #115e59; --teal-900: #134e4a; --teal-950: #042f2e;
    --gold: #fbbf24; --gold-dark: #d97706;
    --red-50: #fef2f2; --red-100: #fecaca; --red-500: #ef4444; --red-600: #dc2626;
    --slate-50: #f8fafc; --slate-100: #f1f5f9; --slate-200: #e2e8f0;
    --slate-300: #cbd5e1; --slate-400: #94a3b8; --slate-500: #64748b;
    --slate-600: #475569; --slate-700: #334155; --slate-800: #1e293b; --slate-900: #0f172a;
    --indigo-500: #6366f1; --indigo-100: #e0e7ff;
    --pink-500: #ec4899;
    --radius: 12px; --radius-lg: 20px;
    --shadow: 0 2px 12px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
    --font: 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); direction: rtl; background: var(--slate-50); color: var(--slate-900); line-height: 1.6; }
a { text-decoration: none; color: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--slate-100); }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 3px; }

/* Animations */
@keyframes fadeIn { from { opacity:0; transform:translateY(12px) } to { opacity:1; transform:translateY(0) } }
@keyframes slideDown { from { transform:translate(-50%,-20px); opacity:0 } to { transform:translate(-50%,0); opacity:1 } }
@keyframes pulse { 0%,100% { opacity:1 } 50% { opacity:.6 } }
.fade-in { animation: fadeIn .5s ease; }

/* ─── BACKGROUND ─── */
.bg-pattern {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background:
        radial-gradient(circle at 20% 80%, rgba(13,148,136,.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(99,102,241,.06) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(245,158,11,.04) 0%, transparent 50%),
        linear-gradient(180deg, var(--slate-50), var(--slate-100));
}

/* ─── NOTIFICATION ─── */
.notification {
    position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 9999;
    padding: 14px 28px; border-radius: var(--radius); font-size: 15px; font-weight: 600;
    color: #fff; display: flex; align-items: center; gap: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.3); animation: slideDown .4s ease;
}
.notification.success { background: linear-gradient(135deg, #065f46, var(--teal-600)); }
.notification.error { background: linear-gradient(135deg, #991b1b, var(--red-600)); }

/* ═══ FORM PAGE ═══ */
.form-page {
    min-height: 100vh; display: flex; justify-content: center;
    align-items: flex-start; padding: 32px 16px; position: relative;
}
.form-container { width: 100%; max-width: 720px; position: relative; z-index: 1; }

/* Header */
.form-header {
    text-align: center; padding: 36px 24px 28px;
    background: linear-gradient(135deg, #065f46 0%, var(--teal-600) 50%, var(--teal-900) 100%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    color: #fff; box-shadow: 0 4px 24px rgba(13,148,136,.3);
}
.form-header .logo { width: 72px; height: 72px; margin-bottom: 8px; }
.form-header h1 { font-size: 26px; font-weight: 900; margin: 8px 0 0; letter-spacing: -.5px; }
.form-header h2 { font-size: 15px; font-weight: 400; margin: 4px 0 0; opacity: .85; }
.form-header p { font-size: 13px; opacity: .7; margin-top: 16px; line-height: 1.7; max-width: 500px; margin-inline: auto; }

/* Progress */
.progress-area { background: #fff; padding: 20px 24px; border-bottom: 1px solid var(--slate-200); }
.progress-bar { height: 6px; background: var(--slate-200); border-radius: 3px; overflow: hidden; margin-bottom: 16px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--teal-600), var(--teal-200)); border-radius: 3px; transition: width .4s ease; }
.steps-row { display: flex; justify-content: space-between; }
.step-item { display: flex; flex-direction: column; align-items: center; flex: 1; transition: opacity .3s; }
.step-item.inactive { opacity: .4; }
.step-circle {
    width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-size: 16px; font-weight: 700; transition: all .3s;
}
.step-circle.done { background: var(--teal-600); color: #fff; }
.step-circle.active { background: linear-gradient(135deg, var(--teal-600), #065f46); color: #fff; transform: scale(1.15); }
.step-circle.pending { background: var(--slate-200); color: var(--slate-400); }
.step-label { font-size: 11px; margin-top: 4px; text-align: center; font-weight: 400; color: var(--slate-400); }
.step-item.active .step-label { font-weight: 700; color: #065f46; }
.step-item.done .step-label { color: #065f46; }

/* Form Body */
.form-body {
    background: #fff; padding: 28px 24px 20px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.step-content { display: flex; flex-direction: column; gap: 18px; animation: fadeIn .3s ease; }
.step-title {
    font-size: 18px; font-weight: 700; color: var(--slate-900);
    margin-bottom: 4px; padding-bottom: 12px; border-bottom: 2px solid var(--teal-50);
}

/* Inputs */
.form-label {
    display: flex; align-items: center; gap: 6px; font-size: 14px;
    font-weight: 600; color: var(--slate-700); margin-bottom: 6px;
}
.form-label.has-error { color: var(--red-600); }
.form-label .required { color: #f43f5e; }

.form-input {
    width: 100%; padding: 12px 14px; border-radius: 10px; border: 2px solid var(--slate-200);
    font-size: 15px; transition: all .2s; font-family: var(--font); background: #fff;
    color: var(--slate-900);
}
.form-input:focus { outline: none; border-color: var(--teal-600); box-shadow: 0 0 0 3px rgba(13,148,136,.15); }
.form-input.has-error { border-color: var(--red-600); background: var(--red-50); }
.form-input.has-error:focus { box-shadow: 0 0 0 3px rgba(220,38,38,.15); }

textarea.form-input { min-height: 100px; resize: vertical; }

.error-text { display: block; font-size: 12px; color: var(--red-600); margin-top: 4px; font-weight: 500; }

/* Select Dropdown */
.select-wrap { position: relative; }
.select-trigger {
    width: 100%; padding: 12px 14px; border-radius: 10px; border: 2px solid var(--slate-200);
    font-size: 15px; background: #fff; cursor: pointer; display: flex;
    justify-content: space-between; align-items: center; transition: all .2s;
    font-family: var(--font);
}
.select-trigger.filled { background: var(--teal-50); border-color: var(--teal-600); }
.select-trigger.has-error { border-color: var(--red-600); background: var(--red-50); }
.select-trigger .placeholder { color: var(--slate-400); }
.select-trigger .value { color: var(--teal-900); }
.select-trigger .chevron { color: var(--slate-500); transition: transform .2s; font-size: 12px; }
.select-trigger.open .chevron { transform: rotate(180deg); }

.select-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
    background: #fff; border: 2px solid var(--slate-200); border-radius: var(--radius);
    margin-top: 4px; max-height: 240px; overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,.12); display: none;
}
.select-dropdown.open { display: block; }
.select-option {
    padding: 10px 14px; cursor: pointer; font-size: 14px; display: flex;
    align-items: center; gap: 8px; transition: background .15s;
}
.select-option:hover { background: var(--teal-50); }
.select-option.selected { background: var(--teal-50); font-weight: 700; color: var(--teal-900); }

/* Multi Select Chips */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-group.has-error { padding: 8px; border-radius: var(--radius); border: 2px solid var(--red-100); background: var(--red-50); }
.chip {
    padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 500;
    border: 2px solid var(--slate-200); background: #fff; color: var(--slate-500);
    cursor: pointer; transition: all .2s; font-family: var(--font);
}
.chip:hover { border-color: var(--teal-500); }
.chip.active {
    border-color: var(--teal-600); background: linear-gradient(135deg, var(--teal-50), var(--teal-100));
    color: #065f46; font-weight: 600;
}

/* Gender Buttons */
.gender-group { display: flex; gap: 12px; }
.gender-btn {
    flex: 1; padding: 12px 0; border-radius: 10px; font-size: 15px; font-weight: 600;
    border: 2px solid var(--slate-200); background: #fff; color: var(--slate-500);
    cursor: pointer; transition: all .2s; font-family: var(--font);
}
.gender-btn.active { border-color: var(--teal-600); background: linear-gradient(135deg, var(--teal-50), var(--teal-100)); color: #065f46; }
.gender-btn.has-error { border-color: var(--red-600); background: var(--red-50); color: var(--red-600); }

/* Grid */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }

/* Buttons */
.btn {
    padding: 12px 28px; border-radius: var(--radius); border: none; font-size: 15px;
    font-weight: 700; cursor: pointer; display: inline-flex; align-items: center;
    gap: 8px; transition: all .2s; font-family: var(--font);
}
.btn-primary {
    background: linear-gradient(135deg, var(--teal-600), #065f46); color: #fff;
    box-shadow: 0 4px 16px rgba(13,148,136,.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(13,148,136,.4); }
.btn-primary:disabled { background: var(--slate-400); box-shadow: none; cursor: not-allowed; }
.btn-secondary {
    padding: 12px 24px; border: 2px solid var(--slate-200); background: #fff;
    color: var(--slate-500); font-weight: 600;
}
.btn-secondary:hover { border-color: var(--slate-300); background: var(--slate-50); }

.nav-buttons { display: flex; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--slate-100); }
.nav-buttons .spacer { flex: 1; }

.form-footer {
    text-align: center; font-size: 12px; color: var(--slate-400);
    margin-top: 20px; padding: 8px; user-select: none;
}

/* ═══ SUCCESS PAGE ═══ */
.success-page { min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 16px; position: relative; }
.success-card {
    text-align: center; background: #fff; border-radius: var(--radius-lg);
    padding: 48px 32px; box-shadow: var(--shadow-lg); max-width: 500px; width: 100%;
    position: relative; z-index: 1;
}
.success-icon { font-size: 64px; margin-bottom: 16px; }
.success-card h2 { font-size: 24px; font-weight: 800; color: var(--teal-900); margin-bottom: 8px; }
.success-card p { font-size: 15px; color: var(--slate-500); line-height: 1.8; margin-bottom: 24px; }

/* ═══ LOGIN PAGE ═══ */
.login-page { min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 16px; position: relative; }
.login-card {
    width: 100%; max-width: 400px; background: #fff; border-radius: var(--radius-lg);
    padding: 40px 32px; box-shadow: 0 20px 60px rgba(0,0,0,.08);
    position: relative; z-index: 1;
}
.login-card .logo-area { text-align: center; margin-bottom: 24px; }
.login-card .logo-area h2 { font-size: 22px; font-weight: 800; color: var(--slate-900); margin-top: 16px; }
.login-card .logo-area p { font-size: 14px; color: var(--slate-500); }

/* ═══ DASHBOARD ═══ */
.dash-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 250px; background: linear-gradient(180deg, var(--slate-900), var(--slate-800));
    color: #fff; display: flex; flex-direction: column; position: fixed;
    top: 0; bottom: 0; right: 0; z-index: 50;
    box-shadow: -4px 0 24px rgba(0,0,0,.1);
}
.sidebar-header { padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: 12px; }
.sidebar-header .logo { width: 44px; height: 44px; }
.sidebar-header .info p:first-child { font-size: 14px; font-weight: 700; }
.sidebar-header .info p:last-child { font-size: 11px; color: var(--slate-400); }
.sidebar nav { padding: 16px 12px; flex: 1; }
.nav-link {
    display: flex; align-items: center; gap: 10px; padding: 10px 16px;
    border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--slate-400);
    margin-bottom: 4px; transition: all .2s;
}
.nav-link:hover, .nav-link.active { background: rgba(13,148,136,.2); color: #5eead4; }
.sidebar-footer { padding: 16px 12px; border-top: 1px solid rgba(255,255,255,.1); }
.nav-link.logout { color: #f87171; }
.nav-link.logout:hover { background: rgba(248,113,113,.1); }

/* Main */
.dash-main { flex: 1; margin-right: 250px; padding: 24px; background: var(--slate-50); min-height: 100vh; }

/* Top bar */
.top-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.top-bar h2 { font-size: 20px; font-weight: 700; color: var(--slate-900); }
.top-bar .spacer { flex: 1; }
.admin-badge {
    display: flex; align-items: center; gap: 6px; padding: 6px 14px;
    border-radius: 8px; background: var(--teal-50); color: #065f46;
    font-size: 13px; font-weight: 600;
}
.mobile-menu-btn { display: none; background: none; border: none; cursor: pointer; color: var(--slate-700); padding: 8px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: #fff; border-radius: 16px; padding: 20px 24px; box-shadow: var(--shadow);
    border-top: 4px solid var(--teal-600);
}
.stat-card .stat-row { display: flex; justify-content: space-between; align-items: flex-start; }
.stat-label { font-size: 13px; color: var(--slate-500); margin-bottom: 4px; }
.stat-value { font-size: 32px; font-weight: 800; color: var(--slate-900); line-height: 1; }
.stat-sub { font-size: 12px; color: var(--slate-400); margin-top: 4px; }
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px; display: flex;
    align-items: center; justify-content: center; font-size: 22px;
}

/* Charts */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 24px; }
.chart-card { background: #fff; border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
.chart-title { font-size: 15px; font-weight: 700; color: var(--slate-900); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-label { width: 100px; font-size: 13px; color: var(--slate-700); text-align: right; flex-shrink: 0; }
.bar-track { flex: 1; height: 28px; background: var(--slate-100); border-radius: 14px; overflow: hidden; }
.bar-fill {
    height: 100%; border-radius: 14px; display: flex; align-items: center;
    justify-content: flex-end; padding: 0 8px; transition: width .6s ease;
}
.bar-fill.teal { background: linear-gradient(90deg, var(--teal-600), var(--teal-200)); }
.bar-fill.indigo { background: linear-gradient(90deg, var(--indigo-500), #a5b4fc); }
.bar-fill span { font-size: 12px; font-weight: 700; color: #fff; }

/* Filters */
.filter-bar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.search-box {
    display: flex; align-items: center; gap: 8px; background: #fff;
    border: 2px solid var(--slate-200); border-radius: 10px; padding: 8px 14px; min-width: 240px;
}
.search-box input { border: none; outline: none; font-size: 14px; flex: 1; font-family: var(--font); background: transparent; }
.filter-select {
    padding: 8px 14px; border-radius: 10px; border: 2px solid var(--slate-200);
    font-size: 13px; font-family: var(--font); background: #fff; color: var(--slate-700); cursor: pointer;
}
.filter-select:focus { border-color: var(--teal-600); outline: none; }
.btn-clear-filter {
    padding: 8px 14px; border-radius: 10px; border: 1px solid var(--red-100);
    background: var(--red-50); color: var(--red-600); font-size: 13px;
    cursor: pointer; font-family: var(--font); display: flex; align-items: center; gap: 4px;
}

.results-info { font-size: 14px; color: var(--slate-500); margin-bottom: 12px; }
.results-info strong { color: var(--teal-600); }

/* Table */
.table-wrap { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
    padding: 14px 16px; text-align: right; font-weight: 700; color: var(--slate-600);
    background: var(--slate-50); border-bottom: 2px solid var(--slate-200);
    font-size: 13px; white-space: nowrap;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--slate-100); color: var(--slate-600); font-size: 13px; }
tbody tr:nth-child(even) { background: var(--slate-50); }
tbody tr:hover { background: var(--teal-50); }
.td-name { font-weight: 600; color: var(--slate-900); }
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px;
    font-weight: 600; background: var(--teal-50); color: #065f46;
}
.badge.indigo { background: var(--indigo-100); color: var(--indigo-500); }
.view-btn {
    background: none; border: 2px solid var(--slate-200); border-radius: 8px;
    padding: 6px 10px; cursor: pointer; color: var(--teal-600); transition: .2s; font-size: 14px;
}
.view-btn:hover { background: var(--teal-50); border-color: var(--teal-600); }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 4px; padding: 16px; }
.pagination a, .pagination span {
    padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 500;
    border: 1px solid var(--slate-200); color: var(--slate-600);
}
.pagination span.current { background: var(--teal-600); color: #fff; border-color: var(--teal-600); }
.pagination a:hover { background: var(--teal-50); }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200;
    display: flex; justify-content: center; align-items: center; padding: 16px;
}
.modal {
    background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 600px;
    max-height: 85vh; overflow: hidden; animation: fadeIn .3s ease;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px; border-bottom: 1px solid var(--slate-200); background: var(--slate-50);
}
.modal-header h3 { font-size: 18px; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--slate-500); font-size: 20px; padding: 4px; }
.modal-body { padding: 20px 24px; overflow-y: auto; max-height: 70vh; }
.detail-row { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--slate-50); }
.detail-label { min-width: 130px; font-size: 13px; font-weight: 700; color: var(--slate-500); }
.detail-value { font-size: 14px; color: var(--slate-900); flex: 1; line-height: 1.6; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(100%); transition: transform .3s; }
    .sidebar.open { transform: translateX(0); }
    .dash-main { margin-right: 0; padding: 16px; }
    .mobile-menu-btn { display: block; }
    .form-header h1 { font-size: 20px; }
    .form-body { padding: 20px 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; }
    .search-box { width: 100%; min-width: unset; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .step-label { font-size: 9px; }
}

/* Clickable stat cards */
.stat-card-link {
    text-decoration: none; color: inherit; cursor: pointer;
    transition: all .25s;
}
.stat-card-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
}
.stat-sub-link { color: var(--teal-600) !important; font-weight: 500; opacity: 0; transition: opacity .2s; }
.stat-card-link:hover .stat-sub-link { opacity: 1; }

/* Clickable bar rows */
.bar-row-link { text-decoration: none; color: inherit; border-radius: 8px; padding: 4px; margin: -4px; transition: background .2s; }
.bar-row-link:hover { background: var(--slate-50); }

/* Badge links */
a.badge { text-decoration: none; transition: all .2s; }
a.badge:hover { transform: scale(1.05); box-shadow: 0 2px 8px rgba(0,0,0,.1); }
