/**
 * =============================================
 * Tamweh.com — Design System
 * =============================================
 * العلامة التجارية الرسمية لمنصة تمويه
 * تمويه لحلول الأمن السيبراني المتقدمة
 * Tamweh for Advanced Cybersecurity Solutions
 * =============================================
 *
 * الشعار: "نحمي ما لا يُرى، ونستعد لما لم يحدث بعد."
 *
 * الألوان الرسمية:
 *   --brand-black   #0C0C0C  الأسود السيبراني
 *   --brand-green   #164B2C  الأخضر الداكن المموه
 *   --brand-yellow  #FFD600  الأصفر الأمني
 *   --brand-gray    #B0B0B0  الرمادي المعدني
 *   --brand-red     #D72638  الأحمر (VULCANO / تنبيهات حرجة)
 *
 * الخطوط:
 *   العربية: Cairo (Google Fonts)
 *   الإنجليزية: Inter (Google Fonts)
 * =============================================
 */

/* ============================================= */
/* Google Fonts                                   */
/* ============================================= */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&family=Readex+Pro:wght@200;300;400;500;600;700&family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ============================================= */
/* CSS Variables — Brand Tokens                   */
/* ============================================= */
:root {
    /* === Tamweh Brand Colors === */
    --brand-black: #0C0C0C;           /* الأسود السيبراني — الثقة والحماية */
    --brand-green: #164B2C;           /* الأخضر الداكن المموه — التمويه والدفاع */
    --brand-green-light: #2D8B55;
    --brand-green-glow: #34D399;
    --brand-yellow: #FFD600;          /* الأصفر الأمني — التحذير والانتباه */
    --brand-gray: #B0B0B0;           /* الرمادي المعدني — الاحتراف والتوازن */

    /* === VULCANO Sub-Brand Colors === */
    --vulcano-red: #D72638;           /* الأحمر البركاني — طاقة AI والانفجار الأمني */
    --vulcano-black: #1C1C1C;         /* الأسود المعدني — الغموض والعمق */
    --vulcano-orange: #FF6F00;        /* البرتقالي الذكي — النشاط والفحص */
    --vulcano-gray: #D8D8D8;          /* الرمادي الفاتح — الحيادية التقنية */

    /* === Combined Accent (Merged Brand) === */
    --brand-red: #D72638;             /* مشترك: تنبيهات حرجة + VULCANO */
    --brand-orange: #FF6F00;          /* مشترك: فحص وكشف + VULCANO */

    /* === UI Semantic Colors === */
    --bg-primary: #050505;
    --bg-secondary: #0C0C0C;
    --bg-card: #0F1410;
    --bg-card-hover: #131A16;
    --bg-input: #080B09;
    --bg-sidebar: #0A0E0C;

    --border-primary: #1A2E22;
    --border-secondary: #0F1F16;
    --border-active: #164B2C;

    --text-primary: #E8F0EC;
    --text-secondary: #8BA89D;
    --text-muted: #4A6B58;
    --text-heading: #F0F7F4;

    /* === Status Colors === */
    --status-success: #2D8B55;
    --status-warning: #FFD600;
    --status-danger: #D72638;
    --status-info: #3B82F6;
    --status-neutral: #6B7280;

    /* === Risk Levels === */
    --risk-critical: #DC2626;
    --risk-high: #F97316;
    --risk-medium: #EAB308;
    --risk-low: #22C55E;
    --risk-info: #3B82F6;

    /* === Compliance === */
    --compliance-full: #22C55E;
    --compliance-partial: #EAB308;
    --compliance-none: #DC2626;
    --compliance-na: #6B7280;

    /* === Typography === */
    /* Cairo → العناوين الرئيسية | Readex Pro → النصوص والمحتوى */
    --font-arabic: 'Readex Pro', 'Cairo', 'Segoe UI', Arial, sans-serif;
    --font-arabic-heading: 'Cairo', 'Readex Pro', 'Segoe UI', Arial, sans-serif;
    --font-english: 'Inter', 'Segoe UI', Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    /* === Spacing === */
    --sidebar-width: 260px;
    --header-height: 56px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* === Theme flag (dark by default) === */
    --is-dark: 1;

    /* === Transitions === */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;

    /* === Shadows === */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(22, 75, 44, 0.15);
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-arabic);
    background: var(--bg-primary);
    color: var(--text-primary);
    direction: rtl;
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Cairo for all headings */
h1, h2, h3, h4, h5, h6,
.page-title,
.card-title,
.stat-label,
.sidebar-section,
.auth-card h2,
.report-title,
.section-title {
    font-family: var(--font-arabic-heading);
}

/* English text auto-detection */
[dir="ltr"], .ltr, input[type="email"], input[type="url"], input[type="password"], .font-en {
    font-family: var(--font-english);
    direction: ltr;
}

code, pre, .font-mono {
    font-family: var(--font-mono);
    direction: ltr;
}

a {
    color: var(--brand-green-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--brand-green-glow);
}

/* ============================================= */
/* Layout: App Shell                              */
/* ============================================= */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ============================================= */
/* Sidebar                                        */
/* ============================================= */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-primary);
    text-align: center;
}

.sidebar-brand img {
    height: 36px;
    margin-bottom: 0.4rem;
    filter: brightness(2) contrast(1.4);
}

.sidebar-brand .brand-text {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.5rem;
}

.sidebar-section {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 1.25rem 1rem 0.5rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1rem;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: 1px;
}

.sidebar-nav a:hover {
    background: rgba(22, 75, 44, 0.15);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background: var(--brand-green);
    color: white;
    font-weight: 600;
}

.sidebar-nav a .nav-icon {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.8;
}

.sidebar-nav a .badge {
    margin-right: auto;
    margin-left: 0;
    font-size: 0.65rem;
    background: var(--status-danger);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-weight: 700;
}

/* Sidebar user section */
.sidebar-user {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand-green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.sidebar-user-logout {
    color: var(--status-danger) !important;
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-sm);
}

.sidebar-user-logout:hover {
    background: rgba(215, 38, 56, 0.1);
}

/* ============================================= */
/* Main Content                                   */
/* ============================================= */
.main-content {
    margin-right: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================= */
/* Top Bar / Page Header                          */
/* ============================================= */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-secondary);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-heading);
}

.page-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.page-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ============================================= */
/* Page Body                                      */
/* ============================================= */
.page-body {
    flex: 1;
    padding: 1.5rem;
}

/* ============================================= */
/* Cards                                          */
/* ============================================= */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: border-color var(--transition-fast);
}

.card:hover {
    border-color: var(--border-active);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-secondary);
}

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-heading);
}

.card-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* ============================================= */
/* Stats Grid                                     */
/* ============================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-align: center;
    transition: all var(--transition-normal);
}

.stat-card:hover {
    border-color: var(--brand-green);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--brand-green-light);
    font-family: var(--font-english);
    line-height: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    font-weight: 500;
}

.stat-card.danger .stat-value { color: var(--status-danger); }
.stat-card.warning .stat-value { color: var(--status-warning); }
.stat-card.info .stat-value { color: var(--status-info); }

/* ============================================= */
/* Buttons                                        */
/* ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-arabic);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    line-height: 1.4;
}

.btn-primary {
    background: var(--brand-green);
    color: white;
    border-color: var(--brand-green);
}

.btn-primary:hover {
    background: var(--brand-green-light);
    border-color: var(--brand-green-light);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-primary);
}

.btn-secondary:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-active);
}

.btn-danger {
    background: var(--status-danger);
    color: white;
    border-color: var(--status-danger);
}

.btn-danger:hover {
    background: #B91C2E;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
}

.btn-lg {
    padding: 0.7rem 1.5rem;
    font-size: 0.95rem;
}

.btn-block {
    width: 100%;
}

/* ============================================= */
/* Forms                                          */
/* ============================================= */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: var(--font-arabic);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-green);
    box-shadow: 0 0 0 2px rgba(22, 75, 44, 0.2);
}

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238BA89D' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.75rem center;
    padding-left: 2rem;
}

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

.form-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-error {
    font-size: 0.72rem;
    color: var(--status-danger);
    margin-top: 0.25rem;
}

/* Email/URL/Password fields */
input[type="email"].form-control,
input[type="url"].form-control,
input[type="password"].form-control {
    direction: ltr;
    text-align: left;
    font-family: var(--font-english);
}

/* ============================================= */
/* Tables                                         */
/* ============================================= */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.data-table thead th {
    padding: 0.7rem 0.85rem;
    text-align: right;
    font-weight: 700;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-primary);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border-secondary);
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table tbody tr:hover td {
    background: rgba(22, 75, 44, 0.05);
    color: var(--text-primary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================= */
/* Alerts                                         */
/* ============================================= */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(45, 139, 85, 0.1);
    border-color: rgba(45, 139, 85, 0.25);
    color: #6EE7A0;
}

.alert-danger {
    background: rgba(215, 38, 56, 0.1);
    border-color: rgba(215, 38, 56, 0.25);
    color: #FF6B7A;
}

.alert-warning {
    background: rgba(255, 214, 0, 0.08);
    border-color: rgba(255, 214, 0, 0.2);
    color: #FFE066;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.25);
    color: #93C5FD;
}

/* ============================================= */
/* Badges & Tags                                  */
/* ============================================= */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 10px;
    letter-spacing: 0.3px;
}

.badge-green { background: rgba(45,139,85,0.15); color: #6EE7A0; }
.badge-red { background: rgba(215,38,56,0.15); color: #FF6B7A; }
.badge-yellow { background: rgba(255,214,0,0.12); color: #FFE066; }
.badge-blue { background: rgba(59,130,246,0.15); color: #93C5FD; }
.badge-gray { background: rgba(107,114,128,0.15); color: #9CA3AF; }

/* Status indicator dot */
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 0.35rem;
}

.status-dot.active { background: var(--status-success); }
.status-dot.inactive { background: var(--status-neutral); }
.status-dot.warning { background: var(--status-warning); }
.status-dot.danger { background: var(--status-danger); }

/* ============================================= */
/* Risk Heatmap Colors                            */
/* ============================================= */
.risk-critical { color: var(--risk-critical); }
.risk-high { color: var(--risk-high); }
.risk-medium { color: var(--risk-medium); }
.risk-low { color: var(--risk-low); }
.risk-info { color: var(--risk-info); }

.risk-bg-critical { background: rgba(220,38,38,0.12); }
.risk-bg-high { background: rgba(249,115,22,0.12); }
.risk-bg-medium { background: rgba(234,179,8,0.10); }
.risk-bg-low { background: rgba(34,197,94,0.10); }

/* ============================================= */
/* Empty State                                    */
/* ============================================= */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.4;
}

.empty-state-text {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ============================================= */
/* Responsive                                     */
/* ============================================= */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
        transition: transform var(--transition-normal);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-right: 0;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================= */
/* Scrollbar                                      */
/* ============================================= */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--brand-green);
}

/* ============================================= */
/* Auth Pages                                     */
/* ============================================= */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 1.5rem;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo img {
    height: 32px;
    margin-bottom: 0.5rem;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    padding: 2rem;
}

.auth-card h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-heading);
}

.auth-footer {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ============================================= */
/* Utilities                                      */
/* ============================================= */
.text-success { color: var(--status-success); }
.text-danger { color: var(--status-danger); }
.text-warning { color: var(--status-warning); }
.text-info { color: var(--status-info); }
.text-muted { color: var(--text-muted); }
.text-heading { color: var(--text-heading); }
.text-green { color: var(--brand-green-light); }

.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }

.fs-xs { font-size: 0.7rem; }
.fs-sm { font-size: 0.8rem; }
.fs-md { font-size: 0.9rem; }
.fs-lg { font-size: 1.1rem; }
.fs-xl { font-size: 1.3rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

.rounded { border-radius: var(--radius-md); }
.overflow-auto { overflow: auto; }
.nowrap { white-space: nowrap; }

/* ============================================= */
/* VULCANO Theme Override                         */
/* Use .vulcano-theme on body or container        */
/* ============================================= */
.vulcano-theme {
    --brand-green: #D72638;
    --brand-green-light: #FF4757;
    --brand-green-glow: #FF6B7A;
    --bg-card: #121212;
    --bg-sidebar: #0E0E0E;
    --border-primary: #2A1A1E;
    --border-active: #D72638;
}

.vulcano-theme .sidebar-nav a.active {
    background: var(--vulcano-red);
}

.vulcano-theme .btn-primary {
    background: var(--vulcano-red);
    border-color: var(--vulcano-red);
}

.vulcano-theme .btn-primary:hover {
    background: #B91C2E;
}

.vulcano-theme .stat-card:hover {
    border-color: var(--vulcano-red);
    box-shadow: 0 0 20px rgba(215, 38, 56, 0.15);
}

.vulcano-theme .stat-value {
    color: var(--vulcano-red);
}

/* VULCANO scan animation */
.vulcano-scan-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--vulcano-red);
    animation: vulcano-pulse 1.5s ease-in-out infinite;
}

@keyframes vulcano-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

/* VULCANO severity colors */
.severity-critical { color: var(--vulcano-red); }
.severity-high { color: var(--vulcano-orange); }
.severity-medium { color: var(--brand-yellow); }
.severity-low { color: var(--brand-green-light); }
.severity-info { color: var(--status-info); }

.badge-vulcano { background: rgba(215,38,56,0.15); color: #FF6B7A; }
.badge-orange { background: rgba(255,111,0,0.15); color: #FFB366; }

/* ============================================= */
/* LIGHT THEME                                    */
/* ============================================= */
/* Apply via: <html data-theme="light">           */
/* Or body class: <body class="light-theme">      */
/* ============================================= */
[data-theme="light"],
.light-theme {
    --is-dark: 0;

    /* Backgrounds */
    --bg-primary: #F5F7F6;
    --bg-secondary: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F0F7F4;
    --bg-input: #F5F7F6;
    --bg-sidebar: #FFFFFF;

    /* Borders */
    --border-primary: #D4E2DA;
    --border-secondary: #E8F0EC;
    --border-active: #164B2C;

    /* Text */
    --text-primary: #1A2B22;
    --text-secondary: #4A6B58;
    --text-muted: #8BA89D;
    --text-heading: #0C1A12;

    /* Status (slightly darker for contrast on light bg) */
    --status-success: #1A7A3E;
    --status-warning: #B8960A;
    --status-danger: #C02030;
    --status-info: #2563EB;

    /* Shadows (lighter) */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 20px rgba(22, 75, 44, 0.08);
}

/* Light theme adjustments for specific elements */
[data-theme="light"] .sidebar,
.light-theme .sidebar {
    border-left-color: var(--border-primary);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .sidebar-nav a:hover,
.light-theme .sidebar-nav a:hover {
    background: rgba(22, 75, 44, 0.06);
}

[data-theme="light"] .card,
.light-theme .card {
    box-shadow: var(--shadow-sm);
}

[data-theme="light"] .card:hover,
.light-theme .card:hover {
    box-shadow: var(--shadow-md);
}

[data-theme="light"] .stat-card:hover,
.light-theme .stat-card:hover {
    box-shadow: var(--shadow-md);
}

[data-theme="light"] .data-table tbody tr:hover td,
.light-theme .data-table tbody tr:hover td {
    background: rgba(22, 75, 44, 0.03);
}

[data-theme="light"] .alert-success,
.light-theme .alert-success {
    background: rgba(26, 122, 62, 0.08);
    border-color: rgba(26, 122, 62, 0.2);
    color: #15803D;
}

[data-theme="light"] .alert-danger,
.light-theme .alert-danger {
    background: rgba(192, 32, 48, 0.06);
    border-color: rgba(192, 32, 48, 0.15);
    color: #B91C2E;
}

[data-theme="light"] .alert-warning,
.light-theme .alert-warning {
    background: rgba(184, 150, 10, 0.06);
    border-color: rgba(184, 150, 10, 0.15);
    color: #92750A;
}

[data-theme="light"] .alert-info,
.light-theme .alert-info {
    background: rgba(37, 99, 235, 0.06);
    border-color: rgba(37, 99, 235, 0.15);
    color: #1D4ED8;
}

[data-theme="light"] .badge-green { background: rgba(26,122,62,0.1); color: #15803D; }
[data-theme="light"] .badge-red { background: rgba(192,32,48,0.08); color: #B91C2E; }
[data-theme="light"] .badge-yellow { background: rgba(184,150,10,0.08); color: #92750A; }
[data-theme="light"] .badge-blue { background: rgba(37,99,235,0.08); color: #1D4ED8; }
[data-theme="light"] .badge-gray { background: rgba(107,114,128,0.08); color: #4B5563; }

/* Light theme form controls */
[data-theme="light"] .form-control,
.light-theme .form-control {
    background: var(--bg-input);
    border-color: var(--border-primary);
}

[data-theme="light"] .form-control:focus,
.light-theme .form-control:focus {
    box-shadow: 0 0 0 3px rgba(22, 75, 44, 0.12);
}

/* Light theme scrollbar */
[data-theme="light"]::-webkit-scrollbar-track { background: #F5F7F6; }
[data-theme="light"]::-webkit-scrollbar-thumb { background: #D4E2DA; }

/* Light theme auth page */
[data-theme="light"] .auth-page,
.light-theme .auth-page {
    background: var(--bg-primary);
}

[data-theme="light"] .auth-card,
.light-theme .auth-card {
    box-shadow: var(--shadow-md);
}

/* ============================================= */
/* Theme Toggle Button                            */
/* ============================================= */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.theme-toggle:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-active);
}

/* ============================================= */
/* Improved Top Header Bar                        */
/* ============================================= */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border-secondary);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: var(--header-height);
    gap: 1rem;
}

.page-header .page-breadcrumb {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.1rem;
}

.page-header .page-breadcrumb a {
    color: var(--text-muted);
}

.page-header .page-breadcrumb a:hover {
    color: var(--brand-green-light);
}

.page-header .page-breadcrumb .sep {
    margin: 0 0.35rem;
    opacity: 0.5;
}

/* ============================================= */
/* Sidebar — Improved                             */
/* ============================================= */
.sidebar-search {
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.25rem;
}

.sidebar-search input {
    width: 100%;
    padding: 0.45rem 0.7rem;
    background: var(--bg-input);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.78rem;
    font-family: var(--font-arabic);
}

.sidebar-search input:focus {
    outline: none;
    border-color: var(--brand-green);
}

.sidebar-search input::placeholder {
    color: var(--text-muted);
}

/* Sidebar collapse toggle for mobile */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 200;
    background: var(--brand-green);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.5rem 0.7rem;
    cursor: pointer;
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: block;
    }
}
