* {
    box-sizing: border-box;
}

body {
    font-family: sans-serif;
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
    line-height: 1.6;
}

h1,
h2 {
    color: #333;
}

.hidden {
    display: none;
}

.card {
    border: 1px solid #ddd;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

select,
button,
input,
textarea {
    font-size: 1rem;
    padding: 0.5rem;
    margin-top: 0.5rem;
}

select {
    width: 100%;
}

button {
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.75rem 1.5rem;
}

button:hover {
    background-color: #0056b3;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.question {
    margin-bottom: 1.5rem;
}

.question label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.options label {
    display: block;
    font-weight: normal;
    margin-bottom: 0.25rem;
    cursor: pointer;
}

.options input {
    cursor: pointer;
}

textarea {
    width: 100%;
    height: 100px;
}

.msg {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 4px;
}

.msg.error {
    background: #f8d7da;
    color: #721c24;
}

.msg.warning {
    background: #fff3cd;
    color: #856404;
}

.msg.info {
    background: #d1ecf1;
    color: #0c5460;
}

.result-item {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.result-item .question-text {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.result-item .answer-row {
    margin: 0.5rem 0;
    padding: 0.5rem;
    border-radius: 4px;
}

.result-item .answer-row.correct {
    background: #d4edda;
    color: #155724;
}

.result-item .answer-row.incorrect {
    background: #f8d7da;
    color: #721c24;
}

.result-item .label {
    font-weight: bold;
    margin-right: 0.5rem;
}

.result-item .correct-indicator {
    float: right;
    font-weight: bold;
}

.quiz-card {
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.quiz-card:hover {
    border-color: #007bff;
    background: #f8f9fa;
}

.quiz-card.selected {
    border-color: #007bff;
    background: #e7f1ff;
}

.quiz-card h3 {
    margin: 0;
}

.step-indicator {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6c757d;
}

.step.active {
    color: #007bff;
    font-weight: bold;
}

.step.completed {
    color: #28a745;
}

.step-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.step.active .step-number {
    background: #007bff;
    color: white;
}

.step.completed .step-number {
    background: #28a745;
    color: white;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

/* Code block styling */
.question-text-content pre {
    background: #f6f8fa;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.question-text-content code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
}

.question-text-content p code {
    background: #f0f0f0;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
}

.question-text-content pre code {
    background: none;
    padding: 0;
}

/* Timer Bar */
.timer-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    /* Use right: 0 instead of width: 100% to avoid scrollbar */
    background: #333;
    color: white;
    padding: 1rem;
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    z-index: 1000;
    display: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.timer-bar.warning {
    background: #ffc107;
    color: #333;
}

.timer-bar.danger {
    background: #dc3545;
    color: white;
}

body {
    margin-top: 2rem;
}

/* Default margin */
body.has-timer {
    margin-top: 5rem;
}

/* Push content down when timer is shown */

/* Progress Bar */
.progress-container {
    position: sticky;
    top: 0;
    z-index: 900;
    background: white;
    padding: 1rem 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 1rem;
}

body.has-timer .progress-container {
    top: 60px;
    /* Adjust based on timer height approx */
}

.progress-track {
    background-color: #e9ecef;
    border-radius: 4px;
    height: 10px;
    width: 100%;
    overflow: hidden;
}

.progress-fill {
    background-color: #28a745;
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    display: block;
    text-align: right;
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Confidence Rating */
.confidence-rating-card {
    text-align: center;
    max-width: 500px;
    margin: 2rem auto;
}

.confidence-rating-card h2 {
    margin-bottom: 0.5rem;
}

.confidence-subtitle {
    color: #6c757d;
    margin-bottom: 1.5rem;
}

.confidence-buttons {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: nowrap;
}

.confidence-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1rem;
    min-width: 65px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 12px;
    color: #495057;
    transition: all 0.2s ease;
}

.confidence-btn:hover {
    background: #e7f1ff;
    border-color: #007bff;
    transform: translateY(-2px);
}

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

.rating-number {
    font-size: 1.5rem;
    font-weight: bold;
    display: block;
    margin-bottom: 0.25rem;
}

.rating-label {
    font-size: 0.75rem;
    color: #6c757d;
}

.confidence-btn:hover .rating-number {
    color: #007bff;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}