@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800&display=swap');

:root, [data-theme="dark"] {
    --font-primary: 'Cairo', sans-serif;
    
    --primary-hsl: 198, 93%, 60%; /* #38bdf8 */
    --primary: hsl(var(--primary-hsl));
    --primary-hover: hsl(200, 95%, 39%);
    --primary-light: rgba(56, 189, 248, 0.12);
    --primary-glow: hsla(var(--primary-hsl), 0.3);
    
    --secondary-hsl: 235, 90%, 74%; /* #818cf8 */
    --secondary: hsl(var(--secondary-hsl));

    --bg-app: #080f1d;
    --bg-surface: #0d1627;
    --bg-sidebar: #0d1627;
    --bg-header: rgba(13, 22, 39, 0.85);
    
    --border-color: #1e293b;
    --border-glow: hsla(198, 93%, 60%, 0.15);
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-on-primary: #000000;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.35);
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"][data-theme-profile="olive-gold"] {
    --primary-hsl: 45, 73%, 61%;
    --primary: hsl(var(--primary-hsl));
    --primary-hover: #f7d774;
    --primary-light: rgba(212, 175, 55, 0.13);
    --primary-glow: rgba(212, 175, 55, 0.26);

    --secondary-hsl: 151, 58%, 31%;
    --secondary: hsl(var(--secondary-hsl));

    --bg-app: #06140d;
    --bg-surface: #0b1f14;
    --bg-sidebar: #06120c;
    --bg-header: rgba(8, 28, 17, 0.88);

    --border-color: #21432d;
    --border-glow: rgba(212, 175, 55, 0.22);

    --text-primary: #fff8dc;
    --text-secondary: #d8e2c6;
    --text-muted: #a9b69d;
    --text-on-primary: #102015;
}

[data-theme="dark"][data-theme-profile="burgundy-gold"] {
    --primary-hsl: 38, 83%, 69%;
    --primary: hsl(var(--primary-hsl));
    --primary-hover: #ffd68a;
    --primary-light: rgba(242, 196, 109, 0.14);
    --primary-glow: rgba(242, 196, 109, 0.28);

    --secondary-hsl: 350, 64%, 36%;
    --secondary: hsl(var(--secondary-hsl));

    --bg-app: #160711;
    --bg-surface: #24101a;
    --bg-sidebar: #1b0912;
    --bg-header: rgba(36, 16, 26, 0.9);

    --border-color: #4b1f2f;
    --border-glow: rgba(242, 196, 109, 0.24);

    --text-primary: #fff3df;
    --text-secondary: #ecd0c4;
    --text-muted: #bd9388;
    --text-on-primary: #251108;
}

[data-theme="dark"][data-theme-profile="olive-gold"] .btn-primary,
[data-theme="dark"][data-theme-profile="olive-gold"] .btn-beauty-gradient,
[data-theme="dark"][data-theme-profile="olive-gold"] .menu-item.active a {
    background: linear-gradient(135deg, #0f5132 0%, #d4af37 58%, #f7d774 100%) !important;
    color: #102015 !important;
    box-shadow: 0 8px 24px rgba(212, 175, 55, 0.24) !important;
}

[data-theme="dark"][data-theme-profile="burgundy-gold"] .btn-primary,
[data-theme="dark"][data-theme-profile="burgundy-gold"] .btn-beauty-gradient,
[data-theme="dark"][data-theme-profile="burgundy-gold"] .menu-item.active a {
    background: linear-gradient(135deg, #7f1d1d 0%, #f2c46d 62%, #ffd68a 100%) !important;
    color: #251108 !important;
    box-shadow: 0 8px 24px rgba(242, 196, 109, 0.25) !important;
}

[data-theme="dark"][data-theme-profile="olive-gold"] .sidebar-sub-item.active a,
[data-theme="dark"][data-theme-profile="olive-gold"] .sidebar-sub-item a:hover,
[data-theme="dark"][data-theme-profile="olive-gold"] .sidebar-group-btn:hover,
[data-theme="dark"][data-theme-profile="olive-gold"] .sidebar-group-btn.active-group {
    color: #d4af37 !important;
    background: rgba(212, 175, 55, 0.1) !important;
}

[data-theme="dark"][data-theme-profile="burgundy-gold"] .sidebar-sub-item.active a,
[data-theme="dark"][data-theme-profile="burgundy-gold"] .sidebar-sub-item a:hover,
[data-theme="dark"][data-theme-profile="burgundy-gold"] .sidebar-group-btn:hover,
[data-theme="dark"][data-theme-profile="burgundy-gold"] .sidebar-group-btn.active-group {
    color: #f2c46d !important;
    background: rgba(242, 196, 109, 0.11) !important;
}

[data-theme="dark"][data-theme-profile="olive-gold"] .premium-card::before {
    background: linear-gradient(90deg, #0f5132, #d4af37);
}

[data-theme="dark"][data-theme-profile="burgundy-gold"] .premium-card::before {
    background: linear-gradient(90deg, #7f1d1d, #f2c46d);
}

/* Light Mode Tokens Override */
[data-theme="light"] {
    --primary-hsl: 200, 95%, 39%; /* #0284c7 */
    --primary: hsl(var(--primary-hsl));
    --primary-hover: hsl(200, 95%, 32%);
    --primary-light: rgba(2, 132, 199, 0.1);
    --primary-glow: hsla(var(--primary-hsl), 0.2);
    
    --secondary-hsl: 243, 75%, 59%; /* #4f46e5 */
    --secondary: hsl(var(--secondary-hsl));
    
    --bg-app: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.9);
    
    --border-color: #cbd5e1;
    --border-glow: hsla(var(--primary-hsl), 0.1);
    
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-on-primary: #ffffff;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 30px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-primary);
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    direction: rtl;
    line-height: 1.6;
    overflow-x: hidden;
    transition: var(--transition);
}

/* Glassmorphism utility */
.glass {
    background: var(--bg-header);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
}

/* Premium Card Wrapper */
.premium-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.premium-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), hsl(320, 60%, 55%));
    opacity: 0;
    transition: var(--transition);
}

.premium-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-glow);
}

.premium-card:hover::before {
    opacity: 1;
}

/* Micro-animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Light mode hardening
   Several legacy views still ship dark inline colors. These overrides keep the
   light theme readable without changing each business screen individually. */
[data-theme="light"] body,
[data-theme="light"] .app-container,
[data-theme="light"] .app-content-wrapper {
    background: #f3f6fb !important;
    background-color: #f3f6fb !important;
    color: #0f172a !important;
}

[data-theme="light"] .app-header {
    background: rgba(255, 255, 255, 0.94) !important;
    border-bottom-color: #dbe3ee !important;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06) !important;
}

[data-theme="light"] .app-sidebar {
    background: #ffffff !important;
    background-color: #ffffff !important;
    border-left-color: #dbe3ee !important;
    color: #0f172a !important;
    box-shadow: -10px 0 28px rgba(15, 23, 42, 0.08) !important;
}

[data-theme="light"] .brand-section,
[data-theme="light"] .user-badge {
    border-color: #dbe3ee !important;
}

[data-theme="light"] .user-badge {
    background: #f8fafc !important;
}

[data-theme="light"] .brand-name,
[data-theme="light"] .header-title,
[data-theme="light"] .sidebar-group-btn,
[data-theme="light"] .user-name {
    color: #0f172a !important;
}

[data-theme="light"] .user-role,
[data-theme="light"] .sidebar-sub-item a {
    color: #475569 !important;
}

[data-theme="light"] .sidebar-group-btn:hover,
[data-theme="light"] .sidebar-group-btn.active-group {
    background: #eef6ff !important;
    color: #0369a1 !important;
}

[data-theme="light"] .sidebar-group-btn .indicator {
    min-width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #dff3ff !important;
    border: 1px solid #bae6fd !important;
    color: #075985 !important;
    font-size: 0.95rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
}

[data-theme="light"] .sidebar-group-btn.active-group .indicator {
    background: #0ea5e9 !important;
    border-color: #0284c7 !important;
    color: #ffffff !important;
}

[data-theme="light"] .sidebar-sub-item a:hover,
[data-theme="light"] .sidebar-sub-item.active a {
    background: rgba(14, 165, 233, 0.12) !important;
    color: #0369a1 !important;
}

[data-theme="light"] .menu-item a {
    color: #334155 !important;
}

[data-theme="light"] .menu-item a:hover,
[data-theme="light"] .menu-item.active a {
    background: rgba(14, 165, 233, 0.12) !important;
    color: #0369a1 !important;
}

[data-theme="light"] .premium-card,
[data-theme="light"] .stat-card {
    background: #ffffff !important;
    background-color: #ffffff !important;
    border-color: #dbe3ee !important;
    color: #0f172a !important;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08) !important;
}

[data-theme="light"] .premium-card[style*="linear-gradient"] {
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%) !important;
}

[data-theme="light"] .form-label,
[data-theme="light"] .text-muted,
[data-theme="light"] .text-secondary,
[data-theme="light"] .premium-card h1,
[data-theme="light"] .premium-card h2,
[data-theme="light"] .premium-card h3,
[data-theme="light"] .premium-card h4,
[data-theme="light"] .premium-card h5,
[data-theme="light"] .stat-card h1,
[data-theme="light"] .stat-card h2,
[data-theme="light"] .stat-card h3,
[data-theme="light"] .stat-card h4,
[data-theme="light"] .stat-card p,
[data-theme="light"] table,
[data-theme="light"] th,
[data-theme="light"] td {
    color: #0f172a;
}

[data-theme="light"] .premium-card p,
[data-theme="light"] .table th {
    color: #334155;
}

[data-theme="light"] .table-responsive {
    background: #ffffff !important;
    border-color: #dbe3ee !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06) !important;
}

[data-theme="light"] .table th {
    background: #f8fafc !important;
}

[data-theme="light"] .table td {
    border-bottom-color: #e2e8f0 !important;
}

[data-theme="light"] .form-control,
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
    background: #ffffff !important;
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

[data-theme="light"] .form-control::placeholder,
[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder {
    color: #64748b !important;
}

[data-theme="light"] .sidebar-utils-btn,
[data-theme="light"] #sidebar-toggle {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

[data-theme="light"] pre,
[data-theme="light"] code {
    background-color: #f8fafc !important;
    border-color: #dbe3ee !important;
    color: #334155 !important;
}

/* Era Technology Powered-By Badge Footer */
.app-footer, .portal-footer {
    margin-top: auto;
    padding: 24px 20px 32px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-badge-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 7px 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.25s ease;
}

.footer-badge-wrap:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-glow, var(--primary));
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}

.powered-by-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: -0.2px;
    opacity: 0.85;
    user-select: none;
}

.era-suite-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    opacity: 0.9;
    transition: all 0.2s ease;
}

.era-suite-link:hover {
    opacity: 1;
    transform: translateY(-1px) scale(1.03);
}

.era-suite-logo-img {
    height: 19px;
    width: auto;
    max-width: 125px;
    object-fit: contain;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.45));
    vertical-align: middle;
}

