/* ════════════════════════════════════════════════════════════════════════
   Prepo.ai — Custom Theme CSS
   W3Schools-style: solid colors, 1px borders, minimal shadows, no glass.
   ════════════════════════════════════════════════════════════════════════ */

/* ── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
}

/* ── Page Transitions ────────────────────────────────────────────────── */
.page {
    animation: fadeIn 0.2s ease-in;
}

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

/* ── Tags / Chips ────────────────────────────────────────────────────── */
.tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    color: #1e5a9e;
    background: #eef6ff;
    border: 1px solid #bfdbfe;
    padding: 3px 10px;
    border-radius: 4px;
}

.chip {
    font-size: 0.75rem;
    font-weight: 500;
    color: #374151;
    background: #f7f8fa;
    border: 1px solid #d1d5db;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chip:hover {
    background: #eef6ff;
    border-color: #93c5fd;
    color: #1e5a9e;
}

/* ── Form Controls ───────────────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 6px;
}

.form-input,
.form-select {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.875rem;
    color: #1f2937;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 9px 12px;
    outline: none;
    transition: border-color 0.15s ease;
    width: 100%;
}

.form-input::placeholder {
    color: #9ca3af;
}

.form-input:focus,
.form-select:focus {
    border-color: #4a8fd4;
    box-shadow: 0 0 0 2px rgba(74, 143, 212, 0.12);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

/* ── Difficulty Buttons ──────────────────────────────────────────────── */
.diff-btn {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 7px 20px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.diff-btn:hover {
    border-color: #4a8fd4;
    color: #2e73b8;
}

.diff-btn.active {
    background: #2e73b8;
    border-color: #2e73b8;
    color: #ffffff;
}

/* ── Spinner ─────────────────────────────────────────────────────────── */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #ebedf0;
    border-top-color: #2e73b8;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ── Question Card ───────────────────────────────────────────────────── */
.question-card {
    border: 1px solid #ebedf0;
    border-radius: 6px;
    background: #ffffff;
    overflow: hidden;
}

.question-card .q-header {
    padding: 12px 20px;
    border-bottom: 1px solid #ebedf0;
    background: #f7f8fa;
    display: flex;
    align-items: center;
    gap: 10px;
}

.question-card .q-number {
    font-size: 0.75rem;
    font-weight: 700;
    color: #2e73b8;
    background: #eef6ff;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    padding: 2px 8px;
    white-space: nowrap;
}

.question-card .q-difficulty {
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: capitalize;
}

.question-card .q-difficulty.easy {
    color: #16a34a;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.question-card .q-difficulty.medium {
    color: #d97706;
    background: #fffbeb;
    border: 1px solid #fde68a;
}

.question-card .q-difficulty.hard {
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.question-card .q-body {
    padding: 16px 20px;
}

.question-card .q-text {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #1f2937;
    margin: 0 0 14px 0;
}

/* ── Option Buttons ──────────────────────────────────────────────────── */
.option-btn {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    text-align: left;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.875rem;
    color: #374151;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 8px;
}

.option-btn:last-child {
    margin-bottom: 0;
}

.option-btn:hover {
    border-color: #4a8fd4;
    background: #eef6ff;
}

.option-btn.selected {
    border-color: #2e73b8;
    background: #eef6ff;
    color: #1e5a9e;
    font-weight: 500;
}

.option-btn .option-letter {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: #f7f8fa;
    border: 1px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #6b7280;
    transition: all 0.15s ease;
}

.option-btn.selected .option-letter {
    background: #2e73b8;
    border-color: #2e73b8;
    color: #ffffff;
}

.option-btn .option-text {
    flex: 1;
    line-height: 1.5;
    padding-top: 1px;
}

/* ── Question Navigator ──────────────────────────────────────────────── */
.nav-btn {
    width: 30px;
    height: 30px;
    font-size: 0.6875rem;
    font-weight: 600;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    border-color: #4a8fd4;
}

.nav-btn.answered {
    background: #2e73b8;
    border-color: #2e73b8;
    color: #ffffff;
}

/* ── Results Cards ───────────────────────────────────────────────────── */
.result-card {
    border: 1px solid #ebedf0;
    border-radius: 6px;
    background: #ffffff;
    overflow: hidden;
}

.result-card.correct {
    border-left: 4px solid #16a34a;
}

.result-card.incorrect {
    border-left: 4px solid #dc2626;
}

.result-card .r-header {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}

.result-card .r-header:hover {
    background: #f7f8fa;
}

.result-card .r-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.result-card .r-status {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 4px;
}

.result-card.correct .r-status {
    color: #16a34a;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.result-card.incorrect .r-status {
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.result-card .r-question-preview {
    font-size: 0.875rem;
    color: #374151;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-card .r-toggle {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-left: 12px;
    transition: transform 0.2s ease;
}

.result-card .r-toggle.open {
    transform: rotate(180deg);
}

.result-card .r-body {
    display: none;
    padding: 0 20px 16px 20px;
    border-top: 1px solid #ebedf0;
}

.result-card .r-body.open {
    display: block;
}

/* ── Explanation Block ───────────────────────────────────────────────── */
.explanation-section {
    margin-top: 14px;
}

.explanation-section h4 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    margin: 14px 0 6px 0;
}

.explanation-section h4:first-child {
    margin-top: 0;
}

.explanation-section p {
    font-size: 0.8625rem;
    line-height: 1.7;
    color: #374151;
    margin: 0;
    padding: 8px 12px;
    background: #f7f8fa;
    border: 1px solid #ebedf0;
    border-radius: 4px;
}

/* Result answer indicators */
.result-answer-row {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.result-answer-badge {
    font-size: 0.8125rem;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 500;
}

.result-answer-badge.your-answer {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.result-answer-badge.your-answer.was-correct {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
}

.result-answer-badge.correct-answer {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
}

/* ── Score Colors ────────────────────────────────────────────────────── */
.score-excellent { color: #16a34a; }
.score-good      { color: #2e73b8; }
.score-average   { color: #d97706; }
.score-poor      { color: #dc2626; }

/* ── Responsive & Mobile Enhancements ────────────────────────────────── */
.option-btn .option-text {
    flex: 1;
    line-height: 1.5;
    padding-top: 1px;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.question-card .q-text {
    word-break: break-word;
    overflow-wrap: anywhere;
}

@media (max-width: 640px) {
    .question-card .q-header {
        padding: 10px 12px;
    }

    .question-card .q-body {
        padding: 12px;
    }

    .option-btn {
        padding: 9px 12px;
        gap: 8px;
    }

    .nav-btn {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }

    .result-card .r-header {
        padding: 10px 12px;
    }

    .result-card .r-header-left {
        gap: 8px;
    }

    .result-card .r-body {
        padding: 0 12px 12px 12px;
    }

    .result-answer-row {
        flex-direction: column;
        gap: 6px;
    }
}

/* ── Auth Pages ──────────────────────────────────────────────────────── */
.auth-card {
    max-width: 420px;
    margin: 0 auto;
    border: 1px solid #ebedf0;
    border-radius: 6px;
    background: #ffffff;
    overflow: hidden;
}

.auth-card .auth-header {
    padding: 24px 28px 0;
    text-align: center;
}

.auth-card .auth-header h1 {
    font-size: 1.375rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 4px 0;
}

.auth-card .auth-header p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.auth-card .auth-body {
    padding: 24px 28px 28px;
}

.auth-card .auth-body .form-group + .form-group {
    margin-top: 16px;
}

.auth-error {
    font-size: 0.8125rem;
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 16px;
}

.auth-success {
    font-size: 0.8125rem;
    color: #16a34a;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 16px;
}

.auth-footer {
    padding: 16px 28px;
    border-top: 1px solid #ebedf0;
    background: #f7f8fa;
    text-align: center;
    font-size: 0.8125rem;
    color: #6b7280;
}

.auth-footer a {
    color: #2e73b8;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s ease;
}

.auth-footer a:hover {
    color: #1e5a9e;
}

/* ── Navbar User Info ────────────────────────────────────────────────── */
.nav-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-user-email {
    font-size: 0.75rem;
    color: #374151;
    font-weight: 500;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-signout-btn {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    background: #f7f8fa;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nav-signout-btn:hover {
    color: #dc2626;
    border-color: #fecaca;
    background: #fef2f2;
}

.nav-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2e73b8;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ── Password Toggle ─────────────────────────────────────────────────── */
.password-wrapper {
    position: relative;
}

.password-wrapper .form-input {
    padding-right: 40px;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 0.8125rem;
    padding: 2px 4px;
    transition: color 0.15s ease;
}

.password-toggle:hover {
    color: #374151;
}

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