@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #8b5cf6; /* Vibrant Purple */
    --primary-hover: #7c3aed;
    --secondary: #0ea5e9; /* Electric Blue */
    --bg-dark: #09090b; /* Deep almost-black */
    --bg-card: #18181b; /* Slightly lighter card background */
    --bg-card-alt: rgba(9, 9, 11, 0.9);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.5);
    --table-row-bg: rgba(0, 0, 0, 0.2);
    --nav-bg: rgba(9, 9, 11, 0.85);
    --text-main: #f8fafc;
    --text-muted: #a1a1aa;
    --border: #27272a;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --sidebar-width: 250px;
}

:root[data-theme="light"] {
    --bg-dark: #f8fafc; /* Very light gray/blue background */
    --bg-card: #f5f3ff; /* Richer soft purple card background */
    --bg-card-alt: rgba(139, 92, 246, 0.08);
    --glass-bg: rgba(139, 92, 246, 0.12);
    --glass-border: rgba(139, 92, 246, 0.25);
    --shadow-color: rgba(139, 92, 246, 0.15);
    --table-row-bg: rgba(139, 92, 246, 0.06);
    --nav-bg: rgba(245, 243, 255, 0.9);
    --text-main: #1e1b4b; /* Deep indigo text for better contrast */
    --text-muted: #4338ca; /* Indigo-muted text */
    --border: #c4b5fd; /* Much more visible purple border */
    /* Primary, secondary, success, danger, warning remain the same */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(139, 92, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}

.animate-fade-up { animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-float { animation: float 6s ease-in-out infinite; }
.delay-1 { animation-delay: 0.1s; opacity: 0; }
.delay-2 { animation-delay: 0.2s; opacity: 0; }
.delay-3 { animation-delay: 0.3s; opacity: 0; }

/* Gradient Text */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* Utilities */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.card { background-color: var(--bg-card); border-radius: 12px; padding: 20px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); border: 1px solid var(--border); }
.btn { display: inline-block; padding: 10px 20px; border-radius: 8px; font-weight: 500; text-align: center; cursor: pointer; transition: all 0.3s ease; border: none; }
.btn-primary { background-color: var(--primary); color: #fff; }
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-2px); }
.btn-success { background-color: var(--success); color: #fff; }
.btn-danger { background-color: var(--danger); color: #fff; }
.text-center { text-align: center; }
.mt-2 { margin-top: 10px; } .mt-4 { margin-top: 20px; } .mb-4 { margin-bottom: 20px; }

/* Forms */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; color: var(--text-muted); }
.form-control { width: 100%; padding: 12px; border-radius: 8px; border: 1px solid var(--border); background-color: var(--bg-dark); color: var(--text-main); transition: border-color 0.3s; }
.form-control:focus { outline: none; border-color: var(--primary); }

/* Layouts */
.app-wrapper { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: var(--sidebar-width); background-color: var(--bg-card); padding: 20px 0; border-right: 1px solid var(--border); display: flex; flex-direction: column; transition: transform 0.3s ease; height: 100vh; overflow-y: auto; }
.sidebar-logo { padding: 0 20px 20px; font-size: 24px; font-weight: 700; color: var(--primary); border-bottom: 1px solid var(--border); margin-bottom: 20px; display: flex; align-items: center; gap: 10px;}
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 5px; padding: 0 10px; }
.sidebar-link { padding: 12px 15px; border-radius: 8px; color: var(--text-muted); display: flex; align-items: center; gap: 10px; transition: all 0.3s; }
.sidebar-link:hover, .sidebar-link.active { background-color: rgba(99, 102, 241, 0.1); color: var(--primary); }
.main-content { flex: 1; padding: 30px; overflow-y: auto; height: 100vh; position: relative; }
.topbar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin: -30px -30px 30px -30px;
    padding: 20px 30px;
    gap: 15px; 
    position: sticky;
    top: -30px;
    z-index: 40;
    background: rgba(9, 9, 11, 0.95);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
}
.page-title { font-size: 24px; font-weight: 600; flex: 1; }

.sidebar-overlay { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.5); 
    backdrop-filter: blur(4px); 
    z-index: 45; 
}
.sidebar-overlay.show { display: block; }

/* Grid */
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { padding: 15px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-muted); text-transform: uppercase; font-size: 12px; }

/* Badges */
.badge { padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.badge-pending { background-color: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-approved { background-color: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-rejected { background-color: rgba(239, 68, 68, 0.2); color: var(--danger); }

/* Toast Alert */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; }
.toast { background-color: var(--bg-card); border: 1px solid var(--border); padding: 15px 20px; border-radius: 8px; display: flex; align-items: center; gap: 10px; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); animation: slideIn 0.3s ease forwards; opacity: 0; transform: translateX(100%); }
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }

@keyframes slideIn { to { transform: translateX(0); opacity: 1; } }

/* Mobile */
@media (max-width: 768px) {
    .hide-on-mobile { display: none !important; }
    .app-wrapper { flex-direction: column; height: auto; overflow: visible; }
    .sidebar { position: fixed; height: 100vh; transform: translateX(-100%); z-index: 50; box-shadow: 20px 0 50px rgba(0,0,0,0.5); }
    .sidebar.show { transform: translateX(0); }
    .main-content { padding: 20px 15px; width: 100%; height: auto; overflow: visible; }
    .topbar { margin: -20px -15px 20px -15px; padding: 15px; position: sticky; top: 0; }
    .page-title { font-size: 20px; }
    .user-profile { font-size: 0.85rem; }
    
    .grid-3 { grid-template-columns: 1fr; }
    
    /* Responsive Table */
    table.responsive-table { display: block; border: none; }
    table.responsive-table thead { display: none; }
    table.responsive-table tbody, table.responsive-table tr, table.responsive-table td { display: block; width: 100%; }
    table.responsive-table tr { margin-bottom: 15px; border: 1px solid var(--border); border-radius: 12px; padding: 10px; background: var(--bg-card); }
    table.responsive-table td { text-align: right; padding: 10px 5px; border-bottom: 1px dashed var(--border); display: flex; justify-content: space-between; align-items: center; }
    table.responsive-table td:last-child { border-bottom: none; }
    table.responsive-table td::before { content: attr(data-label); font-weight: 700; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; float: left; }
}

/* Global Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: fixed;
    width: calc(100% - 40px);
    max-width: 1200px;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    transition: all 0.3s ease;
}

.navbar:hover {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(139, 92, 246, 0.3);
}

.nav-logo { 
    font-size: 1.5rem; 
    font-weight: 800; 
    color: var(--text-main); 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    letter-spacing: -0.5px;
}

.nav-logo:hover { 
    transform: translateY(-1px); 
}

.nav-logo i { 
    color: var(--primary); 
    font-size: 1.4rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 6px rgba(139, 92, 246, 0.3));
}

.nav-links { 
    display: flex; 
    gap: 16px; 
    align-items: center; 
}

.nav-btn-login {
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 10px 20px;
    border-radius: 100px;
    transition: all 0.3s ease;
}

.nav-btn-login:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-btn-signup {
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 10px 24px;
    border-radius: 100px;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255,255,255,0.1);
}

.nav-btn-signup:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.5);
}

@media (max-width: 768px) {
    .navbar {
        width: calc(100% - 20px);
        padding: 12px 16px;
        top: 10px;
    }
    .nav-logo { font-size: 1.2rem; }
    
    .nav-links {
        display: none;
        position: absolute;
        top: calc(100% + 10px);
        left: 0;
        width: 100%;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 20px;
        border-radius: 16px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .nav-btn-signup, .nav-btn-login { 
        width: 100%; 
        text-align: center;
        padding: 12px;
        font-size: 1rem;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    #toggleSidebar {
        display: block !important;
    }
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

.nav-actions-mobile {
    display: none;
}
.mobile-nav-login {
    display: none;
}

@media (max-width: 768px) {
    .nav-actions-mobile {
        display: flex;
        align-items: center;
        gap: 15px;
    }
    .mobile-nav-login {
        display: inline-block;
        color: var(--text-main);
        font-weight: 600;
        font-size: 0.9rem;
        padding: 6px 14px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 100px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        text-decoration: none;
    }
    .mobile-nav-login:hover {
        background: rgba(255, 255, 255, 0.2);
    }
    .desktop-login {
        display: none !important;
    }
}