/* ============================================================================
   ACCOUNTING MANAGEMENT SYSTEM - 3D Modern Design System
   Developer: Prince Mizan | Mobile: 0544366014
   Version: 2.0 — Glassmorphism + 3D + Neumorphism
   ============================================================================ */

/* ---------- FONTS — Arabic-first with proper fallback ---------- */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&family=Tajawal:wght@300;400;500;700;800;900&family=Inter:wght@300;400;500;600;700;800;900&family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Arabic Font Stack (applied via :lang(ar) and [dir="rtl"]) */
:lang(ar), [dir="rtl"] {
    font-family: 'Cairo', 'Tajawal', 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif !important;
}

/* Latin Font Stack */
:lang(en), [dir="ltr"] {
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---------- DESIGN TOKENS ---------- */
:root {
    /* Layout */
    --sidebar-width: 270px;
    --sidebar-collapsed: 80px;
    --topbar-height: 70px;
    --footer-height: 44px;
    --content-max-width: 1700px;
    --radius: 12px;
    --radius-lg: 20px;
    --radius-sm: 8px;
    --radius-xl: 28px;

    /* Default theme - Blue Ocean */
    --primary: #1e3c72;
    --primary-dark: #0f1f48;
    --primary-light: #2a5298;
    --primary-color: #1e3c72;
    --accent: #2a5298;
    --accent-light: #3a62a8;
    --sidebar-bg: linear-gradient(180deg, #0f1f48 0%, #1e3c72 100%);
    --sidebar-text: #c8d3e8;
    --sidebar-active: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
    --sidebar-hover: rgba(255,255,255,0.08);
    --topbar-bg: rgba(255,255,255,0.85);
    --topbar-text: #2c3e50;
    --content-bg: #eef2f9;
    --card-bg: rgba(255,255,255,0.95);
    --text-primary: #1a2332;
    --text-secondary: #5a6c80;
    --text-muted: #95a5b8;

    /* Status colors */
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #e74c3c;
    --info: #0984e3;
    --purple: #6c5ce7;
    --orange: #e17055;
    --teal: #00cec9;
    --rose: #fd79a8;

    /* 3D Shadow System */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 12px 28px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
    --shadow-xl: 0 24px 48px rgba(0,0,0,0.18), 0 8px 16px rgba(0,0,0,0.08);
    --shadow-2xl: 0 32px 64px rgba(0,0,0,0.22), 0 12px 24px rgba(0,0,0,0.10);
    --shadow-3d: 0 10px 20px rgba(0,0,0,0.15), 0 6px 8px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-3d-hover: 0 16px 32px rgba(0,0,0,0.20), 0 10px 16px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.08);
    --shadow-primary: 0 8px 24px rgba(30,60,114,0.35);
    --shadow-success: 0 8px 24px rgba(0,184,148,0.30);
    --shadow-danger: 0 8px 24px rgba(231,76,60,0.30);
    --shadow-glow: 0 0 32px rgba(42,82,152,0.45);

    /* Glass effect */
    --glass-bg: rgba(255,255,255,0.65);
    --glass-border: rgba(255,255,255,0.40);
    --glass-blur: 16px;

    /* Borders */
    --border-color: rgba(0,0,0,0.06);
    --border-light: rgba(255,255,255,0.15);

    /* Transitions */
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- BODY ---------- */
body {
    background: var(--content-bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(at 20% 0%, rgba(42,82,152,0.08) 0px, transparent 50%),
        radial-gradient(at 80% 100%, rgba(108,92,231,0.06) 0px, transparent 50%);
    background-attachment: fixed;
}

/* ---------- APP LAYOUT ---------- */
.app-wrapper { display: flex; min-height: 100vh; position: relative; }

/* ---------- SIDEBAR with 3D depth ---------- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: var(--shadow-2xl);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255,255,255,0.05);
}

[dir="rtl"] .sidebar { left: auto; right: 0; border-right: none; border-left: 1px solid rgba(255,255,255,0.05); }

.sidebar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 200px;
    background: radial-gradient(ellipse at top, rgba(255,255,255,0.12) 0%, transparent 70%);
    pointer-events: none;
}

.sidebar-header {
    padding: 22px 22px;
    background: rgba(0,0,0,0.20);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: relative;
    z-index: 1;
}

.logo { display: flex; align-items: center; gap: 14px; }
.logo-icon {
    font-size: 36px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, rgba(255,255,255,0.20) 0%, rgba(255,255,255,0.05) 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.20);
    border: 1px solid rgba(255,255,255,0.10);
    transition: var(--transition-bounce);
}
.logo-icon:hover { transform: rotate(-8deg) scale(1.05); }
.logo-text h3 {
    font-size: 16px;
    color: #fff;
    margin: 0;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.3px;
}
.logo-text small { font-size: 11px; opacity: 0.6; letter-spacing: 0.5px; }

.sidebar-toggle {
    display: none;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.10);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    transition: var(--transition);
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.20); transform: rotate(90deg); }

.project-selector { padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,0.06); position: relative; z-index: 1; }
.project-select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255,255,255,0.08);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.10);
}
.project-select:hover { background: rgba(255,255,255,0.12); }
.project-select option { background: #0f1f48; color: #fff; padding: 8px; }

/* ---------- SIDEBAR NAVIGATION with 3D effects ---------- */
.sidebar-nav { flex: 1; padding: 14px 0; overflow-y: auto; position: relative; z-index: 1; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }
.sidebar-nav ul { list-style: none; }
.sidebar-nav li { margin: 2px 10px; }

.sidebar-nav li > a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
}

.sidebar-nav li > a::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.10), transparent);
    transition: left 0.5s;
}

.sidebar-nav li > a:hover {
    background: var(--sidebar-hover);
    color: #fff;
    transform: translateX(4px);
    border-color: rgba(255,255,255,0.08);
}
[dir="rtl"] .sidebar-nav li > a:hover { transform: translateX(-4px); }

.sidebar-nav li > a:hover::before { left: 100%; }

.sidebar-nav li.active > a {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.30), inset 0 1px 0 rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.15);
    transform: translateX(2px);
}
[dir="rtl"] .sidebar-nav li.active > a { transform: translateX(-2px); }

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.nav-text { flex: 1; white-space: nowrap; }

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

.sidebar-footer {
    padding: 16px 18px;
    background: rgba(0,0,0,0.25);
    border-top: 1px solid rgba(255,255,255,0.06);
    position: relative;
    z-index: 1;
}
.developer-info {
    text-align: center;
    font-size: 11px;
    opacity: 0.85;
    line-height: 1.6;
}
.developer-info strong {
    display: block;
    color: #fff;
    font-size: 13px;
    margin: 4px 0 2px;
    font-weight: 700;
}
.developer-info small { display: block; opacity: 0.7; }

/* ---------- MAIN CONTENT ---------- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
[dir="rtl"] .main-content { margin-left: 0; margin-right: var(--sidebar-width); }

/* ---------- TOPBAR with glassmorphism ---------- */
.topbar {
    height: var(--topbar-height);
    background: var(--topbar-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    color: var(--topbar-text);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 26px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.menu-toggle {
    display: none;
    background: linear-gradient(135deg, rgba(255,255,255,0.10) 0%, rgba(0,0,0,0.05) 100%);
    border: 1px solid var(--border-color);
    font-size: 22px;
    cursor: pointer;
    color: var(--text-primary);
    width: 42px; height: 42px;
    border-radius: 12px;
    transition: var(--transition-bounce);
}
.menu-toggle:hover { transform: scale(1.05) rotate(5deg); background: var(--primary); color: #fff; }

.page-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.branch-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(255,255,255,0.7);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}
.branch-select:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(30,60,114,0.10); }

/* ---------- DROPDOWN ---------- */
.dropdown { position: relative; display: inline-block; }
.icon-btn {
    background: linear-gradient(135deg, rgba(255,255,255,0.10) 0%, rgba(0,0,0,0.02) 100%);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 9px 12px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    position: relative;
    transition: var(--transition-bounce);
    backdrop-filter: blur(8px);
}
.icon-btn:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}
.badge-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
    border-radius: 10px;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(231,76,60,0.5);
    border: 2px solid #fff;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    min-width: 240px;
    z-index: 1000;
    padding: 8px;
    animation: dropdownIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
[dir="rtl"] .dropdown-menu { right: auto; left: 0; }
.dropdown-menu.show { display: block; }

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
}
.dropdown-menu a:hover { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); color: #fff; transform: translateX(3px); }
[dir="rtl"] .dropdown-menu a:hover { transform: translateX(-3px); }

.dropdown-header { padding: 12px 14px; font-weight: 700; color: var(--text-primary); border-bottom: 1px solid var(--border-color); margin-bottom: 6px; }
.dropdown-divider { height: 1px; background: var(--border-color); margin: 6px 0; }
.notif-menu { min-width: 340px; max-height: 420px; overflow-y: auto; }
.notif-item { padding: 12px 14px; border-bottom: 1px solid var(--border-color); display: block; border-radius: 10px; margin-bottom: 4px; transition: var(--transition); }
.notif-item.unread { background: linear-gradient(135deg, rgba(42,82,152,0.08) 0%, rgba(108,92,231,0.05) 100%); }
.notif-item:hover { background: rgba(0,0,0,0.04); }
.notif-item strong { display: block; font-size: 13px; margin-bottom: 2px; }
.notif-item small { color: var(--text-secondary); font-size: 12px; }

.user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(255,255,255,0.10) 0%, rgba(0,0,0,0.02) 100%);
    border: 1px solid var(--border-color);
    padding: 6px 14px 6px 6px;
    border-radius: 30px;
    cursor: pointer;
    color: var(--text-primary);
    transition: var(--transition-bounce);
    font-weight: 600;
}
.user-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(30,60,114,0.4), inset 0 1px 0 rgba(255,255,255,0.20);
}
.user-name { font-size: 13px; font-weight: 600; }

.user-menu { min-width: 260px; }
.user-info { padding: 12px 14px; border-bottom: 1px solid var(--border-color); margin-bottom: 6px; }
.user-info .user-name { font-weight: 700; font-size: 14px; }
.user-info .user-role { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.logout-link { color: var(--danger) !important; }
.logout-link:hover { background: linear-gradient(135deg, var(--danger) 0%, #c0392b 100%) !important; }

/* ---------- THEME SWITCHER ---------- */
.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 12px; }
.theme-swatch {
    width: 100%;
    aspect-ratio: 1;
    border: 3px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-bounce);
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15), inset 0 2px 4px rgba(255,255,255,0.3);
}
.theme-swatch:hover { transform: scale(1.15) rotate(8deg); box-shadow: 0 8px 20px rgba(0,0,0,0.25); }
.theme-swatch.theme-blue { background: linear-gradient(135deg, #1e3c72, #2a5298); }
.theme-swatch.theme-green { background: linear-gradient(135deg, #0f5132, #00b894); }
.theme-swatch.theme-purple { background: linear-gradient(135deg, #4b0082, #6c5ce7); }
.theme-swatch.theme-orange { background: linear-gradient(135deg, #cc5500, #e17055); }
.theme-swatch.theme-red { background: linear-gradient(135deg, #8b0000, #e74c3c); }
.theme-swatch.theme-teal { background: linear-gradient(135deg, #00695c, #00cec9); }
.theme-swatch.theme-rose { background: linear-gradient(135deg, #be123c, #fd79a8); }
.theme-swatch.theme-dark { background: linear-gradient(135deg, #1a1a2e, #16213e); }

/* ---------- CONTENT AREA ---------- */
.content-area {
    flex: 1;
    padding: 26px;
    max-width: var(--content-max-width);
    margin: 0 auto;
    width: 100%;
}

/* ---------- 3D CARD SYSTEM ---------- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 22px;
    margin-bottom: 22px;
    border: 1px solid var(--border-color);
    position: relative;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
    pointer-events: none;
}

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}
.card-header h3, .card-header h2 {
    font-size: 17px;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.3px;
}
.card-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- 3D STAT CARDS ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(245,247,252,0.95) 100%);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-3d);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    transition: var(--transition-bounce);
    backdrop-filter: blur(10px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--primary);
    box-shadow: 0 0 16px var(--primary);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(30,60,114,0.06) 0%, transparent 70%);
    pointer-events: none;
}

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

.stat-card.success::before { background: var(--success); box-shadow: 0 0 16px var(--success); }
.stat-card.success::after { background: radial-gradient(circle, rgba(0,184,148,0.10) 0%, transparent 70%); }
.stat-card.warning::before { background: var(--warning); box-shadow: 0 0 16px var(--warning); }
.stat-card.warning::after { background: radial-gradient(circle, rgba(253,203,110,0.10) 0%, transparent 70%); }
.stat-card.danger::before { background: var(--danger); box-shadow: 0 0 16px var(--danger); }
.stat-card.danger::after { background: radial-gradient(circle, rgba(231,76,60,0.10) 0%, transparent 70%); }
.stat-card.info::before { background: var(--info); box-shadow: 0 0 16px var(--info); }
.stat-card.info::after { background: radial-gradient(circle, rgba(9,132,227,0.10) 0%, transparent 70%); }
.stat-card.purple::before { background: var(--purple); box-shadow: 0 0 16px var(--purple); }
.stat-card.purple::after { background: radial-gradient(circle, rgba(108,92,231,0.10) 0%, transparent 70%); }

.stat-card .stat-icon {
    position: absolute;
    top: 18px;
    right: 18px;
    font-size: 38px;
    opacity: 0.20;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
    transition: var(--transition);
}
.stat-card:hover .stat-icon { transform: scale(1.15) rotate(-8deg); opacity: 0.30; }

[dir="rtl"] .stat-card .stat-icon { right: auto; left: 18px; }
[dir="rtl"] .stat-card::before { left: auto; right: 0; }

.stat-card .stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    font-weight: 700;
}
.stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 8px;
    letter-spacing: -0.8px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-card .stat-change {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    color: var(--text-secondary);
}
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ---------- 3D BUTTONS ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition-bounce);
    font-family: inherit;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(30,60,114,0.30), inset 0 1px 0 rgba(255,255,255,0.20);
    border: 1px solid rgba(255,255,255,0.10);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.30), transparent);
    transition: left 0.5s;
}

.btn:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30,60,114,0.40), inset 0 1px 0 rgba(255,255,255,0.25);
}
.btn:hover::before { left: 100%; }
.btn:active { transform: translateY(0); }

.btn-secondary { background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%); box-shadow: 0 4px 12px rgba(108,117,125,0.30); }
.btn-success { background: linear-gradient(135deg, var(--success) 0%, #00a081 100%); box-shadow: var(--shadow-success); }
.btn-danger { background: linear-gradient(135deg, var(--danger) 0%, #c0392b 100%); box-shadow: var(--shadow-danger); }
.btn-warning { background: linear-gradient(135deg, var(--warning) 0%, #f39c12 100%); color: #1a2332; box-shadow: 0 4px 12px rgba(253,203,110,0.40); }
.btn-info { background: linear-gradient(135deg, var(--info) 0%, #0768b3 100%); }
.btn-outline {
    background: rgba(255,255,255,0.7);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-xs);
}
.btn-outline:hover { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: var(--shadow-primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-icon { padding: 8px 12px; }

/* ---------- FORMS ---------- */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
    letter-spacing: 0.2px;
}
.form-group label .req { color: var(--danger); }

.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: rgba(255,255,255,0.9);
    color: var(--text-primary);
    transition: var(--transition);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.03);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(30,60,114,0.12), inset 0 2px 4px rgba(0,0,0,0.03);
    background: #fff;
}

textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border-color); }
.form-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ---------- TABLES ---------- */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
table.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 13px;
}
table.data-table thead { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); }
table.data-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: #fff;
    border-bottom: none;
    white-space: nowrap;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
[dir="rtl"] table.data-table th { text-align: right; }
table.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}
table.data-table tbody tr {
    transition: var(--transition-fast);
    background: #fff;
}
table.data-table tbody tr:hover { background: linear-gradient(90deg, rgba(30,60,114,0.04) 0%, rgba(108,92,231,0.02) 100%); }
table.data-table tbody tr:last-child td { border-bottom: none; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.font-bold { font-weight: 700; }
.font-mono { font-family: 'JetBrains Mono', 'Courier New', monospace; }

/* ---------- BADGES (3D) ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 11px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.10), inset 0 1px 0 rgba(255,255,255,0.30);
}
.badge-blue { background: linear-gradient(135deg, #0984e3 0%, #0768b3 100%); color: #fff; }
.badge-green { background: linear-gradient(135deg, #00b894 0%, #00a081 100%); color: #fff; }
.badge-amber { background: linear-gradient(135deg, #fdcb6e 0%, #f39c12 100%); color: #1a2332; }
.badge-red { background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%); color: #fff; }
.badge-gray { background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%); color: #fff; }
.badge-purple { background: linear-gradient(135deg, #6c5ce7 0%, #5849d4 100%); color: #fff; }

/* ---------- ALERTS ---------- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
    box-shadow: var(--shadow-sm);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success { background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%); color: #155724; border-color: #b8dfc2; }
.alert-danger { background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%); color: #721c24; border-color: #f1b0b7; }
.alert-warning { background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%); color: #856404; border-color: #ffe9a0; }
.alert-info { background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%); color: #0c5460; border-color: #abdde5; }
.alert-close { background: transparent; border: none; font-size: 20px; cursor: pointer; color: inherit; opacity: 0.7; }
.alert-close:hover { opacity: 1; }

/* ---------- EMPTY STATE ---------- */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}
.empty-state .empty-icon {
    font-size: 56px;
    margin-bottom: 14px;
    opacity: 0.5;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.10));
}
.empty-state h4 { color: var(--text-secondary); margin-bottom: 6px; font-size: 16px; }

/* ---------- GRID ---------- */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
@media (max-width: 992px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- CHARTS ---------- */
.chart-container { position: relative; height: 320px; width: 100%; }
.chart-container-sm { height: 240px; }
.chart-container-lg { height: 420px; }

/* ---------- PAGE HEADER ---------- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 14px;
}
.page-header h2 {
    font-size: 26px;
    color: var(--text-primary);
    font-weight: 800;
    letter-spacing: -0.8px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.page-header .breadcrumb { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ---------- FILTER BAR ---------- */
.filter-bar {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    margin-bottom: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    box-shadow: var(--shadow-sm);
}
.filter-bar .form-control { width: auto; min-width: 160px; padding: 7px 11px; font-size: 13px; }
.filter-bar label { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-right: -4px; }

/* ---------- TABS ---------- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 22px;
    overflow-x: auto;
    gap: 4px;
}
.tab {
    padding: 12px 22px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
}
.tab:hover { color: var(--primary); transform: translateY(-1px); }
.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 700;
    background: linear-gradient(180deg, transparent 0%, rgba(30,60,114,0.08) 100%);
}

/* ---------- MODAL ---------- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15,31,72,0.60);
    backdrop-filter: blur(8px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal-overlay.show { display: flex; animation: fadeIn 0.2s; }
.modal {
    background: #fff;
    border-radius: var(--radius-xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-2xl);
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.90) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(30,60,114,0.04) 0%, transparent 100%);
}
.modal-header h3 { font-size: 20px; color: var(--text-primary); font-weight: 700; }
.modal-close { background: rgba(0,0,0,0.05); border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); width: 36px; height: 36px; border-radius: 10px; transition: var(--transition); }
.modal-close:hover { background: var(--danger); color: #fff; transform: rotate(90deg); }
.modal-body { padding: 24px; }
.modal-footer { padding: 18px 24px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- INVOICE PREVIEW ---------- */
.invoice-preview {
    background: #fff;
    padding: 36px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}
.invoice-header { display: flex; justify-content: space-between; margin-bottom: 28px; }
.invoice-meta { text-align: right; }
[dir="rtl"] .invoice-meta { text-align: left; }
.invoice-table { width: 100%; border-collapse: collapse; margin: 18px 0; }
.invoice-table th { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); padding: 12px; text-align: left; font-size: 12px; color: #fff; }
.invoice-table td { padding: 12px; border-bottom: 1px solid var(--border-color); }
.invoice-totals { width: 320px; margin-left: auto; }
[dir="rtl"] .invoice-totals { margin-left: 0; margin-right: auto; }
.invoice-totals .total-row { display: flex; justify-content: space-between; padding: 8px 0; }
.invoice-totals .grand-total { font-size: 20px; font-weight: 800; border-top: 3px solid var(--primary); margin-top: 10px; padding-top: 12px; background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.qr-section { text-align: center; margin-top: 28px; padding-top: 22px; border-top: 2px dashed var(--border-color); }

/* ---------- PRINT ---------- */
@media print {
    .sidebar, .topbar, .app-footer, .no-print, .filter-bar, .tabs, .page-header .card-actions, .form-actions { display: none !important; }
    .main-content { margin: 0; padding: 0; }
    .content-area { padding: 0; }
    body { background: #fff; }
    .card { box-shadow: none; border: none; }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-2xl); }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    .sidebar.show { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    .menu-toggle { display: flex; align-items: center; justify-content: center; }
    .main-content { margin-left: 0 !important; margin-right: 0 !important; }
    .content-area { padding: 18px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .page-title { font-size: 18px; }
}

@media (max-width: 576px) {
    .stats-grid { grid-template-columns: 1fr; }
    .topbar { padding: 0 14px; }
    .page-title { font-size: 16px; }
    .user-name { display: none; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .card { padding: 18px; }
    .stat-card .stat-value { font-size: 22px; }
}

/* ---------- ANIMATIONS ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.animate-fadeIn { animation: fadeIn 0.3s ease; }
.animate-scaleIn { animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.animate-pulse { animation: pulse 2s infinite; }

/* ---------- LOADER ---------- */
.loader {
    border: 3px solid rgba(255,255,255,0.20);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    animation: spin 1s linear infinite;
    margin: 24px auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ---------- PROGRESS ---------- */
.progress { height: 10px; background: rgba(0,0,0,0.06); border-radius: 5px; overflow: hidden; box-shadow: inset 0 2px 4px rgba(0,0,0,0.06); }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%); transition: width 0.4s; box-shadow: 0 2px 8px rgba(30,60,114,0.40); border-radius: 5px; }

/* ---------- LIST GROUP ---------- */
.list-group { list-style: none; padding: 0; }
.list-group-item {
    padding: 14px 18px;
    border: 1px solid var(--border-color);
    border-bottom: none;
    transition: var(--transition);
    background: #fff;
}
.list-group-item:hover { background: linear-gradient(90deg, rgba(30,60,114,0.04) 0%, transparent 100%); transform: translateX(4px); }
[dir="rtl"] .list-group-item:hover { transform: translateX(-4px); }
.list-group-item:last-child { border-bottom: 1px solid var(--border-color); }
.list-group-item:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.list-group-item:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.list-group-item a { text-decoration: none; color: inherit; display: block; }

/* ---------- FOOTER ---------- */
.app-footer {
    height: var(--footer-height);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 26px;
    font-size: 12px;
    color: var(--text-secondary);
}
.footer-right strong { color: var(--primary); }

/* ---------- 3D Floating Action Button ---------- */
.fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(30,60,114,0.40), inset 0 2px 4px rgba(255,255,255,0.25);
    z-index: 99;
    transition: var(--transition-bounce);
    display: flex;
    align-items: center;
    justify-content: center;
}
.fab:hover { transform: scale(1.10) rotate(90deg); box-shadow: 0 16px 32px rgba(30,60,114,0.50); }
[dir="rtl"] .fab { right: auto; left: 30px; }

/* ---------- Glass Card Variant ---------- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 22px;
}

/* ---------- Number Display (LTR even in RTL) ---------- */
[dir="rtl"] .font-mono,
[dir="rtl"] .stat-value,
[dir="rtl"] td.text-right {
    direction: ltr;
    unicode-bidi: embed;
}

[dir="rtl"] .text-right { text-align: left; }

/* ---------- Scrollbar styling ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.04); }
::-webkit-scrollbar-thumb { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

/* ---------- Selection ---------- */
::selection { background: var(--primary); color: #fff; }
