:root {
    /* Color Palette - Modern & Premium */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #6366f1;
    --accent: #8b5cf6;
    --dark: #0f172a;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Neutral Colors */
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;

    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Layout */
    --nav-height: 72px;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
.logo-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

/* Navigation */
.top-nav {
    height: var(--nav-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-icon {
    font-size: 1.5rem;
    background: var(--primary-light);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.logo-text {
    font-size: 1.25rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    background: #f1f5f9;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    width: 240px;
}

.search-icon {
    font-size: 0.875rem;
    margin-right: 0.5rem;
    opacity: 0.5;
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    font-size: 0.875rem;
    width: 100%;
}

.btn-logout {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

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

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--border);
    cursor: pointer;
}

/* Main Layout */
.main-content {
    max-width: 1300px;
    margin: 2rem auto;
    padding: 0 2rem;
    min-height: calc(100vh - var(--nav-height) - 100px);
}

.view-section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dashboard Styles */
.dashboard-header {
    text-align: center;
    margin-bottom: 3rem;
}

.dashboard-header h1 {
    font-size: 2.5rem;
    color: var(--dark);
    margin-bottom: 1rem;
}

.dashboard-header p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

.license-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.license-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.license-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.license-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    display: inline-block;
}

.license-card h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--dark);
}

.license-card p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-link {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.875rem;
}

/* CTA Banner */
.cta-banner {
    background: var(--dark);
    border-radius: var(--radius-2xl);
    padding: 4rem;
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
    background-image: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent),
        radial-gradient(circle at bottom left, rgba(37, 99, 235, 0.15), transparent);
}

.cta-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.cta-content p {
    color: #94a3b8;
    margin-bottom: 2.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.mode-selection {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary.selected {
    outline: 3px solid rgba(255, 255, 255, 0.3);
    background: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-outline:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-danger {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

/* Quiz Content Area */
.quiz-layout {
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
}

.quiz-layout.active {
    display: grid;
}

.quiz-main {
    width: 100%;
}

.quiz-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.quiz-card-header {
    background: var(--bg-card);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quiz-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
}

.quiz-breadcrumb .separator {
    opacity: 0.3;
}

.quiz-breadcrumb #licenseInfo {
    color: var(--primary);
    font-weight: 600;
}

.question-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.question-content {
    padding: 2.5rem;
}

.q-image-container {
    margin-bottom: 2rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-align: center;
    background: #f8fafc;
}

.q-image-container img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
    max-height: 400px;
}

.q-text {
    font-size: 1.5rem;
    color: var(--dark);
    margin-bottom: 2rem;
    line-height: 1.4;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.option {
    display: flex;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    color: var(--text-secondary);
}

.option:hover {
    border-color: var(--primary);
    background: #f0f7ff;
    color: var(--primary);
}

.option.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.option.correct {
    border-color: var(--success);
    background: #f0fdf4;
    color: var(--success);
}

.option.incorrect {
    border-color: var(--danger);
    background: #fef2f2;
    color: var(--danger);
}

/* Explanation Box */
.explanation-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f0f7ff;
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--primary);
    display: none;
    /* JS toggles this */
}

.explanation-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.explanation-header h4 {
    color: var(--primary);
}

/* Quiz Footer */
.quiz-footer {
    padding: 1.5rem 2rem;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
}

/* Sidebar Progress */
.sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.sidebar-card h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.progress-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.progress-dot {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8125rem;
    background: white;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    margin: 0 auto;
}

.progress-dot.answered {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.progress-dot.current {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.progress-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.answered {
    background: var(--primary);
}

.dot.current {
    background: white;
    border: 2px solid var(--primary);
}

.dot.remaining {
    background: #f1f5f9;
    border: 1px solid var(--border);
}

/* Timer Display */
.timer-card {
    text-align: center;
}

.timer-display {
    font-size: 2.5rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: var(--dark);
}

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

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Results View */
.results-layout {
    max-width: 800px;
    margin: 0 auto;
}

.results-container {
    background: var(--bg-card);
    border-radius: var(--radius-2xl);
    padding: 3.5rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.results-header h2 {
    font-size: 2.5rem;
    margin: 1rem 0;
}

.score-overview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4rem;
    margin: 4rem 0;
    flex-wrap: wrap;
}

.score-circle-container {
    position: relative;
    width: 180px;
    height: 180px;
}

.score-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-bg {
    fill: none;
    stroke: #f1f5f9;
    stroke-width: 8;
}

.score-fill {
    fill: none;
    stroke: var(--success);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-out;
}

.score-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    font-weight: 800;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.stat-card {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dark);
}

.stat-value.correct {
    color: var(--success);
}

.stat-value.incorrect {
    color: var(--danger);
}

.results-feedback {
    margin-bottom: 3rem;
    padding: 2rem;
    border-radius: var(--radius-xl);
}

.results-feedback.passed {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

.results-feedback.failed {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

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

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-2xl);
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-content.large {
    max-width: 900px;
}

.modal-content.small {
    max-width: 440px;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* Review Items */
.review-item {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.review-item:last-child {
    border-bottom: none;
}

.review-question {
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
}

.review-options {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.review-options p {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background: #f1f5f9;
}

.review-options p.correct {
    background: #dcfce7;
    color: #166534;
    font-weight: 600;
}

.review-options p.incorrect {
    background: #fee2e2;
    color: #991b1b;
    font-weight: 600;
}

/* Footer */
.main-footer {
    border-top: 1px solid var(--border);
    padding: 3rem 0;
    background: white;
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--primary);
}

/* Responsive */
@media (max-width: 992px) {
    .quiz-layout {
        grid-template-columns: 1fr;
    }

    .quiz-sidebar {
        order: -1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .sidebar-card {
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {

    .nav-links,
    .search-bar {
        display: none;
    }

    .dashboard-header h1 {
        font-size: 2rem;
    }

    .cta-banner {
        padding: 2rem;
    }

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

    .score-overview {
        gap: 2rem;
    }
}