/* ══════════════════════════════════════════════════════════
   PHARMACY INSPECTION SYSTEM  —  PREMIUM UI  v3.0
   ══════════════════════════════════════════════════════════ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&display=swap');

/* ══════════════════════════════════════════════════════════
   CSS VARIABLES
   ══════════════════════════════════════════════════════════ */
:root {
    /* Brand */
    --primary:       #1a237e;
    --primary-light: #283593;
    --primary-dark:  #0d1b5e;
    --primary-glow:  rgba(26,35,126,0.35);

    /* Accents */
    --accent:        #ffd600;
    --accent-2:      #ff6f00;
    --secondary:     #00897b;
    --secondary-light:#26a69a;

    /* States */
    --danger:   #e53935;
    --warning:  #fb8c00;
    --success:  #2e7d32;
    --info:     #0277bd;

    /* Neutral */
    --dark:     #0f172a;
    --surface:  #f1f5ff;
    --surface-2:#e8eeff;
    --border:   #e2e8f8;
    --text-1:   #0f172a;
    --text-2:   #475569;
    --text-3:   #94a3b8;

    /* Layout */
    --sidebar-width: 272px;
    --header-height: 68px;
    --card-radius:   18px;
    --radius-sm:     10px;
    --radius-md:     14px;

    /* Shadows */
    --shadow-xs: 0 1px 4px rgba(15,23,42,0.06);
    --shadow-sm: 0 2px 12px rgba(26,35,126,0.08);
    --shadow-md: 0 6px 24px rgba(26,35,126,0.13);
    --shadow-lg: 0 12px 48px rgba(26,35,126,0.20);
    --shadow-xl: 0 24px 64px rgba(26,35,126,0.28);

    /* Transitions */
    --ease:     cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition: all 0.3s var(--ease);

    /* Glass */
    --glass:         rgba(255,255,255,0.82);
    --glass-border:  rgba(255,255,255,0.45);
    --glass-shadow:  0 8px 32px rgba(26,35,126,0.12);
}

/* ══════════════════════════════════════════════════════════
   RESET & BASE
   ══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Cairo', 'Segoe UI', 'Tahoma', sans-serif;
    background: var(--surface);
    color: var(--text-1);
    direction: rtl;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    position: relative;
}

/* Mesh background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 0%, rgba(26,35,126,0.06) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 100%, rgba(0,137,123,0.05) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ══════════════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════════════ */
.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(175deg,
        #06093d 0%,
        #0d1b5e 25%,
        #1a237e 55%,
        #1565c0 85%,
        #1976d2 100%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s var(--ease);
    box-shadow: -2px 0 60px rgba(6,9,61,0.45);
    overflow: hidden;
}

/* Sidebar shimmer overlay */
.sidebar::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse 40% 40% at 60% 30%,
        rgba(255,255,255,0.07) 0%, transparent 60%);
    pointer-events: none;
}

/* Animated top glow */
.sidebar::after {
    content: '';
    position: absolute;
    top: 0; right: 0; left: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

/* ── SIDEBAR LOGO ── */
.sidebar-logo {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    min-height: var(--header-height);
    position: relative;
    z-index: 1;
}

.sidebar-logo-img {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(255,214,0,0.45), inset 0 1px 0 rgba(255,255,255,0.3);
    animation: logo-pulse 3s var(--ease) infinite;
}

@keyframes logo-pulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(255,214,0,0.45); }
    50%       { box-shadow: 0 4px 28px rgba(255,214,0,0.7); }
}

.sidebar-logos {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sidebar-logo-img-item {
    height: 56px;
    width: auto;
    max-width: 80px;
    object-fit: contain;
    border-radius: 12px;
    background: rgba(255,255,255,0.12);
    padding: 6px;
    transition: var(--transition);
}

.sidebar-logo-img-item:hover { transform: scale(1.05); background: rgba(255,255,255,0.2); }

.sidebar-title {
    color: white;
    font-size: 12.5px;
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: 0.2px;
}

/* ── SIDEBAR NAV ── */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
    position: relative;
    z-index: 1;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.nav-section-label {
    color: rgba(255,255,255,0.35);
    font-size: 9.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 18px 22px 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.08);
}

.nav-item { margin: 2px 12px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    color: rgba(255,255,255,0.68) !important;
    text-decoration: none !important;
    border-radius: 12px;
    transition: all 0.25s var(--ease);
    font-size: 13.5px;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background 0.25s var(--ease);
    border-radius: 12px;
}

.nav-link:hover {
    color: white !important;
    transform: translateX(-3px);
}

.nav-link:hover::before { background: rgba(255,255,255,0.1); }

.nav-link.active {
    color: white !important;
    background: rgba(255,255,255,0.15);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2),
                inset 0 1px 0 rgba(255,255,255,0.2);
}

/* Active left accent bar */
.nav-link.active::after {
    content: '';
    position: absolute;
    left: 0; top: 20%; bottom: 20%;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 10px var(--accent);
}

.nav-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    font-size: 15px;
    flex-shrink: 0;
    transition: all 0.25s var(--ease-spring);
}

.nav-link:hover .nav-icon {
    background: rgba(255,255,255,0.18);
    transform: scale(1.12) rotate(-4deg);
}

.nav-link.active .nav-icon {
    background: rgba(255,255,255,0.2);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ── SIDEBAR FOOTER ── */
.sidebar-footer {
    padding: 14px 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    position: relative;
    z-index: 1;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    transition: var(--transition);
}

.user-card:hover { background: rgba(255,255,255,0.14); }

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 15px;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,137,123,0.4);
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info { flex: 1; min-width: 0; }
.user-name { color: white; font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: rgba(255,255,255,0.48); font-size: 10.5px; margin-top: 1px; }

/* ── MOBILE OVERLAY ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(6,9,61,0.6);
    z-index: 999;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* ══════════════════════════════════════════════════════════
   MAIN WRAPPER
   ══════════════════════════════════════════════════════════ */
.main-wrapper {
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin 0.4s var(--ease);
    position: relative;
    z-index: 1;
}

/* ══════════════════════════════════════════════════════════
   TOP HEADER
   ══════════════════════════════════════════════════════════ */
.top-header {
    height: var(--header-height);
    background: var(--glass);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 0 rgba(26,35,126,0.06),
                0 4px 24px rgba(26,35,126,0.06);
}

/* Gradient accent line at top of header */
.top-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--primary) 20%,
        var(--secondary) 50%,
        var(--primary) 80%,
        transparent 100%);
    opacity: 0.25;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    transition: var(--transition);
}

.menu-toggle:hover { background: rgba(26,35,126,0.08); }

.page-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary-dark);
    margin: 0;
    flex: 1;
    letter-spacing: -0.3px;
}

.header-actions { display: flex; align-items: center; gap: 8px; }

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: white;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.25s var(--ease-spring);
    text-decoration: none;
    box-shadow: var(--shadow-xs);
}

.header-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px var(--primary-glow);
}

/* ══════════════════════════════════════════════════════════
   PAGE CONTENT
   ══════════════════════════════════════════════════════════ */
.page-content { flex: 1; padding: 28px; }

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 14px;
}

.content-header h1 {
    font-size: 22px;
    font-weight: 900;
    color: var(--primary-dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.4px;
}

.content-header h1 .icon-box {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    box-shadow: 0 6px 20px var(--primary-glow);
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════ */
.card {
    background: white;
    border-radius: var(--card-radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s var(--ease);
    position: relative;
    overflow: hidden;
}

/* Top gradient accent line */
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity 0.3s var(--ease);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: rgba(26,35,126,0.15);
}

.card:hover::before { opacity: 1; }

.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(226,232,248,0.8);
    padding: 18px 22px;
    font-weight: 800;
    font-size: 14px;
    color: var(--primary-dark);
    border-radius: var(--card-radius) var(--card-radius) 0 0 !important;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body { padding: 22px; }

/* ══════════════════════════════════════════════════════════
   STAT CARDS
   ══════════════════════════════════════════════════════════ */
.stat-card {
    background: white;
    border-radius: var(--card-radius);
    padding: 22px 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all 0.35s var(--ease-spring);
    position: relative;
    overflow: hidden;
    cursor: default;
}

/* Gradient top bar */
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0; left: 0;
    height: 3px;
    border-radius: var(--card-radius) var(--card-radius) 0 0;
    transition: height 0.3s var(--ease);
}

/* Shimmer sweep */
.stat-card::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    right: -100%;
    width: 50%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transform: skewX(-20deg);
    transition: right 0.6s var(--ease);
    pointer-events: none;
}

.stat-card:hover::after { right: 120%; }
.stat-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.stat-card:hover::before { height: 4px; }

/* Color variants */
.stat-card.primary::before { background: linear-gradient(90deg, #1a237e, #1565c0); }
.stat-card.secondary::before { background: linear-gradient(90deg, #00897b, #26a69a); }
.stat-card.danger::before { background: linear-gradient(90deg, #c62828, #e53935); }
.stat-card.warning::before { background: linear-gradient(90deg, #e65100, #fb8c00); }
.stat-card.success::before { background: linear-gradient(90deg, #1b5e20, #2e7d32); }
.stat-card.info::before { background: linear-gradient(90deg, #01579b, #0277bd); }

.stat-icon {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    transition: all 0.35s var(--ease-spring);
}

.stat-card:hover .stat-icon { transform: scale(1.12) rotate(-6deg); }

.stat-icon.primary  { background: linear-gradient(135deg,rgba(26,35,126,0.12),rgba(26,35,126,0.06)); color:#1a237e; }
.stat-icon.secondary{ background: linear-gradient(135deg,rgba(0,137,123,0.12),rgba(0,137,123,0.06)); color:#00897b; }
.stat-icon.danger   { background: linear-gradient(135deg,rgba(229,57,53,0.12),rgba(229,57,53,0.06)); color:#e53935; }
.stat-icon.warning  { background: linear-gradient(135deg,rgba(251,140,0,0.12),rgba(251,140,0,0.06)); color:#fb8c00; }
.stat-icon.success  { background: linear-gradient(135deg,rgba(46,125,50,0.12),rgba(46,125,50,0.06)); color:#2e7d32; }
.stat-icon.info     { background: linear-gradient(135deg,rgba(2,119,189,0.12),rgba(2,119,189,0.06)); color:#0277bd; }

.stat-info { flex: 1; }
.stat-label { font-size: 11.5px; color: var(--text-3); font-weight: 600; margin-bottom: 5px; letter-spacing: 0.2px; }
.stat-value { font-size: 30px; font-weight: 900; color: var(--text-1); line-height: 1; letter-spacing: -1px; }
.stat-sub { font-size: 11px; color: var(--text-3); margin-top: 5px; }

/* Avatar */
.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
}
.avatar.primary  { background: linear-gradient(135deg, var(--primary), var(--primary-light)); }
.avatar.secondary{ background: linear-gradient(135deg, var(--secondary), var(--secondary-light)); }
.avatar.danger   { background: linear-gradient(135deg, var(--danger), #ef5350); }
.avatar.warning  { background: linear-gradient(135deg, var(--warning), #ffa726); }
.avatar.success  { background: linear-gradient(135deg, var(--success), #388e3c); }
.avatar.info     { background: linear-gradient(135deg, var(--info), #039be5); }

/* ══════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════ */
.btn {
    border-radius: var(--radius-sm);
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: 13px;
    padding: 9px 18px;
    transition: all 0.25s var(--ease-spring);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: none;
    cursor: pointer;
    text-decoration: none !important;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.1px;
}

/* Ripple */
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.18);
    border-radius: inherit;
    transform: scale(0);
    opacity: 0;
    transition: transform 0.4s var(--ease), opacity 0.4s var(--ease);
}

.btn:active::after { transform: scale(2); opacity: 1; transition: none; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.98); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
    color: white;
    box-shadow: 0 4px 16px var(--primary-glow);
}
.btn-primary:hover { box-shadow: 0 8px 28px var(--primary-glow); color: white; }

.btn-secondary {
    background: linear-gradient(135deg, #006064, var(--secondary));
    color: white;
    box-shadow: 0 4px 14px rgba(0,137,123,0.35);
}
.btn-secondary:hover { box-shadow: 0 8px 24px rgba(0,137,123,0.45); color: white; }

.btn-danger {
    background: linear-gradient(135deg, #b71c1c, var(--danger));
    color: white;
    box-shadow: 0 4px 14px rgba(229,57,53,0.35);
}
.btn-danger:hover { box-shadow: 0 8px 24px rgba(229,57,53,0.45); color: white; }

.btn-warning {
    background: linear-gradient(135deg, #e65100, var(--warning));
    color: white;
    box-shadow: 0 4px 14px rgba(251,140,0,0.35);
}
.btn-warning:hover { color: white; box-shadow: 0 8px 24px rgba(251,140,0,0.45); }

.btn-success {
    background: linear-gradient(135deg, #1b5e20, var(--success));
    color: white;
    box-shadow: 0 4px 14px rgba(46,125,50,0.35);
}
.btn-success:hover { color: white; box-shadow: 0 8px 24px rgba(46,125,50,0.45); }

.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: none;
}
.btn-outline-primary:hover { background: var(--primary); color: white; box-shadow: 0 4px 16px var(--primary-glow); }

.btn-light {
    background: rgba(26,35,126,0.07);
    color: var(--primary);
    border: 1px solid var(--border);
}
.btn-light:hover { background: rgba(26,35,126,0.13); color: var(--primary); }

.btn-sm  { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-lg  { padding: 13px 28px; font-size: 15px; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: 9px; }

/* ══════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════ */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    padding: 10px 14px;
    font-size: 13.5px;
    font-family: 'Cairo', sans-serif;
    transition: all 0.25s var(--ease);
    background: white;
    color: var(--text-1);
    direction: rtl;
    box-shadow: var(--shadow-xs);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(26,35,126,0.1);
    outline: none;
    background: white;
}

.form-control::placeholder { color: var(--text-3); }
.form-label { font-size: 12.5px; font-weight: 700; color: var(--text-2); margin-bottom: 7px; display: block; }
.form-group { margin-bottom: 18px; }

.input-group { position: relative; }
.input-group .form-control { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group-text {
    border: 1.5px solid var(--border);
    border-left: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    background: #f8f9ff;
    color: var(--primary);
    font-size: 15px;
    padding: 0 14px;
}

.form-section {
    background: linear-gradient(135deg, #f8f9ff 0%, #f1f5ff 100%);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.form-section-title {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ══════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════ */
.table-container {
    background: white;
    border-radius: var(--card-radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.table-container:hover { box-shadow: var(--shadow-md); }

.table-header {
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
    background: linear-gradient(135deg, #fafbff 0%, #f5f7ff 100%);
}

.table-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.data-table { width: 100%; border-collapse: separate; border-spacing: 0; }

.data-table thead th {
    background: linear-gradient(135deg, #f3f5ff 0%, #eef0ff 100%);
    color: var(--primary);
    font-weight: 800;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 14px 16px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.data-table tbody tr {
    transition: all 0.2s var(--ease);
    animation: row-enter 0.3s var(--ease) both;
}

@keyframes row-enter {
    from { opacity: 0; transform: translateX(8px); }
    to   { opacity: 1; transform: translateX(0); }
}

.data-table tbody tr:nth-child(1) { animation-delay: 0.03s; }
.data-table tbody tr:nth-child(2) { animation-delay: 0.06s; }
.data-table tbody tr:nth-child(3) { animation-delay: 0.09s; }
.data-table tbody tr:nth-child(4) { animation-delay: 0.12s; }
.data-table tbody tr:nth-child(5) { animation-delay: 0.15s; }
.data-table tbody tr:nth-child(6) { animation-delay: 0.18s; }
.data-table tbody tr:nth-child(7) { animation-delay: 0.21s; }
.data-table tbody tr:nth-child(8) { animation-delay: 0.24s; }
.data-table tbody tr:nth-child(n+9) { animation-delay: 0.27s; }

.data-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(26,35,126,0.03), rgba(26,35,126,0.02));
    transform: translateX(-2px);
}

.data-table tbody td {
    padding: 13px 16px;
    font-size: 13px;
    color: var(--text-2);
    border-bottom: 1px solid rgba(226,232,248,0.6);
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

/* ══════════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════════ */
.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    letter-spacing: 0.2px;
}

.badge-primary  { background: rgba(26,35,126,0.1);  color: var(--primary); }
.badge-secondary{ background: rgba(0,137,123,0.1);  color: var(--secondary); }
.badge-success  { background: rgba(46,125,50,0.12); color: var(--success); }
.badge-danger   { background: rgba(229,57,53,0.12); color: var(--danger); }
.badge-warning  { background: rgba(251,140,0,0.12); color: var(--warning); }
.badge-info     { background: rgba(2,119,189,0.12); color: var(--info); }

/* ══════════════════════════════════════════════════════════
   SEARCH BAR
   ══════════════════════════════════════════════════════════ */
.search-bar {
    display: flex;
    align-items: center;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 0 14px;
    gap: 10px;
    transition: all 0.25s var(--ease);
    min-width: 260px;
    box-shadow: var(--shadow-xs);
}

.search-bar:focus-within {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(26,35,126,0.08), var(--shadow-sm);
}

.search-bar input {
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 13.5px;
    font-family: 'Cairo', sans-serif;
    flex: 1;
    outline: none;
    color: var(--text-1);
}

.search-bar input::placeholder { color: var(--text-3); }
.search-bar .search-icon { color: var(--text-3); font-size: 15px; }
.search-bar:focus-within .search-icon { color: var(--primary); }

/* ══════════════════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════════════════ */
.alert {
    border-radius: var(--radius-md);
    padding: 14px 18px;
    border: none;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 20px;
    border-right: 4px solid;
    box-shadow: var(--shadow-sm);
}

.alert-success { background: rgba(46,125,50,0.07); color: #1b5e20; border-right-color: var(--success); }
.alert-danger  { background: rgba(229,57,53,0.07); color: #b71c1c; border-right-color: var(--danger); }
.alert-warning { background: rgba(251,140,0,0.07); color: #e65100; border-right-color: var(--warning); }
.alert-info    { background: rgba(2,119,189,0.07); color: #01579b; border-right-color: var(--info); }

/* ══════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════ */
.modal-content {
    border-radius: 22px;
    border: none;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
    color: white;
    padding: 20px 26px;
    border: none;
}

.modal-title { font-weight: 800; font-size: 16px; }
.modal-header .btn-close { filter: invert(1); opacity: 0.8; }
.modal-body { padding: 26px; }
.modal-footer { padding: 16px 26px; border: none; border-top: 1px solid var(--border); }

/* ══════════════════════════════════════════════════════════
   FILE UPLOAD
   ══════════════════════════════════════════════════════════ */
.file-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s var(--ease);
    background: linear-gradient(135deg, #f8f9ff 0%, #f3f5ff 100%);
    position: relative;
}

.file-upload-area:hover, .file-upload-area.drag-over {
    border-color: var(--primary);
    background: rgba(26,35,126,0.04);
    box-shadow: 0 0 0 4px rgba(26,35,126,0.06);
}

.file-upload-area input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-upload-icon { font-size: 38px; color: var(--primary); margin-bottom: 10px; opacity: 0.7; }
.file-upload-text { font-size: 13.5px; color: var(--text-2); font-weight: 600; }
.file-upload-hint { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }

/* ══════════════════════════════════════════════════════════
   MAP
   ══════════════════════════════════════════════════════════ */
#map {
    width: 100%;
    height: 500px;
    border-radius: var(--card-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    z-index: 1;
}

.leaflet-popup-content-wrapper {
    border-radius: 14px !important;
    box-shadow: var(--shadow-lg) !important;
}

/* ══════════════════════════════════════════════════════════
   DETAIL VIEW
   ══════════════════════════════════════════════════════════ */
.detail-card { background: white; border-radius: var(--card-radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border); overflow: hidden; }

.detail-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
    color: white;
    padding: 26px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.detail-header-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}

.detail-row {
    display: flex;
    padding: 15px 22px;
    border-bottom: 1px solid rgba(226,232,248,0.6);
    font-size: 13.5px;
    align-items: flex-start;
    gap: 14px;
    transition: background 0.2s var(--ease);
}

.detail-row:hover { background: rgba(26,35,126,0.02); }
.detail-row:last-child { border-bottom: none; }
.detail-label { font-weight: 700; color: var(--text-2); min-width: 160px; flex-shrink: 0; }
.detail-value { color: var(--text-1); flex: 1; }

/* ══════════════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════════════ */
.empty-state { text-align: center; padding: 70px 20px; }

.empty-state-icon {
    font-size: 60px;
    margin-bottom: 18px;
    display: block;
    animation: float 3s var(--ease) infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}

.empty-state-title { font-size: 18px; font-weight: 800; color: var(--text-2); margin-bottom: 8px; }
.empty-state-text  { font-size: 13.5px; color: var(--text-3); }

/* ══════════════════════════════════════════════════════════
   PROGRESS
   ══════════════════════════════════════════════════════════ */
.progress {
    height: 7px;
    border-radius: 20px;
    background: rgba(226,232,248,0.8);
    overflow: hidden;
}

.progress-bar {
    border-radius: 20px;
    transition: width 1.2s cubic-bezier(0.4,0,0.2,1);
    position: relative;
    overflow: hidden;
}

/* Shine on progress bar */
.progress-bar::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; bottom: 0;
    width: 60%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: progress-shine 2s var(--ease) infinite;
}

@keyframes progress-shine {
    0% { left: -100%; }
    60%, 100% { left: 150%; }
}

/* ══════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(22px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(-16px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

.animate-fade-up   { animation: fadeInUp 0.45s var(--ease-out) both; }
.animate-fade      { animation: fadeIn   0.4s  var(--ease-out) both; }
.animate-scale     { animation: scaleIn  0.4s  var(--ease-spring) both; }

.delay-1  { animation-delay: 0.08s; }
.delay-2  { animation-delay: 0.16s; }
.delay-3  { animation-delay: 0.24s; }
.delay-4  { animation-delay: 0.32s; }
.delay-5  { animation-delay: 0.40s; }

/* Page-level entrance */
.page-content > * { animation: fadeInUp 0.4s var(--ease-out) both; }
.page-content > *:nth-child(2) { animation-delay: 0.05s; }
.page-content > *:nth-child(3) { animation-delay: 0.10s; }
.page-content > *:nth-child(4) { animation-delay: 0.15s; }

/* ══════════════════════════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c5cae9; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ══════════════════════════════════════════════════════════
   MAP POPUP
   ══════════════════════════════════════════════════════════ */
.map-popup { min-width: 220px; direction: rtl; }
.map-popup h6 { font-size: 14px; font-weight: 800; color: var(--primary); margin: 0 0 8px; }
.map-popup p { font-size: 12px; color: #666; margin: 3px 0; display: flex; align-items: center; gap: 6px; }
.map-popup .popup-badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; margin-top: 8px; }
.map-popup .popup-badge.success { background: rgba(46,125,50,0.12); color: var(--success); }
.map-popup .popup-badge.danger  { background: rgba(229,57,53,0.12); color: var(--danger); }

/* ══════════════════════════════════════════════════════════
   LOGIN PAGE (kept for fallback)
   ══════════════════════════════════════════════════════════ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #1565c0 100%);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    position: relative; overflow: hidden; padding: 24px 16px;
}
.login-logos-bar { display:flex; align-items:center; justify-content:center; gap:32px; margin-bottom:24px; z-index:1; position:relative; }
.login-top-logo { height:110px; width:auto; max-width:200px; object-fit:contain; filter:drop-shadow(0 6px 16px rgba(0,0,0,0.35)); background:rgba(255,255,255,0.15); border-radius:16px; padding:10px; }
.login-bg-shapes { position:absolute; inset:0; overflow:hidden; pointer-events:none; }
.login-bg-shapes .shape { position:absolute; border-radius:50%; background:rgba(255,255,255,0.05); }
.login-bg-shapes .shape-1 { width:400px;height:400px;top:-100px;right:-100px; }
.login-bg-shapes .shape-2 { width:300px;height:300px;bottom:-80px;left:-80px; }
.login-bg-shapes .shape-3 { width:150px;height:150px;top:50%;left:10%; }
.login-bg-shapes .shape-4 { width:80px;height:80px;top:20%;left:40%;background:rgba(255,214,0,0.1); }
.login-card { background:white; border-radius:24px; padding:48px 40px; width:100%; max-width:420px; box-shadow:0 30px 80px rgba(0,0,0,0.3); position:relative; animation:fadeInUp 0.6s ease; }
.login-logo { text-align:center; margin-bottom:32px; }
.login-logo-icon { width:72px;height:72px;background:linear-gradient(135deg,var(--primary),var(--primary-light));border-radius:20px;display:flex;align-items:center;justify-content:center;margin:0 auto 16px;font-size:32px;color:white;box-shadow:0 8px 24px rgba(26,35,126,0.3); }
.login-title { font-size:22px;font-weight:800;color:var(--primary);margin:0 0 6px; }
.login-subtitle { font-size:13px;color:#888; }
.login-form .form-control { padding:12px 14px;font-size:14px;border-radius:12px; }
.login-btn { width:100%;padding:13px;font-size:15px;border-radius:12px;font-weight:700; }

/* ══════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 991px) {
    .sidebar { transform: translateX(100%); transition: transform 0.35s var(--ease); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .main-wrapper { margin-right: 0; }
    .menu-toggle { display: flex; }
    .page-content { padding: 16px; }
    .content-header { flex-direction: column; align-items: flex-start; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 24px; }
    .stat-icon { width: 48px; height: 48px; font-size: 20px; }
    #map { height: 340px; }
    .detail-row { flex-direction: column; gap: 4px; }
    .detail-label { min-width: auto; }
    .search-bar { min-width: auto; width: 100%; }
}

@media (max-width: 576px) {
    .login-card { padding: 32px 20px; margin: 16px; }
    .table-header { flex-direction: column; align-items: flex-start; }
    .data-table { font-size: 12px; }
    .data-table thead th, .data-table tbody td { padding: 10px 8px; }
    .btn { font-size: 12px; padding: 8px 12px; }
    .btn-sm { padding: 5px 9px; font-size: 11px; }
    .page-content { padding: 12px; }
    .card-body { padding: 16px; }
}
