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

:root {
    /* Deep space dark mode */
    --bg-base: #060b13;
    --bg-surface: rgba(16, 23, 42, 0.65);
    --bg-surface-hover: rgba(30, 41, 59, 0.85);
    
    /* Vibrant neon accents */
    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.5);
    --primary-faint: rgba(139, 92, 246, 0.15);
    --primary-border: rgba(139, 92, 246, 0.3);
    --secondary: #0ea5e9;
    --secondary-glow: rgba(14, 165, 233, 0.5);
    --secondary-faint: rgba(14, 165, 233, 0.15);
    --accent: #10b981;
    --accent-glow: rgba(16, 185, 129, 0.5);
    --danger: #ef4444;
    
    /* Text */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    /* Effects */
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px var(--primary-glow);
}

[data-theme="red"] {
    --bg-base: #1a0808;
    --bg-surface: rgba(42, 16, 16, 0.65);
    --bg-surface-hover: rgba(59, 30, 30, 0.85);
    --primary: #f43f5e;
    --primary-glow: rgba(244, 63, 94, 0.5);
    --primary-faint: rgba(244, 63, 94, 0.15);
    --primary-border: rgba(244, 63, 94, 0.3);
    --secondary: #fb923c;
    --secondary-glow: rgba(251, 146, 60, 0.5);
    --secondary-faint: rgba(251, 146, 60, 0.15);
    --accent: #fbbf24;
    --accent-glow: rgba(251, 191, 36, 0.5);
}

[data-theme="green"] {
    --bg-base: #051a0f;
    --bg-surface: rgba(16, 42, 26, 0.65);
    --bg-surface-hover: rgba(30, 59, 41, 0.85);
    --primary: #10b981;
    --primary-glow: rgba(16, 185, 129, 0.5);
    --primary-faint: rgba(16, 185, 129, 0.15);
    --primary-border: rgba(16, 185, 129, 0.3);
    --secondary: #14b8a6;
    --secondary-glow: rgba(20, 184, 166, 0.5);
    --secondary-faint: rgba(20, 184, 166, 0.15);
    --accent: #84cc16;
    --accent-glow: rgba(132, 204, 22, 0.5);
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(circle at 15% 50%, var(--primary-faint), transparent 25%),
        radial-gradient(circle at 85% 30%, var(--secondary-faint), transparent 25%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Amiri', serif;
    direction: rtl;
    text-align: right;
    margin: 0;
    overflow-x: hidden;
    min-height: 100vh;
}

/* English text inside Arabic contexts */
.font-sans {
    font-family: 'Outfit', sans-serif;
    direction: ltr;
    display: inline-block;
}

/* Typography & Colors */
.text-primary-custom { color: var(--primary) !important; }
.text-accent { color: var(--accent) !important; }

/* Premium Typography Elements */
.graffiti-title {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    letter-spacing: -0.5px;
    filter: drop-shadow(0 4px 12px var(--primary-border));
}

/* Advanced Glassmorphism */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.glass-panel:hover {
    background: var(--bg-surface-hover);
    transform: translateY(-5px);
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.7), var(--shadow-glow);
    border-color: var(--primary-border);
}

/* Layout Setup */
#wrapper {
    display: flex;
    width: 100%;
}

/* Floating Sidebar */
#sidebar {
    width: 280px;
    height: calc(100vh - 40px);
    margin: 20px 20px 20px 0;
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    border: var(--glass-border);
    border-radius: 30px;
    position: fixed;
    right: -100%; /* Hidden by default on mobile */
    top: 0;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
}

#sidebar.active {
    right: 0;
    margin-right: 10px;
    width: calc(100vw - 20px);
    max-width: 300px;
}

@media (min-width: 992px) {
    #sidebar.active, #sidebar {
        right: 20px; /* Always visible on desktop */
        margin-right: 0;
        width: 280px;
    }
    #content {
        padding-right: 320px !important; /* Space for sidebar */
    }
}

#sidebar .sidebar-header {
    padding: 30px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

#sidebar ul.components {
    padding: 20px 15px;
    flex-grow: 1;
    overflow-y: auto;
}

#sidebar ul li {
    margin-bottom: 10px;
}

#sidebar ul li a {
    padding: 15px 20px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 16px;
    transition: all 0.3s ease;
}

#sidebar ul li a i {
    width: 30px;
    font-size: 1.2rem;
    margin-left: 10px;
    transition: all 0.3s ease;
}

#sidebar ul li a:hover, #sidebar ul li.active > a {
    background: linear-gradient(90deg, var(--primary-faint), transparent);
    color: var(--text-primary);
    border-right: 4px solid var(--primary);
}

#sidebar ul li a:hover i, #sidebar ul li.active > a i {
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary-glow));
    transform: scale(1.1);
}

/* Page Content */
#content {
    width: 100%;
    min-height: 100vh;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 20px;
}

/* Floating Top Navbar */
.navbar-custom {
    background: rgba(10, 15, 28, 0.7) !important;
    backdrop-filter: blur(20px);
    border: var(--glass-border);
    border-radius: 20px;
    padding: 10px 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.navbar-custom .nav-link {
    color: var(--text-secondary) !important;
    transition: color 0.3s;
}

.navbar-custom .nav-link:hover {
    color: var(--text-primary) !important;
}

/* Wallet Style Cards (Replacing generic cards) */
.wallet-card {
    background: linear-gradient(135deg, rgba(30,41,59,0.8), rgba(15,23,42,0.9));
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 24px;
    padding: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    transition: transform 0.3s ease;
}

.wallet-card:hover {
    transform: translateY(-5px);
}

.wallet-card::before {
    content: '';
    position: absolute;
    top: -50%; right: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, var(--primary-faint) 0%, transparent 60%);
    pointer-events: none;
}

.wallet-card .balance-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.wallet-card .balance-amount {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: 'Outfit', sans-serif;
}

/* Premium Buttons */
.btn-premium {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px 28px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px var(--primary-glow);
    position: relative;
    overflow: hidden;
}

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

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px var(--primary-glow);
    color: #fff;
}

.btn-premium:hover::after {
    left: 100%;
}

/* Forms */
.form-control-custom {
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-radius: 12px;
    padding: 15px 20px;
    transition: all 0.3s ease;
}

.form-control-custom:focus {
    background-color: rgba(15, 23, 42, 0.9);
    color: var(--text-primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-faint);
}

.form-label {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 8px;
}

/* Modern Tables (List Style) */
.table-custom {
    color: var(--text-primary);
    border-collapse: separate;
    border-spacing: 0 10px;
}

.table-custom th {
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 15px 20px;
}

.table-custom td {
    background: rgba(30, 41, 59, 0.4);
    border: none;
    padding: 20px;
    vertical-align: middle;
}

.table-custom tbody tr {
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.table-custom tbody tr:hover {
    transform: scale(1.01);
    background: rgba(30, 41, 59, 0.8);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.table-custom tbody tr td:first-child {
    border-top-right-radius: 16px;
    border-bottom-right-radius: 16px;
}

.table-custom tbody tr td:last-child {
    border-top-left-radius: 16px;
    border-bottom-left-radius: 16px;
}

/* Custom Scrollbar for Responsive Tables */
.table-responsive {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-glow) var(--bg-surface);
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}
.table-responsive::-webkit-scrollbar-track {
    background: var(--bg-surface);
    border-radius: 10px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: var(--primary-glow);
    border-radius: 10px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Status Badges */
.status-badge {
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-badge::before {
    content: '';
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
}

.status-approved {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent);
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.status-approved::before { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

.status-rejected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.status-rejected::before { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

/* Login Page Specific */
.login-split {
    min-height: 100vh;
    display: flex;
}

.login-visual {
    flex: 1;
    background: linear-gradient(135deg, #0f172a, #060b13);
    position: relative;
    display: none;
    overflow: hidden;
}

@media (min-width: 992px) {
    .login-visual { display: flex; align-items: center; justify-content: center; }
}

.login-visual::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, var(--primary-border) 0%, transparent 70%);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 8s infinite alternate;
}

.login-form-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--bg-base);
}

.login-box {
    width: 100%;
    max-width: 450px;
}

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

/* Modals */
.modal-content-custom {
    background: var(--bg-surface-hover);
    backdrop-filter: blur(20px);
    border: 1px solid var(--primary-border);
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.05);
}

.modal-header-custom { border-bottom: 1px solid rgba(255,255,255,0.05); }
.modal-footer-custom { border-top: 1px solid rgba(255,255,255,0.05); }
.btn-close-white { filter: invert(1) grayscale(100%) brightness(200%); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--primary-glow); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* Overlay */
.overlay {
    display: none; position: fixed; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px);
    z-index: 1040; opacity: 0; transition: all 0.3s;
}
.overlay.active { display: block; opacity: 1; }

/* Mobile Specific Optimizations - Native App Theme */
@media (max-width: 767px) {
    /* Hide desktop-specific navigation */
    #sidebar, #sidebarCollapse {
        display: none !important;
    }
    
    /* Adjust content area to fill screen and leave space for bottom nav */
    #content {
        padding: 80px 15px 90px 15px !important; /* Top space for mobile header, Bottom space for nav */
    }

    .glass-panel, .wallet-card {
        padding: 15px !important;
    }
    
    /* Hide the complex desktop navbar entirely on mobile */
    .navbar-custom {
        display: none !important;
    }
    
    .dropdown-menu {
        max-width: 90vw;
        overflow-x: hidden;
    }
    
    .btn-premium {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .graffiti-title {
        font-size: 1.8rem !important;
    }

    /* Mobile App Header (Top Bar) */
    .mobile-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: rgba(10, 15, 28, 0.85);
        backdrop-filter: blur(15px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        z-index: 1040;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 20px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    }

    /* Bottom Navigation Bar */
    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 70px;
        background: rgba(10, 15, 28, 0.95);
        backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        z-index: 1050;
        display: flex;
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom);
        box-shadow: 0 -5px 25px rgba(0,0,0,0.4);
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: var(--text-secondary);
        width: 100%;
        height: 100%;
        position: relative;
        transition: all 0.3s ease;
    }

    .bottom-nav-item i {
        font-size: 1.3rem;
        margin-bottom: 4px;
        transition: all 0.3s ease;
    }

    .bottom-nav-item span {
        font-size: 0.7rem;
        font-family: 'Tajawal', sans-serif;
    }

    .bottom-nav-item.active {
        color: var(--primary);
    }

    .bottom-nav-item.active i {
        transform: translateY(-2px);
        filter: drop-shadow(0 0 8px var(--primary-glow));
    }
    
    .bottom-nav-item.active::before {
        content: '';
        position: absolute;
        top: 0;
        width: 30px;
        height: 3px;
        background: var(--primary);
        border-radius: 0 0 4px 4px;
        box-shadow: 0 2px 8px var(--primary-glow);
    }

    /* Floating Action Button (FAB) */
    .fab {
        position: fixed;
        bottom: 90px;
        left: 20px; /* On RTL, bottom left is standard for FAB, or right. We'll use left so it's not under thumb while scrolling right-aligned text */
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 8px 25px var(--primary-glow);
        z-index: 1045;
        font-size: 1.5rem;
        border: none;
        transition: transform 0.2s ease;
    }

    .fab:active {
        transform: scale(0.9);
    }
}

/* Hide mobile-specific elements on desktop */
@media (min-width: 768px) {
    .mobile-header, .bottom-nav, .fab {
        display: none !important;
    }
}
