/* Color Variables */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #10b981;
    --accent: #f59e0b;
    --dark: #1e293b;
    --light: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    background-color: var(--surface);
    box-shadow: var(--shadow-lg);
    border-right: 1px solid var(--border);
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
    /* HIDDEN on desktop by default */
    transform: translateX(-100%);
}

/* Show sidebar only when .show class is added */
.sidebar.show {
    transform: translateX(0);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 1.5rem 1rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    background: var(--surface);
}

.sidebar-brand img {
    height: 42px;
    border-radius: 8px;
    margin-right: 10px;
    transition: transform 0.3s ease;
}

.sidebar-brand:hover img {
    transform: scale(1.05);
}

.sidebar-brand span {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--primary);
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-item {
    margin-bottom: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    border-radius: 8px;
    margin: 0 0.5rem;
    transition: all 0.3s ease;
    position: relative;
}

.sidebar-link:hover {
    color: var(--primary);
    background-color: rgba(37, 99, 235, 0.08);
    transform: translateX(3px);
}

.sidebar-link.active {
    color: var(--primary);
    background-color: rgba(37, 99, 235, 0.1);
    border-left: 3px solid var(--primary);
}

.sidebar-link i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* Dropdown Styles */
.sidebar-dropdown {
    position: relative;
}

.sidebar-dropdown-menu {
    display: none;
    padding-left: 2rem;
    margin-top: 0.25rem;
}

.sidebar-dropdown-menu.show {
    display: block;
}

.sidebar-dropdown-link {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    border-radius: 6px;
    margin: 0.1rem 0;
    transition: all 0.2s ease;
}

.sidebar-dropdown-link:hover {
    background-color: rgba(37, 99, 235, 0.08);
    color: var(--primary);
    transform: translateX(2px);
}

.sidebar-dropdown-link i {
    margin-right: 10px;
    width: 18px;
    text-align: center;
    color: var(--primary);
}

/* User Profile Styles */
.user-profile-sidebar {
    display: flex;
    align-items: center;
    padding: 1rem;
    margin: 1rem 0.5rem;
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.05);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.user-profile-sidebar:hover {
    background: rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}

.user-avatar-sidebar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    border: 2px solid var(--primary);
    transition: all 0.3s ease;
}

.user-profile-sidebar:hover .user-avatar-sidebar {
    transform: scale(1.05);
    border-color: var(--accent);
}

.user-info-sidebar {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.username-sidebar {
    font-weight: 600;
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.2;
}

.user-level-sidebar {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    margin-top: 2px;
}

.level-badge-sidebar {
    background: var(--primary);
    color: white;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.7rem;
    margin-right: 5px;
    font-weight: 600;
}

/* Progress Bar */
.level-progress-sidebar {
    height: 4px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.level-progress-bar-sidebar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* Badge Styles */
.badge-new {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    font-size: 0.7rem;
    padding: 3px 6px;
    margin-left: auto;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Main Content Area */
.main-content {
    margin-left: 0; /* Changed from 280px to 0 */
    min-height: 100vh;
    background-color: var(--light);
    transition: margin-left 0.3s ease;
}

/* When sidebar is shown, adjust main content */
.sidebar.show ~ .main-content {
    margin-left: 280px;
}

/* Toggle Button for Mobile AND Desktop */
.sidebar-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    display: block; /* Changed from 'none' to 'block' - ALWAYS VISIBLE */
}

/* Responsive Design */
@media (max-width: 991.98px) {
    /* On mobile, no margin-left when sidebar shows */
    .sidebar.show ~ .main-content {
        margin-left: 0;
    }
    
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }
    
    .sidebar-backdrop.show {
        display: block;
    }
}

@media (min-width: 992px) {
    /* On desktop, hide backdrop */
    .sidebar-backdrop {
        display: none !important;
    }
}

/* Divider */
.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 1rem 0.5rem;
}

/* Logout Button */
.sidebar-logout {
    margin-top: auto;
    padding: 1rem;
    border-top: 1px solid var(--border);
}

/* Animation for dropdown arrows */
.sidebar-dropdown-arrow {
    margin-left: auto;
    transition: transform 0.3s ease;
}

.sidebar-dropdown.show .sidebar-dropdown-arrow {
    transform: rotate(180deg);
}
/* Focus styles */
a:focus,
button:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Custom Quiz Dropdown (ADDED) */
/* This keeps all your existing dropdown styles, just adding the menu items */
