/* Base CSS Variables for Both Themes */
:root {
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --gradient-primary: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

/* Premium Dark Theme (Default) */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-sidebar: rgba(15, 23, 42, 0.95);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --success-bg: rgba(16, 185, 129, 0.1);
    --danger-bg: rgba(239, 68, 68, 0.1);
    
    --border-color: rgba(255, 255, 255, 0.1);
    --hover-bg: rgba(255, 255, 255, 0.05);

    --blob-1: rgba(59, 130, 246, 0.4);
    --blob-2: rgba(139, 92, 246, 0.4);
}

/* Premium Light Theme */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-sidebar: rgba(255, 255, 255, 0.95);
    
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    
    --success-bg: rgba(16, 185, 129, 0.15);
    --danger-bg: rgba(239, 68, 68, 0.15);
    
    --border-color: rgba(0, 0, 0, 0.08);
    --hover-bg: rgba(0, 0, 0, 0.04);

    --blob-1: rgba(59, 130, 246, 0.2);
    --blob-2: rgba(139, 92, 246, 0.2);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Background Animated Blobs */
.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.5;
    border-radius: 50%;
    animation: float 20s infinite ease-in-out alternate;
    transition: background 0.4s ease;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: var(--blob-1);
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: var(--blob-2);
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

/* Typography Constants */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
}

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* Dashboard Layout */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
}

/* Profile Section */
.profile-section {
    padding: 2.5rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.profile-pic {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--accent-color);
    padding: 2px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.profile-name { font-size: 1.2rem; color: var(--text-primary); margin-bottom: 0.25rem; }
.profile-role { font-size: 0.9rem; color: var(--text-secondary); }

.sidebar-nav { flex: 1; padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: 0.5rem; overflow-y: auto; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(100,100,100,0.3); border-radius: 4px; }
.nav-link { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; color: var(--text-secondary); text-decoration: none; border-radius: 12px; font-weight: 500; transition: var(--transition); cursor: pointer; }
.nav-icon { font-size: 1.25rem; width: 24px; text-align: center; }

.nav-link:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

/* Sidebar Footer & Theme Toggle */
.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.theme-toggle-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.8rem;
    border-radius: 12px;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle-btn:hover {
    background: var(--border-color);
}

/* Icon toggling logic */
[data-theme="dark"] .icon-dark { display: block; }
[data-theme="dark"] .icon-light { display: none; }

[data-theme="light"] .icon-dark { display: none; }
[data-theme="light"] .icon-light { display: block; }

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 280px; /* Offset for fixed sidebar */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* View Control */
.dashboard-view {
    display: none;
    flex-direction: column;
    flex: 1;
}

.dashboard-view.active {
    display: flex;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.content-header {
    padding: 2rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid transparent; /* reserved space if needed */
}

.content-header h2 {
    font-size: 2rem;
    font-weight: 600;
}

.container {
    padding: 0 2.5rem 2.5rem 2.5rem;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
    font-size: 0.95rem;
}

.btn-outline {
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--border-color);
    border-color: rgba(139, 92, 246, 0.4);
}

/* Loaders */
.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 300px;
}

.loader {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Grid Layouts */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

/* Cards (Glassmorphism) */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: box-shadow 0.3s, transform 0.3s, border-color 0.3s, background-color 0.4s;
    position: relative;
    overflow: hidden;
    animation: fadeUp 0.5s ease-out forwards;
    opacity: 0;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color);
}

[data-theme="dark"] .card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card:hover::before {
    transform: scaleX(1);
}

.card-.toast i { font-size: 1.25rem; }

/* Mock Test UI Elements */
.mock-option-label { display: block; padding: 1rem 1.5rem; margin-bottom: 1rem; background: var(--hover-bg); border: 2px solid var(--border-color); border-radius: 12px; cursor: pointer; transition: var(--transition); display: flex; align-items: center; gap: 1rem; }
.mock-option-label:hover { border-color: var(--accent-color); background: rgba(59, 130, 246, 0.05); }
.mock-option-label input[type="radio"] { width: 22px; height: 22px; accent-color: var(--accent-color); flex-shrink: 0; cursor: pointer; }
.mock-option-label.selected { border-color: var(--accent-color); background: rgba(59, 130, 246, 0.1); }
.opt-text { font-size: 1.1rem; line-height: 1.4; }

.card-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

/* Question List Layout */
.question-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 800px;
    margin: 1rem auto 0;
}

.question-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    animation: fadeUp 0.5s ease-out forwards;
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.question-badge {
    background: var(--hover-bg);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-easy { color: var(--success); }
.badge-medium { color: var(--warning); }
.badge-hard { color: var(--danger); }

.question-text {
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Options */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.option-btn {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    padding: 1rem 1.25rem;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.option-btn:hover:not(:disabled) {
    background: var(--bg-card);
    border-color: var(--accent-light);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.option-label {
    margin-right: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.option-btn.correct {
    background: var(--success-bg) !important;
    border-color: var(--success) !important;
    color: var(--text-primary);
}

.option-btn.correct .option-label {
    color: var(--success);
}

.option-btn.incorrect {
    background: var(--danger-bg) !important;
    border-color: var(--danger) !important;
    color: var(--text-primary);
}

.option-btn.incorrect .option-label {
    color: var(--danger);
}

/* Explanation Box */
.explanation-box {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: rgba(59, 130, 246, 0.05);
    border-left: 4px solid var(--accent-color);
    border-radius: 0 8px 8px 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-secondary);
    display: none;
    animation: fadeDown 0.4s ease-out;
}

.explanation-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Breadcrumbs */
.breadcrubs-wrapper {
    max-width: 1000px;
    margin: 0 auto 1rem;
    padding: 0 2.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.crumb-link {
    cursor: pointer;
    transition: color 0.2s;
}

.crumb-link:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.crumb-separator {
    margin: 0 0.5rem;
    font-size: 0.8rem;
}

/* Animations */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Forms & Inputs */
.form-group { margin-bottom: 1.25rem; }
.form-row { display: flex; gap: 1.5rem; margin-bottom: 1.25rem; }
.form-group.half { flex: 1; margin-bottom: 0; }
.form-group.third { flex: 1; margin-bottom: 0; }
label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: var(--text-secondary); font-size: 0.95rem; }
input[type="text"], input[type="number"], select, textarea { width: 100%; padding: 0.75rem 1rem; background: var(--hover-bg); border: 2px solid var(--border-color); border-radius: 8px; color: var(--text-primary); font-family: inherit; font-size: 1rem; transition: var(--transition); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-color); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); }
input:disabled, select:disabled { opacity: 0.6; cursor: not-allowed; }
select[multiple] { height: auto; min-height: 120px; padding: 0.5rem; }
select[multiple] option { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 4px; border: 1px solid transparent; transition: var(--transition); cursor: pointer; }
select[multiple] option:hover { background: var(--hover-bg); color: var(--text-primary); }
select[multiple] option:checked { background: var(--gradient-primary); color: white; border-color: transparent; }

/* Custom Checkbox Lists for Setup */
.checkbox-list {
    background: var(--input-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    height: 150px;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
[data-theme="dark"] .checkbox-list { background: rgba(0,0,0,0.2); }
[data-theme="light"] .checkbox-list { background: rgba(0,0,0,0.02); }

.checkbox-list::-webkit-scrollbar { width: 6px; }
.checkbox-list::-webkit-scrollbar-thumb { background: rgba(100,100,100,0.3); border-radius: 4px; }

.custom-cb {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 0 !important;
    border: 1px solid transparent;
}
.custom-cb:hover {
    background: var(--hover-bg);
}
.custom-cb input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-color);
    cursor: pointer;
    margin: 0;
    padding: 0;
}
.custom-cb:has(input:checked) {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-color);
}

/* Utilities */
.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .dashboard-wrapper {
        flex-direction: column;
    }

    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 1.5rem;
        background: var(--bg-sidebar);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border-color);
        position: sticky;
        top: 0;
        z-index: 999;
        width: 100%;
    }

    .mobile-logo {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 1.25rem;
        font-weight: 700;
    }

    .menu-toggle {
        font-size: 1.5rem;
        color: var(--text-primary);
        background: none;
        border: none;
        cursor: pointer;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1001;
        width: 280px;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: 1000;
        backdrop-filter: blur(4px);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding-top: 0;
    }

    .content-header {
        padding: 1.5rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .content-header h2 {
        font-size: 1.5rem;
    }

    .container {
        padding: 0 1rem 1.5rem 1rem;
    }

    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .card {
        padding: 1rem;
    }

    .mock-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .question-card {
        padding: 1rem;
    }
}

@media (min-width: 769px) {
    .mobile-header { display: none; }
    .sidebar-overlay { display: none; }
}
