/* ========================================
   Quiz Blazor Pages - Styles
   ======================================== */

/* --- Quiz Subjects Page --- */
.quiz-subjects-container {
    max-width: 900px;
    margin: 15px auto;
    padding: 20px;
    width: 100%;
}

/* --- Quiz Chapters Page --- */
.quiz-chapters-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

.chapters-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 15px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chapters-header-row h3 {
    margin: 0;
    color: var(--primary);
    font-weight: 800;
    font-size: 1.2rem;
}

.timer-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.timer-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    transition: 0.3s;
}

.toggle-switch-main {
    position: relative;
    width: 46px;
    height: 24px;
    background: #222;
    border-radius: 20px;
    transition: 0.3s;
    border: 1px solid #444;
}

.toggle-switch-main::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.timer-active .toggle-switch-main {
    background: rgba(0, 242, 255, 0.2);
    border-color: var(--primary);
}

.timer-active .toggle-switch-main::after {
    left: 24px;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

.timer-active .timer-label {
    color: var(--primary);
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.4);
}

.chapters-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
    margin: 0 auto 80px auto;
}

@media (min-width: 600px) {
    .chapters-list {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    .comprehensive-card,
    .custom-select-card {
        grid-column: 1 / -1;
    }
}

.chapter-card {
    width: 100%;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 4px solid var(--primary);
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    padding: 18px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.chapter-card:hover {
    transform: translateY(-3px) scale(1.01);
    background: rgba(30, 41, 59, 0.9);
    border-color: var(--primary);
    box-shadow: 0 10px 20px rgba(0, 242, 255, 0.15);
}

.chapter-title {
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    flex: 1;
    margin: 0 15px;
    line-height: 1.4;
}

.chapter-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 12px;
    border-radius: 20px;
    font-family: 'Fira Code';
    white-space: nowrap;
}

.comprehensive-card {
    border-right: none;
    border: 1px solid var(--accent);
    background: linear-gradient(135deg, rgba(189, 0, 255, 0.1) 0%, rgba(30, 41, 59, 0.8) 100%);
    margin-bottom: 5px;
}

.custom-select-card {
    border-right: none;
    border: 1px solid var(--star-color);
    background: rgba(255, 184, 0, 0.05);
    margin-bottom: 15px;
}

/* --- Config Modal --- */
.config-title {
    margin-bottom: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.mode-toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
}

.mode-toggle-switch {
    width: 40px;
    height: 22px;
    background: var(--primary);
    border-radius: 20px;
    position: relative;
    transition: 0.3s;
}

.mode-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 22px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.mode-toggle-wrapper.normal-mode .mode-toggle-switch {
    background: #333;
}

.mode-toggle-wrapper.normal-mode .mode-toggle-switch::after {
    left: 2px;
}

.config-group {
    margin-bottom: 25px;
}

.modal-timer-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
}

.modal-timer-toggle.active {
    border-color: var(--timer-color);
    background: rgba(255, 159, 67, 0.05);
}

.toggle-switch-modal {
    width: 40px;
    height: 22px;
    background: #333;
    border-radius: 20px;
    position: relative;
    transition: 0.3s;
}

.toggle-switch-modal::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.modal-timer-toggle.active .toggle-switch-modal {
    background: var(--timer-color);
}

.modal-timer-toggle.active .toggle-switch-modal::after {
    left: 20px;
}

.chapter-select-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    text-align: center;
}

.chapter-checkbox-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px;
    margin-right: 10px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: 0.2s;
}

.chapter-checkbox-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
}

.chapter-checkbox-card.selected {
    border-color: var(--primary);
    background: rgba(0, 242, 255, 0.05);
}

.chk-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 12px;
    color: transparent;
}

.chk-circle::before {
    content: "\f00c";
}

.chapter-checkbox-card.selected .chk-circle {
    border-color: var(--primary);
    background: var(--primary);
    color: #000;
}

/* --- Quiz Play Page --- */
.quiz-play-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px 80px;
    width: 100%;
}

.quiz-top-bar {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    padding: 10px 15px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 25px;
    position: sticky;
    top: 10px;
    z-index: 900;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quiz-top-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.quiz-timer {
    font-family: 'Fira Code', monospace;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--timer-color);
    background: rgba(255, 159, 67, 0.1);
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 159, 67, 0.3);
    animation: pulse-timer 2s infinite;
}

@keyframes pulse-timer {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 1; }
}

.quiz-live-score {
    font-family: 'Fira Code';
    font-size: 0.9rem;
}

.quiz-palette-wrapper {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    padding: 5px 0;
    scrollbar-width: block;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.quiz-palette-strip {
    display: inline-flex;
    gap: 8px;
    padding: 0 5px;
}

.mini-q-num {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fira Code';
    font-size: 0.85rem;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: 0.2s;
    flex-shrink: 0;
}

.mini-q-num.active {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
    font-weight: 700;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 242, 255, 0.3);
}

.mini-q-num.answered {
    border-color: var(--correct);
    color: var(--correct);
    background: rgba(0, 230, 118, 0.1);
}

.mini-q-num.flagged {
    border-color: var(--wrong) !important;
    color: var(--wrong) !important;
}

.mini-q-num.answered.flagged {
    background: rgba(0, 230, 118, 0.15) !important;
    border: 2px solid var(--wrong) !important;
    color: var(--correct) !important;
}

.mini-q-num.active.answered {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
}

.progress-wrapper {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.quiz-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.5s ease;
}

.quiz-graph-outer {
    margin-bottom: 15px;
}

.quiz-graph-wrapper {
    background: rgba(255, 250, 240, 0.9);
    backdrop-filter: blur(5px);
    border-radius: 12px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.quiz-question-text {
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 30px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.quiz-hint-box {
    display: block;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    font-size: 0.95rem;
    line-height: 1.6;
    width: 100%;
    background: rgba(255, 184, 0, 0.1);
    border-left: 4px solid var(--star-color);
    color: #fff;
}

.quiz-explanation-box {
    display: block;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    font-size: 0.95rem;
    line-height: 1.6;
    width: 100%;
    background: rgba(189, 0, 255, 0.1);
    border: 1px solid var(--accent);
    color: #fff;
    position: relative;
}

.quiz-show-exp-btn {
    display: block;
    width: 100%;
    padding: 15px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 20px;
}

.quiz-next-btn {
    display: block;
    width: 100%;
    padding: 15px;
    background: var(--primary);
    color: #000;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 900;
    margin-top: 20px;
    font-size: 1.1rem;
    margin-bottom: 60px;
}

.quiz-exam-controls {
    display: flex;
    gap: 10px;
    margin-top: 40px;
}

.quiz-submit-exam-btn {
    display: block;
    width: 100%;
    padding: 15px;
    background: var(--wrong);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 900;
    margin-top: 20px;
    font-size: 1.1rem;
    margin-bottom: 60px;
}

.quiz-options-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    width: 100%;
}

@media (min-width: 600px) {
    .quiz-options-container {
        grid-template-columns: 1fr 1fr;
    }
}

.quiz-option-btn {
    width: 100%;
    height: 100%;
    background: var(--bg-card);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    cursor: pointer;
    transition: 0.2s;
    border-radius: 15px;
    padding: 20px;
    font-weight: 600;
    font-size: 1.1rem;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
}

.quiz-option-btn:hover {
    border-color: var(--primary);
    background: rgba(0, 242, 255, 0.05);
    transform: translateY(-2px);
}

.quiz-option-btn.correct {
    background: rgba(0, 230, 118, 0.2) !important;
    border-color: var(--correct) !important;
    color: var(--correct) !important;
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.2);
}

.quiz-option-btn.wrong {
    background: rgba(255, 23, 68, 0.2) !important;
    border-color: var(--wrong) !important;
    color: var(--wrong) !important;
    opacity: 0.6;
}

.quiz-correct-answer-box {
    margin-top: 12px;
    padding: 10px 15px;
    background: rgba(0, 230, 118, 0.1);
    border: 1px solid rgba(0, 230, 118, 0.3);
    border-radius: 8px;
    color: var(--correct);
    font-size: 0.95rem;
}

.quiz-option-btn:disabled {
    cursor: default;
    transform: none !important;
}

.quiz-option-btn.selected {
    border-color: var(--primary);
    background: rgba(0, 242, 255, 0.15);
    color: #fff;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.2);
}

.opt-mini-graph {
    width: 100%;
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 5px;
    overflow: hidden;
}

.opt-mini-graph svg,
.opt-mini-graph img {
    max-width: 100% !important;
    max-height: 130px !important;
    object-fit: contain;
}

/* --- Mac Code Window --- */
.quiz-mac-code-window {
    background: #282a36;
    border-radius: 10px;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    direction: ltr;
    text-align: left;
}

.mac-header {
    background: #1e1e1e;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mac-dots {
    display: flex;
    gap: 8px;
}

.mac-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.mac-dot.red { background: #ff5f56; }
.mac-dot.yellow { background: #ffbd2e; }
.mac-dot.green { background: #27c93f; }

.mac-copy-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    padding: 4px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.mac-copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.quiz-mac-code-window pre[class*="language-"] {
    margin: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    font-size: 15px !important;
    padding: 1em 1em 1em 3.8em !important;
}

/* --- Quiz Result Page --- */
.quiz-result-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

.result-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 20px;
    border: 1px solid var(--primary);
    text-align: center;
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
    box-shadow: 0 0 30px rgba(0, 242, 255, 0.05);
}

.result-card h1 {
    font-size: 1.5rem;
    margin: 0 0 10px 0;
}

.result-score {
    font-size: 4rem;
    font-weight: 900;
    color: var(--primary);
    margin: 20px 0;
    line-height: 1;
}

.quiz-filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding: 10px 5px;
    position: sticky;
    top: 10px;
    z-index: 100;
    background: transparent;
    border-radius: 0 0 15px 15px;
}

.quiz-filter-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: 0.3s;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
}

.quiz-filter-btn.active {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
    box-shadow: 0 2px 10px rgba(0, 242, 255, 0.15);
}

.quiz-review-list {
    margin-top: 15px;
}

.quiz-review-item {
    background: rgba(255, 255, 255, 0.03);
    border-left: 4px solid var(--text-secondary);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    text-align: left;
    scroll-margin-top: 150px;
}

.quiz-review-item.r-correct {
    border-left-color: var(--correct);
    background: rgba(0, 230, 118, 0.05);
}

.quiz-review-item.r-wrong {
    border-left-color: var(--wrong);
    background: rgba(255, 23, 68, 0.05);
}

.quiz-review-item.r-noans {
    border-left-color: var(--star-color);
    background: rgba(255, 184, 0, 0.05);
}

.ctrl-btn {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-family: 'Fira Code', monospace;
}

.function-plot .grid line {
    stroke: rgba(0, 0, 0, 0.15) !important;
}

.function-plot .domain {
    stroke: #333 !important;
    stroke-width: 2px !important;
}

.function-plot .tick text {
    fill: #444 !important;
    font-weight: bold;
}

/* ========================================
   Modal Styles (generic - matching original)
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 11, 20, 0.85);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.2s;
}

.modal-overlay.active-modal {
    display: flex;
    opacity: 1;
}

.modal-box {
    background: var(--bg-modal);
    padding: 25px 25px 0 25px;
    border-radius: 20px;
    border: 1px solid var(--primary);
    width: 90%;
    max-width: 400px;
    text-align: center;
    max-height: 85vh;
    height: auto;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.2s ease-out;
    overflow: hidden;
}

.modal-overlay.active-modal .modal-box {
    transform: scale(1);
    opacity: 1;
}

.modal-content-scrollable {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
    margin-top: 15px;
    min-height: 0;
    scrollbar-width: auto;
    -ms-overflow-style: auto;
}

.modal-footer {
    position: relative;
    flex-shrink: 0;
    background: rgba(10, 17, 30, 0.95);
    backdrop-filter: blur(5px);
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0 -25px;
    display: flex;
    gap: 10px;
}

.config-modal-box {
    max-width: 420px;
}

.exam-mode-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.exam-mode-label {
    font-weight: 700;
    color: var(--wrong);
    font-size: 0.95rem;
}

.custom-time-input {
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--text-secondary);
    color: #fff;
    border-radius: 8px;
    margin-top: 5px;
    font-family: 'Fira Code';
    text-align: center;
    display: none;
}

.btn-small {
    padding: 4px 10px;
    font-size: 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    margin-left: 10px;
}

.btn-small.active {
    background: var(--primary);
    color: #000;
}

.quiz-option-btn img {
    max-width: 100%;
    max-height: 140px;
    object-fit: contain;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px;
}

.quiz-review-item.hidden {
    display: none !important;
}

.quiz-filter-tabs {
    top: 70px;
}

#quiz-main-graph text,
.quiz-review-list text {
    fill: #3a3a3a !important;
    font-size: 13px !important;
    font-family: 'Fira Code', monospace !important;
    font-weight: 700 !important;
}

#quiz-main-graph .axis path,
#quiz-main-graph .axis line,
.quiz-review-list .axis path,
.quiz-review-list .axis line {
    fill: none;
    stroke: #333 !important;
    stroke-width: 1.5px;
    shape-rendering: crispEdges;
}
