/* =====================================================================
   Al-Diyar Loss Adjuster - Premium Design System v2.0
   نظام الديار لتخمين الأضرار - نظام التصميم الفاخر
   ===================================================================== */

/* ===== Design Tokens (Light Mode) ===== */
:root {
    /* Brand */
    --gold:              #c9a961;
    --gold-hover:        #d4b872;
    --gold-dark:         #a8892f;
    --gold-glow:         rgba(201,169,97,.15);
    --gold-subtle:       rgba(201,169,97,.06);

    /* Surfaces */
    --bg-body:           #f2f3f7;
    --bg-card:           #ffffff;
    --bg-card-hover:     #fafafa;
    --bg-sidebar:        #0f0f12;
    --bg-sidebar-hover:  rgba(201,169,97,.08);
    --bg-input:          #f7f8fa;
    --bg-overlay:        rgba(15,15,18,.5);

    /* Text */
    --text-primary:      #1a1c23;
    --text-secondary:    #6b7280;
    --text-muted:        #9ca3af;
    --text-inverse:      #ffffff;
    --text-on-gold:      #1a1a1a;

    /* Borders */
    --border:            #e5e7eb;
    --border-light:      #f0f1f5;
    --border-focus:      var(--gold);

    /* Semantic */
    --success:           #10b981;
    --success-bg:        #ecfdf5;
    --success-border:    #a7f3d0;
    --warning:           #f59e0b;
    --warning-bg:        #fffbeb;
    --warning-border:    #fde68a;
    --danger:            #ef4444;
    --danger-bg:         #fef2f2;
    --danger-border:     #fecaca;
    --info:              #3b82f6;
    --info-bg:           #eff6ff;
    --info-border:       #bfdbfe;

    /* Layout */
    --sidebar-w:         270px;
    --navbar-h:          68px;
    --radius-sm:         6px;
    --radius:            10px;
    --radius-lg:         16px;
    --radius-xl:         20px;
    --radius-full:       9999px;

    /* Shadows */
    --shadow-xs:         0 1px 2px rgba(0,0,0,.03);
    --shadow-sm:         0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.02);
    --shadow:            0 4px 12px rgba(0,0,0,.05);
    --shadow-md:         0 8px 24px rgba(0,0,0,.08);
    --shadow-lg:         0 16px 48px rgba(0,0,0,.1);
    --shadow-gold:       0 4px 20px rgba(201,169,97,.25);
    --shadow-card-hover: 0 8px 32px rgba(0,0,0,.08);

    /* Motion */
    --ease:              cubic-bezier(.4,0,.2,1);
    --ease-bounce:       cubic-bezier(.34,1.56,.64,1);
    --duration:          .25s;
    --duration-slow:     .4s;

    /* Font */
    --font:              'Cairo', 'Segoe UI', sans-serif;
}

/* ===== Dark Mode ===== */
[data-theme="dark"] {
    --bg-body:           #0e0e11;
    --bg-card:           #1a1a1f;
    --bg-card-hover:     #222228;
    --bg-sidebar:        #09090b;
    --bg-sidebar-hover:  rgba(201,169,97,.1);
    --bg-input:          #1e1e24;
    --bg-overlay:        rgba(0,0,0,.65);

    --text-primary:      #f0f0f3;
    --text-secondary:    #9ca3af;
    --text-muted:        #6b7280;

    --border:            #2a2a32;
    --border-light:      #1f1f28;

    --success-bg:        rgba(16,185,129,.1);
    --success-border:    rgba(16,185,129,.25);
    --warning-bg:        rgba(245,158,11,.1);
    --warning-border:    rgba(245,158,11,.25);
    --danger-bg:         rgba(239,68,68,.1);
    --danger-border:     rgba(239,68,68,.25);
    --info-bg:           rgba(59,130,246,.1);
    --info-border:       rgba(59,130,246,.25);

    --shadow-xs:         0 1px 2px rgba(0,0,0,.2);
    --shadow-sm:         0 1px 3px rgba(0,0,0,.3);
    --shadow:            0 4px 12px rgba(0,0,0,.3);
    --shadow-md:         0 8px 24px rgba(0,0,0,.4);
    --shadow-lg:         0 16px 48px rgba(0,0,0,.5);
    --shadow-card-hover: 0 8px 32px rgba(0,0,0,.5);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    transition: background var(--duration-slow) var(--ease), color var(--duration-slow) var(--ease);
}

a { color: var(--gold); text-decoration: none; transition: color var(--duration) var(--ease); }
a:hover { color: var(--gold-hover); }

h1, h2, h3, h4, h5, h6 { font-weight: 700; color: var(--text-primary); line-height: 1.3; }

::selection { background: var(--gold); color: var(--text-on-gold); }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }


/* =====================================================================
   SIDEBAR
   ===================================================================== */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg-sidebar);
    color: rgba(255,255,255,.85);
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--duration-slow) var(--ease);
}

/* Subtle gold accent line at the top */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    opacity: .6;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

.brand-logo {
    width: 46px;
    height: 46px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 8px rgba(201,169,97,.3));
}

.brand-text .brand-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: .3px;
}

.brand-text .brand-slogan {
    font-size: 10.5px;
    color: rgba(255,255,255,.4);
    margin-top: 1px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.nav-list { list-style: none; }

.nav-section {
    padding: 20px 22px 8px;
    font-size: 10px;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
    font-weight: 700;
    letter-spacing: 1.5px;
}

.nav-item { margin: 2px 10px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: rgba(255,255,255,.6);
    border-radius: var(--radius-sm);
    transition: all var(--duration) var(--ease);
    font-size: 13.5px;
    position: relative;
}

.nav-link:hover {
    background: var(--bg-sidebar-hover);
    color: var(--gold);
    transform: translateX(-2px);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--bg-sidebar);
    font-weight: 600;
    box-shadow: 0 2px 12px rgba(201,169,97,.3);
}

.nav-link i { font-size: 17px; width: 22px; text-align: center; opacity: .8; }
.nav-link.active i { opacity: 1; }

/* User card in sidebar bottom */
.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.06);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--bg-sidebar);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,.4); }


/* =====================================================================
   MAIN WRAPPER
   ===================================================================== */
.main-wrapper {
    margin-right: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin var(--duration-slow) var(--ease);
}


/* =====================================================================
   TOP NAVBAR
   ===================================================================== */
.top-navbar {
    height: var(--navbar-h);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    padding: 0 28px;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 16px;
    box-shadow: var(--shadow-xs);
    transition: background var(--duration-slow) var(--ease), border-color var(--duration-slow) var(--ease);
}

.btn-toggle-sidebar {
    background: transparent;
    border: 1px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    display: none;
    align-items: center;
    justify-content: center;
}

.btn-toggle-sidebar:hover { border-color: var(--gold); color: var(--gold); }

.navbar-title { flex: 1; }
.navbar-title h1 { font-size: 17px; font-weight: 600; }

.navbar-actions { display: flex; align-items: center; gap: 8px; }

/* Theme toggle */
.theme-toggle {
    background: var(--bg-input);
    border: 1px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: var(--text-secondary);
    transition: all var(--duration) var(--ease);
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover { border-color: var(--gold); color: var(--gold); transform: scale(1.05); }
.theme-toggle .icon-sun, .theme-toggle .icon-moon { transition: all .3s var(--ease-bounce); position: absolute; }
[data-theme="dark"] .theme-toggle .icon-sun { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="dark"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(0); }
.theme-toggle .icon-sun { opacity: 0; transform: rotate(-90deg) scale(0); }
.theme-toggle .icon-moon { opacity: 1; transform: rotate(0) scale(1); }

/* Notification bell */
.btn-icon {
    background: transparent;
    border: 1px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    position: relative;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}

.btn-icon:hover { border-color: var(--gold); color: var(--gold); }

.notif-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--danger);
    color: #fff;
    font-size: 9px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.notif-dropdown { min-width: 300px; border: 1px solid var(--border); box-shadow: var(--shadow-md); border-radius: var(--radius); }
.dropdown-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* User dropdown */
.user-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    padding: 6px 14px 6px 8px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.user-dropdown:hover { border-color: var(--gold); background: var(--gold-subtle); }

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--text-on-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.user-info { text-align: right; line-height: 1.2; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 11px; color: var(--text-muted); }

/* Dropdown menu style override */
.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 6px;
    margin-top: 8px;
}

.dropdown-item {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all var(--duration) var(--ease);
}

.dropdown-item:hover { background: var(--gold-subtle); color: var(--gold); }
.dropdown-item i { font-size: 15px; opacity: .7; }
.dropdown-header { font-size: 12px; color: var(--text-muted); padding: 8px 14px; font-weight: 600; }
.dropdown-divider { border-color: var(--border-light); margin: 4px 0; }


/* =====================================================================
   PAGE CONTENT
   ===================================================================== */
.page-content { flex: 1; padding: 0; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.page-header h2 { font-size: 22px; font-weight: 700; }
.page-header p { color: var(--text-secondary); margin: 4px 0 0; font-size: 14px; }


/* =====================================================================
   CARDS
   ===================================================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--duration) var(--ease);
    overflow: hidden;
}

.card:hover { box-shadow: var(--shadow); }

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-light);
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header h5 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h5 i { color: var(--gold); font-size: 18px; }
.card-body { padding: 24px; }


/* =====================================================================
   STAT CARDS (Dashboard)
   ===================================================================== */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow-sm);
    transition: all var(--duration) var(--ease);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-primary .stat-icon { background: var(--gold-glow); color: var(--gold-dark); }
.stat-primary::after { background: var(--gold); }
.stat-warning .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat-warning::after { background: var(--warning); }
.stat-success .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-success::after { background: var(--success); }
.stat-info .stat-icon { background: var(--info-bg); color: var(--info); }
.stat-info::after { background: var(--info); }
.stat-danger .stat-icon { background: var(--danger-bg); color: var(--danger); }
.stat-danger::after { background: var(--danger); }

.stat-body { flex: 1; min-width: 0; }
.stat-label { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1; color: var(--text-primary); }
.stat-change { font-size: 12px; margin-top: 6px; font-weight: 600; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }


/* =====================================================================
   BUTTONS
   ===================================================================== */
.btn {
    font-family: var(--font);
    font-weight: 600;
    border-radius: var(--radius);
    padding: 10px 20px;
    font-size: 13.5px;
    transition: all var(--duration) var(--ease);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    line-height: 1.4;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--text-on-gold);
    border: none;
    box-shadow: 0 2px 8px rgba(201,169,97,.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-gold);
    color: var(--text-on-gold);
    filter: brightness(1.05);
}

.btn-primary:active { transform: translateY(0); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-subtle); }

.btn-danger { background: var(--danger); color: #fff; border: none; }
.btn-danger:hover { background: #dc2626; color: #fff; transform: translateY(-1px); }

.btn-success { background: var(--success); color: #fff; border: none; }
.btn-success:hover { background: #059669; color: #fff; }

.btn-sm { padding: 6px 14px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-icon-only { width: 38px; height: 38px; padding: 0; justify-content: center; }


/* =====================================================================
   FORMS
   ===================================================================== */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-label .required { color: var(--danger); margin-right: 2px; }

.form-control {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    color: var(--text-primary);
    transition: all var(--duration) var(--ease);
    outline: none;
}

.form-control:hover { border-color: var(--text-muted); }

.form-control:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-glow);
    background: var(--bg-card);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }

.form-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

.input-group {
    position: relative;
    display: flex;
}

.input-group .input-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
}

.input-group .form-control { padding-right: 42px; }

/* Toggle switch */
.form-switch-custom {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.switch-track {
    width: 44px;
    height: 24px;
    background: var(--border);
    border-radius: 12px;
    position: relative;
    transition: background var(--duration) var(--ease);
}

.switch-track::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--duration) var(--ease-bounce);
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

.form-switch-custom input { display: none; }
.form-switch-custom input:checked + .switch-track { background: var(--gold); }
.form-switch-custom input:checked + .switch-track::after { transform: translateX(-20px); }


/* =====================================================================
   TABLES
   ===================================================================== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.data-table thead th {
    background: var(--bg-input);
    padding: 14px 18px;
    text-align: right;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background var(--duration) var(--ease);
    border-bottom: 1px solid var(--border-light);
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--gold-subtle); }

.data-table tbody td {
    padding: 14px 18px;
    vertical-align: middle;
}

/* User row with avatar */
.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-cell-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--text-on-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.user-cell-name { font-weight: 600; color: var(--text-primary); font-size: 14px; }
.user-cell-email { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Badges / Status pills */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.badge-info { background: var(--info-bg); color: var(--info); border: 1px solid var(--info-border); }
.badge-gold {
    background: var(--gold-glow);
    color: var(--gold-dark);
    border: 1px solid rgba(201,169,97,.3);
}

.badge-dot::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* Action buttons in table */
.table-actions {
    display: flex;
    gap: 6px;
}

.btn-action {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all var(--duration) var(--ease);
}

.btn-action:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-subtle); }
.btn-action.danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }


/* =====================================================================
   SEARCH & FILTER BAR
   ===================================================================== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 220px;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 42px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 13.5px;
    color: var(--text-primary);
    transition: all var(--duration) var(--ease);
}

.search-box input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); outline: none; }

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 15px;
}

.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
    padding: 7px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg-card);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    font-weight: 500;
}

.chip:hover { border-color: var(--gold); color: var(--gold); }
.chip.active {
    background: var(--gold);
    color: var(--text-on-gold);
    border-color: var(--gold);
    box-shadow: 0 2px 8px rgba(201,169,97,.25);
}


/* =====================================================================
   MODAL
   ===================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration) var(--ease);
    backdrop-filter: blur(4px);
}

.modal-overlay.show { opacity: 1; visibility: visible; }

.modal-box {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(.95) translateY(10px);
    transition: transform var(--duration-slow) var(--ease-bounce);
}

.modal-overlay.show .modal-box { transform: scale(1) translateY(0); }

.modal-header {
    padding: 24px 28px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3 { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.modal-header h3 i { color: var(--gold); }

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all var(--duration) var(--ease);
}

.modal-close:hover { background: var(--danger-bg); color: var(--danger); }

.modal-body { padding: 24px 28px; }
.modal-footer { padding: 16px 28px 24px; display: flex; justify-content: flex-end; gap: 10px; }


/* =====================================================================
   PAGINATION
   ===================================================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 20px 0;
}

.page-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration) var(--ease);
    font-family: var(--font);
}

.page-btn:hover { border-color: var(--gold); color: var(--gold); }
.page-btn.active { background: var(--gold); color: var(--text-on-gold); border-color: var(--gold); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }


/* =====================================================================
   ALERTS & FLASH
   ===================================================================== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid;
    margin-bottom: 16px;
}

.alert-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.alert-danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.alert-info { background: var(--info-bg); border-color: var(--info-border); color: var(--info); }

.alert .btn-close { filter: none; opacity: .6; }
.alert .btn-close:hover { opacity: 1; }

/* Toast notification */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 20px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: toastIn .4s var(--ease-bounce);
    font-size: 14px;
}

.toast.toast-success { border-right: 4px solid var(--success); }
.toast.toast-danger { border-right: 4px solid var(--danger); }

@keyframes toastIn { from { opacity: 0; transform: translateX(-20px) scale(.95); } }


/* =====================================================================
   QUICK ACTIONS
   ===================================================================== */
.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    text-align: center;
    transition: all var(--duration) var(--ease);
    color: var(--text-primary);
    text-decoration: none;
    min-height: 110px;
    position: relative;
    overflow: hidden;
}

.quick-action::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    opacity: 0;
    transition: opacity var(--duration) var(--ease);
}

.quick-action:hover::before { opacity: 1; }
.quick-action:hover { color: var(--text-on-gold); transform: translateY(-3px); box-shadow: var(--shadow-gold); border-color: var(--gold); }
.quick-action:hover i, .quick-action:hover span { position: relative; z-index: 1; color: var(--text-on-gold); }
.quick-action i { font-size: 28px; color: var(--gold); transition: color var(--duration) var(--ease); }
.quick-action span { font-size: 13px; font-weight: 600; position: relative; z-index: 1; }


/* =====================================================================
   INFO LIST
   ===================================================================== */
.info-list { list-style: none; }

.info-list li {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13.5px;
}

.info-list li:last-child { border-bottom: none; }
.info-list li span { color: var(--text-secondary); }


/* =====================================================================
   WELCOME & DASHBOARD
   ===================================================================== */
.welcome-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 28px;
}

.welcome-header h2 { font-size: 24px; }
.welcome-header p { color: var(--text-secondary); margin: 4px 0 0; }


/* =====================================================================
   LOGIN PAGE
   ===================================================================== */
.auth-body {
    background: var(--bg-sidebar);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.auth-body::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -15%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(201,169,97,.12) 0%, transparent 70%);
    border-radius: 50%;
    animation: authGlow 6s ease-in-out infinite alternate;
}

.auth-body::after {
    content: '';
    position: absolute;
    bottom: -25%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(201,169,97,.08) 0%, transparent 70%);
    border-radius: 50%;
    animation: authGlow 8s ease-in-out 2s infinite alternate;
}

@keyframes authGlow { from { transform: scale(1); } to { transform: scale(1.15); } }

.auth-container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    animation: authSlideUp .5s var(--ease-bounce);
}

@keyframes authSlideUp { from { opacity: 0; transform: translateY(30px); } }

.auth-brand { text-align: center; margin-bottom: 30px; }

.auth-logo {
    width: 88px;
    height: 88px;
    object-fit: contain;
    margin-bottom: 16px;
    background: var(--bg-sidebar);
    border-radius: 50%;
    padding: 14px;
    box-shadow: 0 4px 24px rgba(201,169,97,.3);
}

.auth-title { font-size: 21px; color: var(--text-primary); margin: 0 0 6px; }
.auth-slogan { font-size: 13px; color: var(--gold); margin: 0; font-weight: 500; }

.auth-form .form-floating > label { padding-right: 14px; }
.auth-form .form-floating > label i { margin-left: 6px; color: var(--gold); }

.auth-form .form-control {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 14px;
    font-family: var(--font);
    background: var(--bg-input);
    color: var(--text-primary);
}

.auth-form .form-control:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); }

.btn-toggle-password {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    font-size: 16px;
    z-index: 5;
}

.btn-toggle-password:hover { color: var(--gold); }

.btn-auth {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    border: none;
    color: var(--text-on-gold);
    padding: 14px;
    font-weight: 700;
    border-radius: var(--radius);
    transition: all var(--duration) var(--ease);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    font-size: 15px;
}

.btn-auth:hover { transform: translateY(-2px); box-shadow: var(--shadow-gold); color: var(--text-on-gold); filter: brightness(1.05); }

.form-check-input:checked { background-color: var(--gold); border-color: var(--gold); }

.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
    font-size: 12px;
    color: var(--text-muted);
}


/* =====================================================================
   FOOTER
   ===================================================================== */
.app-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
    padding: 14px 28px;
    font-size: 13px;
    color: var(--text-muted);
    transition: all var(--duration-slow) var(--ease);
}


/* =====================================================================
   UTILITY CLASSES
   ===================================================================== */
.text-gold { color: var(--gold) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted) !important; }
.bg-gold-subtle { background: var(--gold-subtle) !important; }
.fw-600 { font-weight: 600 !important; }

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, var(--border-light) 25%, var(--bg-card) 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i { font-size: 48px; opacity: .3; margin-bottom: 16px; display: block; }
.empty-state h4 { color: var(--text-secondary); font-weight: 600; margin-bottom: 8px; }


/* =====================================================================
   ANIMATIONS
   ===================================================================== */
.fade-in { animation: fadeIn .4s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } }

.slide-up { animation: slideUp .5s var(--ease-bounce); }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } }

/* Stagger children */
.stagger > * { animation: fadeSlideUp .4s var(--ease) backwards; }
.stagger > *:nth-child(1) { animation-delay: .05s; }
.stagger > *:nth-child(2) { animation-delay: .1s; }
.stagger > *:nth-child(3) { animation-delay: .15s; }
.stagger > *:nth-child(4) { animation-delay: .2s; }
.stagger > *:nth-child(5) { animation-delay: .25s; }
.stagger > *:nth-child(6) { animation-delay: .3s; }

@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(12px); } }


/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(100%); }
    .sidebar.show { transform: translateX(0); }
    .main-wrapper { margin-right: 0; }
    .btn-toggle-sidebar { display: inline-flex; }
}

@media (max-width: 575.98px) {
    .top-navbar { padding: 0 16px; }
    .card-body { padding: 16px; }
    .auth-card { padding: 30px 24px; }
    .welcome-header h2 { font-size: 18px; }
    .stat-value { font-size: 22px; }
    .filter-bar { gap: 8px; }
}
/* =====================================================================
   TABS FIX - أضف هذا في نهاية app.css
   ===================================================================== */

.nav-tabs {
    border-bottom: 2px solid var(--border);
    gap: 4px;
    padding: 0;
    margin-bottom: 20px;
}

.nav-tabs .nav-item {
    list-style: none;
}

.nav-tabs .nav-link {
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 14px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    margin-bottom: -2px;
    font-family: var(--font);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-tabs .nav-link:hover {
    color: var(--gold);
    background: var(--gold-subtle);
    border-bottom-color: var(--gold-glow);
}

.nav-tabs .nav-link.active {
    color: var(--gold);
    background: var(--bg-card);
    border-bottom: 3px solid var(--gold);
    font-weight: 700;
}

/* Tab content fade animation */
.tab-content > .tab-pane {
    display: none;
}

.tab-content > .tab-pane.active.show {
    display: block;
    animation: fadeIn .3s var(--ease);
}

/* Bootstrap modal dark mode fix */
[data-theme="dark"] .modal-content {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: var(--border-light);
}

[data-theme="dark"] .btn-close {
    filter: invert(1);
}
