/**
 * Blue Book Exams - Main Styles
 */

/* Reset and base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.container.centered {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

/* Card */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 2rem;
    width: 100%;
    max-width: 500px;
}

.card h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.subtitle {
    color: var(--text-light);
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Form elements */
.form-group {
    margin-bottom: 1rem;
}

input[type="text"],
input[type="password"],
select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

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

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
}

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

.btn-secondary:hover:not(:disabled) {
    background-color: #475569;
}

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

.btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
}

.btn-large {
    width: 100%;
    padding: 1rem;
    font-size: 1.125rem;
}

/* Error message */
.error-message {
    background-color: #fef2f2;
    color: var(--danger);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    text-align: center;
}

/* Warning box */
.warning-box {
    background-color: #fffbeb;
    border: 1px solid #fbbf24;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.warning-box strong {
    color: #b45309;
}

.warning-box ul {
    margin: 0.5rem 0 0 1.5rem;
    color: #92400e;
}

.warning-box p {
    margin-top: 0.5rem;
    color: #92400e;
    font-weight: 500;
}

/* Status indicators */
.status-indicator {
    text-align: center;
    padding: 2rem;
}

.status-indicator.waiting {
    color: var(--secondary);
}

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

.success-text {
    font-size: 1.25rem;
    font-weight: 600;
}

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Hidden */
.hidden {
    display: none !important;
}

/* Results page */
.results-card {
    max-width: 600px;
}

.submission-reason {
    text-align: center;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.submission-reason.normal {
    background-color: #f0fdf4;
    color: var(--success);
}

.submission-reason.violation {
    background-color: #fef2f2;
    color: var(--danger);
}

.score-display {
    text-align: center;
    margin: 2rem 0;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    margin: 0 auto 1rem;
}

.done-message {
    text-align: center;
    color: var(--text-light);
    margin-top: 2rem;
}

/* Review section */
.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.review-timer {
    background-color: var(--warning);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

.review-question {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.review-question.correct {
    border-left: 4px solid var(--success);
}

.review-question.incorrect {
    border-left: 4px solid var(--danger);
}

.result-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.result-badge.correct {
    background-color: #dcfce7;
    color: #166534;
}

.result-badge.incorrect {
    background-color: #fee2e2;
    color: #991b1b;
}

.review-choice {
    padding: 0.5rem;
    margin: 0.25rem 0;
    border-radius: 4px;
    background-color: var(--background);
}

.review-choice.correct-answer {
    background-color: #dcfce7;
}

.review-choice.wrong-selection {
    background-color: #fee2e2;
}

.review-choice.correct-selection {
    background-color: #dcfce7;
    border: 2px solid var(--success);
}

/* Timer */
.timer {
    font-size: 1.5rem;
    font-weight: bold;
    font-family: monospace;
    padding: 0.5rem 1rem;
    background-color: var(--background);
    border-radius: 8px;
}

.timer.warning {
    background-color: #fef3c7;
    color: #b45309;
}

.timer.danger {
    background-color: #fee2e2;
    color: var(--danger);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow);
}

.modal-content h2 {
    margin-bottom: 1rem;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-buttons .btn {
    flex: 1;
}

.warning-text {
    color: var(--warning);
    font-weight: 500;
    margin-top: 0.5rem;
}

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

    .card {
        padding: 1.5rem;
    }

    .btn-large {
        padding: 0.875rem;
    }
}
