/* Quiz Runner Core Styles */
:root {
    --primary: #007bff;
    --primary-dark: #0056b3;
    --secondary: #6c757d;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #343a40;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --border-color: #dee2e6;
}

[data-theme="dark"] {
    --primary: #0d6efd;
    --primary-dark: #0143a3;
    --secondary: #6c757d;
    --success: #198754;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #0dcaf0;
    --light: #f8f9fa;
    --dark: #212529;
    --text-primary: #f8f9fa;
    --text-secondary: #adb5bd;
    --bg-primary: #212529;
    --bg-secondary: #343a40;
    --border-color: #495057;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

/* Common Components */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    cursor: pointer;
    background-color: var(--secondary);
    color: white;
    transition: background-color 0.15s ease-in-out;
}

.btn:hover {
    background-color: var(--primary-dark);
}

.btn-primary {
    background-color: var(--primary);
}

.btn-secondary {
    background-color: var(--secondary);
}

.btn-success {
    background-color: var(--success);
}

.btn-danger {
    background-color: var(--danger);
}

.card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hidden {
    display: none !important;
}

/* Quiz Header */
.quiz-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 1000;
}

.quiz-title {
    font-size: 1.25rem;
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#timer {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
}

/* Section Navigation */
.section-bar {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    z-index: 900;
}

.section-tabs {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    overflow-x: auto;
}

.section-tabs li {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
}

.section-tabs li.active {
    border-bottom-color: var(--primary);
    color: var(--primary);
}

/* Quiz Main Content */
.quiz-main {
    margin-top: 120px;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.question-panel {
    padding: 2rem;
}

#question-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.options-container {
    margin: 2rem 0;
}

.option {
    padding: 1rem;
    margin: 0.5rem 0;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    cursor: pointer;
}

.option:hover {
    background-color: var(--bg-secondary);
}

.option.selected {
    border-color: var(--primary);
    background-color: rgba(0,123,255,0.1);
}

.action-bar {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
}

/* Question Palette */
.palette-panel {
    padding: 1.5rem;
    position: sticky;
    top: 120px;
    height: calc(100vh - 150px);
    overflow-y: auto;
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.palette-item {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.palette-item.answered {
    background-color: var(--success);
    color: white;
}

.palette-item.marked {
    background-color: var(--warning);
    color: var(--dark);
}

/* Submit Summary Screen */
.submit-summary-box {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    text-align: center;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-item .label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat-item .count {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
}

/* Result Screen */
.result-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.result-section {
    margin-bottom: 3rem;
}

.section-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.analysis-card {
    padding: 1.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .quiz-main {
        grid-template-columns: 1fr;
    }

    .palette-panel {
        position: fixed;
        top: 0;
        right: -300px;
        bottom: 0;
        width: 300px;
        transition: right 0.3s ease;
        z-index: 1100;
    }

    .palette-panel.visible {
        right: 0;
    }

    .palette-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0,0,0,0.5);
        z-index: 1050;
    }

    .palette-overlay.visible {
        display: block;
    }
}
