/* Modern Driving Test Study Web App Styling - Vanilla CSS */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #131a2c;
    --bg-tertiary: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.08);
    --shadow: 0 10px 30px -10px rgba(100, 116, 139, 0.15);
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    transition: var(--transition);
    overflow-x: hidden;
}

/* Header & Navigation */
header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    transition: var(--transition);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-badge {
    background: linear-gradient(135deg, var(--accent), #10b981);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    transition: var(--transition);
}

.theme-toggle-btn:hover {
    transform: scale(1.05);
    background: var(--glass-border);
}

/* Tabs */
.nav-tabs {
    display: flex;
    background: var(--bg-tertiary);
    padding: 0.35rem;
    border-radius: 30px;
    border: 1px solid var(--glass-border);
}

.tab-btn {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-secondary);
    padding: 0.5rem 1.25rem;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

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

.tab-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

/* Container Layout */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem 4rem;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.tab-content.active {
    display: block;
}

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

/* Section Common Headers */
.section-title {
    margin-bottom: 2rem;
    text-align: center;
}

.section-title h2 {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
}

.section-title p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Tab 1: Study Guide Cards */
.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.5rem;
}

.guide-card {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.75rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.guide-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 15px 35px -15px rgba(37, 99, 235, 0.15);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: inline-block;
    padding: 0.5rem;
    border-radius: 12px;
    background: var(--bg-tertiary);
}

.guide-card h3 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.double-badge {
    background: linear-gradient(135deg, var(--warning), #ef4444);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.guide-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
}

.card-bullet-list {
    list-style: none;
}

.card-bullet-list li {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
}

.card-bullet-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: 700;
}

.card-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.85rem;
}

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

.card-table th {
    color: var(--text-secondary);
    font-weight: 600;
}

/* Tab 2: Quiz App Simulator */
.quiz-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.quiz-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #10b981);
    width: 0%;
    transition: width 0.4s ease;
}

.question-card h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.option-btn {
    background: var(--bg-tertiary);
    border: 2px solid var(--glass-border);
    color: var(--text-primary);
    padding: 1.2rem 1.5rem;
    border-radius: 16px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 1rem;
    text-align: left;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.option-btn:hover:not(.disabled) {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.05);
    transform: translateX(4px);
}

.option-letter {
    width: 30px;
    height: 30px;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    font-size: 0.9rem;
    transition: var(--transition);
}

.option-btn.selected {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
}

.option-btn.selected .option-letter {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.option-btn.correct {
    border-color: var(--success) !important;
    background: rgba(16, 185, 129, 0.1) !important;
}

.option-btn.correct .option-letter {
    background: var(--success) !important;
    color: white;
    border-color: var(--success) !important;
}

.option-btn.incorrect {
    border-color: var(--danger) !important;
    background: rgba(239, 68, 68, 0.1) !important;
}

.option-btn.incorrect .option-letter {
    background: var(--danger) !important;
    color: white;
    border-color: var(--danger) !important;
}

.explanation-panel {
    background: rgba(245, 158, 11, 0.08);
    border-left: 4px solid var(--warning);
    padding: 1.25rem 1.5rem;
    border-radius: 0 16px 16px 0;
    margin-bottom: 2rem;
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.explanation-panel h4 {
    color: var(--warning);
    font-weight: 700;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.explanation-panel p {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.quiz-footer {
    display: flex;
    justify-content: flex-end;
}

.primary-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.9rem 2rem;
    border-radius: 12px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.primary-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.primary-btn:disabled {
    background: var(--text-secondary);
    opacity: 0.5;
    cursor: not-allowed;
}

/* Quiz Score Summary screen */
.results-screen {
    text-align: center;
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.score-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    margin: 0 auto 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--bg-tertiary), rgba(59, 130, 246, 0.1));
    border: 4px solid var(--accent);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.2);
}

.score-num {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
}

.score-total {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 0.25rem;
}

.result-status {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.status-passed {
    color: var(--success);
}

.status-failed {
    color: var(--danger);
}

.result-meta {
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    font-size: 1.05rem;
}

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

.secondary-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    padding: 0.9rem 2rem;
    border-radius: 12px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

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

/* Tab 3: Distance Physics Calculator */
.calc-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 900px) {
    .calc-layout {
        grid-template-columns: 1fr 2fr;
    }
}

.calc-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.speed-slider {
    flex-grow: 1;
    height: 8px;
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
    background: var(--bg-tertiary);
}

.speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: var(--transition);
}

.speed-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.speed-badge {
    background: var(--accent);
    color: white;
    font-weight: 800;
    font-size: 1.5rem;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    min-width: 100px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2);
}

.road-simulation {
    background: #1e293b;
    border: 2px solid var(--glass-border);
    border-radius: 20px;
    height: 200px;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.sky {
    height: 50%;
    background: linear-gradient(to bottom, #1e1b4b, #312e81);
}

.road {
    height: 50%;
    background: #334155;
    position: relative;
    display: flex;
    align-items: center;
}

.road-line {
    width: 100%;
    height: 4px;
    border-top: 4px dashed rgba(255, 255, 255, 0.3);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.animated-car {
    font-size: 2.5rem;
    position: absolute;
    left: 20px;
    top: 25px;
    transform-origin: center;
    transition: left 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.hazard-object {
    font-size: 2.5rem;
    position: absolute;
    right: 40px;
    top: 25px;
}

.brake-mark {
    position: absolute;
    height: 6px;
    background: #0f172a;
    border-radius: 3px;
    top: 55px;
    opacity: 0.6;
    transition: left 0.8s cubic-bezier(0.25, 0.8, 0.25, 1), width 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Distance visual bar chart */
.bar-chart-container {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.bar-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bar-label-info {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 0.95rem;
}

.bar-wrapper {
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--glass-border);
}

.bar-fill {
    height: 100%;
    width: 0%;
    transition: width 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.fill-reaction {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.fill-braking {
    background: linear-gradient(90deg, #ef4444, #b91c1c);
}

.fill-total {
    background: linear-gradient(90deg, var(--accent), #10b981);
}

.bar-text {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 800;
    font-size: 0.85rem;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.physics-info {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.physics-info p {
    margin-bottom: 0.5rem;
}

.physics-info strong {
    color: var(--text-primary);
}

/* Footer layout */
.footer-note {
    text-align: center;
    margin-top: 4rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid var(--glass-border);
    padding-top: 2rem;
}
