/* ACME Modern Theme System */

:root {
    /* Light Theme - Core Foundation */
    --bg-main: #F8FAFC;
    --bg-surface: #FFFFFF;
    --bg-surface-hover: #F1F5F9;
    --bg-tertiary: #F1F5F9;
    --border-color: #E2E8F0;

    /* Primary Brand & Action */
    --primary: #2563EB;
    --primary-hover: #1D4ED8;
    --primary-light: #DBEAFE;
    --secondary: #64748B;
    --secondary-hover: #475569;
    --active-selection: #DBEAFE;

    /* Feedback & Status */
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --error: #EF4444;
    --error-light: #FEE2E2;

    /* Text Colors */
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --text-inverse: #FFFFFF;

    /* Question Specific */
    --question-heading: #0F172A;
    --selected-answer: #3B82F6;
    --selected-answer-bg: #EFF6FF;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
}

/* Dark Theme */
[data-theme="dark"] {
    /* Core Foundation */
    --bg-main: #0F172A;
    --bg-surface: #1E293B;
    --bg-surface-hover: #334155;
    --bg-tertiary: #334155;
    --border-color: #334155;

    /* Primary Brand & Action */
    --primary: #3B82F6;
    --primary-hover: #60A5FA;
    --primary-light: #1E3A5F;
    --secondary: #94A3B8;
    --secondary-hover: #CBD5E1;
    --active-selection: #1E3A5F;

    /* Feedback & Status */
    --success: #22C55E;
    --success-light: #14532D;
    --warning: #FBBF24;
    --warning-light: #9A3412;
    --error: #F87171;
    --error-light: #7F1D1D;

    /* Text Colors */
    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #64748B;
    --text-inverse: #0F172A;

    /* Question Specific */
    --question-heading: #F8FAFC;
    --selected-answer: #60A5FA;
    --selected-answer-bg: #1E3A5F;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
}

/* Base Styles */
body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Header Styles */
.main-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.logo-link {
    color: var(--primary);
    transition: color var(--transition-fast);
}

.logo-link:hover {
    color: var(--primary-hover);
}

.tagline {
    color: var(--text-secondary);
}

.nav-link {
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

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

.nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

[data-theme="dark"] .nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

/* Profile Button */
.profile-btn {
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.profile-btn:hover {
    background: var(--bg-surface);
    border-color: var(--border-color);
}

.avatar, .dropdown-avatar, .page-avatar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
}

.user-name {
    color: var(--text-primary);
}

.chevron-down {
    color: var(--text-muted);
}

/* Profile Dropdown */
.profile-dropdown {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.dropdown-header {
    background: var(--bg-surface-hover);
}

.dropdown-user-name {
    color: var(--text-primary);
}

.dropdown-user-email {
    color: var(--text-secondary);
}

.dropdown-divider {
    background: var(--border-color);
}

.dropdown-item {
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg-surface-hover);
}

.dropdown-item-danger {
    color: var(--error);
}

.dropdown-item-danger:hover {
    background: var(--error-light);
}

[data-theme="dark"] .dropdown-item-danger:hover {
    background: var(--error-light);
}

/* Cards */
.card {
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.card h2 {
    color: var(--primary);
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.card h3 {
    color: var(--question-heading);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: var(--text-inverse);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary-light);
}

[data-theme="dark"] .btn-outline:hover {
    background: var(--primary-light);
}

.btn-secondary {
    background: var(--secondary);
}

.btn-secondary:hover {
    background: var(--secondary-hover);
}

.btn-success {
    background: var(--success);
}

.btn-danger {
    background: var(--error);
}

.btn-danger:hover {
    background: #DC2626;
}

/* Form Elements */
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-surface);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus,
[data-theme="dark"] .form-group textarea:focus {
    box-shadow: 0 0 0 3px var(--primary-light);
}

.readonly {
    background: var(--bg-surface-hover);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: #92400E;
}

.badge-danger {
    background: var(--error-light);
    color: #991B1B;
}

.badge-info {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-secondary {
    background: var(--bg-surface-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* Difficulty Badges */
.badge-easy {
    background: var(--success-light);
    color: var(--success);
    font-weight: 600;
}

.badge-medium {
    background: var(--warning-light);
    color: #92400E;
    font-weight: 600;
}

.badge-hard {
    background: var(--error-light);
    color: #991B1B;
    font-weight: 600;
}

/* Dark mode badge adjustments */
[data-theme="dark"] .badge-medium {
    color: #FDE68A;
}

[data-theme="dark"] .badge-hard {
    color: #FECACA;
}

/* Alert Messages */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid;
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border-color: var(--success);
}

.alert-error {
    background: var(--error-light);
    color: var(--error);
    border-color: var(--error);
}

.alert-info {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table th {
    background: var(--bg-surface-hover);
    font-weight: 600;
    color: var(--text-secondary);
}

table tr:hover {
    background: var(--bg-surface-hover);
}

/* Exam Interface */
.exam-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.exam-logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

.exam-timer {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}

.exam-timer.warning {
    color: var(--warning);
    animation: pulse 1s infinite;
}

.question-text {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--question-heading);
}

.options-list label {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--bg-surface);
}

.options-list label:hover {
    background: var(--bg-surface-hover);
    border-color: var(--primary);
}

.options-list input[type="radio"]:checked + span {
    color: var(--selected-answer);
    font-weight: 500;
}

.options-list input[type="radio"]:checked ~ label {
    border-color: var(--selected-answer);
    background: var(--selected-answer-bg);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.tab:hover {
    color: var(--primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Footer */
.main-footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    background: var(--bg-surface);
}

/* Toggle Switch */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: none;
    border: none;
    text-align: left;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--bg-surface-hover);
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .toggle-switch {
    background: var(--primary);
}

[data-theme="dark"] .toggle-switch::after {
    transform: translateX(20px);
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Spinner */
.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

/* Tests Grid */
.tests-grid {
    width: 100%;
}

.tests-grid-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    animation: slideUp 0.4s ease-out;
}

/* Test Card */
.test-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
    position: relative;
}

.test-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--success));
    opacity: 0;
    transition: opacity var(--transition-fast);
}

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

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

.test-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface-hover);
}

.test-difficulty {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.difficulty-dot {
    font-size: 0.7rem;
}

.test-questions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.test-card-body {
    padding: 1.25rem;
    flex: 1;
}

.test-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--question-heading);
    margin: 0 0 0.75rem 0;
    line-height: 1.4;
}

.test-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 1rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.test-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.tag-pill {
    background: var(--bg-surface-hover);
    color: var(--text-secondary);
    padding: 0.3rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

.test-card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
}

.test-enroll-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state svg {
    margin: 0 auto 1rem;
    opacity: 0.5;
}

.empty-state p {
    margin: 0;
    color: var(--text-secondary);
}

/* Hero Section Enhancement */
.hero-section {
    text-align: center;
    margin-bottom: 3rem;
    padding: 3rem 0;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-light) 0%, transparent 70%);
    opacity: 0.3;
    pointer-events: none;
}

[data-theme="dark"] .hero-section::before {
    opacity: 0.15;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem 1rem;
    background: var(--primary-light);
    border-radius: 50px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 1px;
    font-size: 0.75rem;
}

.hero-badge svg {
    width: 16px;
    height: 16px;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    color: var(--question-heading);
    margin-bottom: 1rem;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto 2rem;
    font-weight: 400;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.hero-welcome {
    display: none;
    font-size: 1.1rem;
}

.welcome-text {
    color: var(--text-primary);
}

.welcome-text strong {
    color: var(--success);
    font-weight: 600;
}

.dashboard-link {
    color: var(--primary);
    font-weight: 500;
    margin-left: 0.5rem;
    text-decoration: none;
}

.dashboard-link:hover {
    text-decoration: underline;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-title-group {
    flex: 1;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--question-heading);
    margin: 0;
}

.section-subtitle {
    color: var(--text-secondary);
    margin: 0.25rem 0 0 0;
    font-size: 0.95rem;
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: var(--text-inverse);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .main-header {
        padding: 0.75rem 1rem;
    }

    .tagline {
        display: none;
    }

    .tests-grid-inner {
        grid-template-columns: 1fr;
    }

    .hero-section h1 {
        font-size: 2rem !important;
    }

    .hero-section p {
        font-size: 1rem !important;
    }
}

/* Smooth theme transition */
* {
    transition: background-color var(--transition-normal),
                color var(--transition-normal),
                border-color var(--transition-normal),
                box-shadow var(--transition-normal);
}

/* Disable transition for specific elements during theme change */
.theme-transition * {
    transition: none !important;
}
