/* Premium Redesign for Test Page (Stitch-inspired layout) */
@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;500;700&display=swap');

.practice-scholastic-wrap {
    font-family: 'Ubuntu', sans-serif;
    background: #f8fafc;
    border-radius: 15px;
    padding: .5rem .5rem;
    box-shadow: inset 0 2px 20px rgba(0,0,0,0.02);
    margin-bottom: 1rem;
}

/* Intro Card */
.practice-test-intro-card {
    background: #ffffff;
    border-radius: 32px;
    padding: 2rem 3rem;
    box-shadow: 0 20px 50px -15px rgba(79, 70, 229, 0.1);
    max-width: 680px;
    margin: 0 auto;
    text-align: center;
    border: 1px solid rgba(229, 231, 235, 0.4);
    position: relative;
    overflow: hidden;
}

.practice-test-intro-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(79,70,229,0.03) 0%, transparent 50%);
    animation: drift 20s linear infinite;
    z-index: 0;
}

@keyframes drift {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.practice-test-intro-card > * {
    position: relative;
    z-index: 1;
}

.practice-test-intro-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #e0e7ff 0%, #fce7f3 100%);
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    color: #4f46e5;
    margin: 0 auto 2.5rem;
    box-shadow: 0 15px 30px rgba(79, 70, 229, 0.15);
    transform: rotate(-5deg);
}

.practice-test-intro-img-wrap {
    max-width: 300px;
    height: 300px;
    margin: 0 auto 2.5rem;
    border-radius: 28px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.practice-test-intro-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1f2937;
    margin-bottom: 1.25rem;
    letter-spacing: -0.5px;
}

.practice-test-intro-desc {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #64748b;
    margin-bottom: 2rem;
}

.practice-test-intro-meta {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.practice-test-intro-meta-item {
    background: #f1f5f9;
    padding: 0.6rem 1.2rem;
    border-radius: 100px;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.practice-test-intro-meta-item i {
    color: #4f46e5;
    font-size: 1.1rem;
}

.practice-test-start-btn {
    padding: 1.25rem 3.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff !important;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    border: none;
    border-radius: 100px;
    box-shadow: 0 12px 30px rgba(79, 70, 229, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

.practice-test-start-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 35px rgba(79, 70, 229, 0.4);
}

/* Palette Card (Left Sidebar) */
.practice-palette-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
    border: 1px solid rgba(229, 231, 235, 0.5);
    position: sticky;
    top: 100px;
}

@media (max-width: 991px) {
    .practice-palette-card {
        position: static;
        margin-top: 1rem;
    }
    /* Tablet: keep scroll for medium screens if needed */
    .practice-palette-grid {
        grid-template-columns: repeat(6, 1fr);
        max-height: 200px;
        overflow-y: auto;
    }
}

/* Mobile: palette extends with all questions, no scroll inside card */
@media (max-width: 768px) {
    .practice-palette-card {
        padding: 1rem 0.75rem;
        overflow: visible;
    }
    .practice-palette-title {
        font-size: 1rem;
        margin-bottom: 0.75rem;
        padding-bottom: 0.5rem;
    }
    .practice-palette-grid {
        grid-template-columns: repeat(10, 1fr);
        grid-auto-rows: 52px;
        gap: 0.3rem;
        max-height: none;
        overflow: visible;
        padding: 0.5rem 0;
        margin-bottom: 1rem;
    }
    .practice-palette-btn {
        width: 46px !important;
        height: 46px !important;
        min-width: 46px !important;
        min-height: 46px !important;
        max-width: 46px !important;
        max-height: 46px !important;
        padding: 0 !important;
        margin: 0 auto;
        font-size: 0.9rem;
        box-sizing: border-box;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        align-self: center;
        justify-self: center;
    }
    .practice-palette-btn.practice-palette-current {
        transform: none;
    }
    .practice-palette-legend {
        margin-top: 0.75rem;
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .practice-palette-card {
        padding: 0.75rem 0.6rem;
    }
    .practice-palette-grid {
        grid-template-columns: repeat(10, 1fr);
        grid-auto-rows: 48px;
        gap: 0.25rem;
        padding: 0.5rem 0;
    }
    .practice-palette-btn {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
        max-width: 48px !important;
        max-height: 48px !important;
        padding: 0 !important;
        font-size: 0.85rem;
        flex-shrink: 0;
        align-self: center;
        justify-self: center;
    }
}

.practice-palette-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: #1f2937;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid #f8fafc;
    padding-bottom: 1rem;
    text-transform: none;
    letter-spacing: 0;
}

.practice-palette-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.practice-palette-btn {
    width: 100%;
    aspect-ratio: 1;
    max-width: none;
    max-height: none;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.95rem;
    border: 2px solid #e2e8f0;
    background: #ffffff;
    color: #64748b;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}

.practice-palette-btn:hover {
    border-color: #cbd5e1;
    transform: scale(1.05);
}

.practice-palette-btn.practice-palette-current {
    border-color: #4f46e5;
    background: #e0e7ff;
    color: #4f46e5;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    transform: scale(1.1);
}

.practice-palette-btn.practice-palette-answered {
    border-color: #10b981;
    background: #10b981;
    color: #ffffff;
}

.practice-palette-btn.practice-palette-marked {
    border-color: #f59e0b;
    background: #fef3c7;
    color: #d97706;
}

.practice-palette-legend {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 16px;
    margin-top: 0;
    border-top: none;
    margin-bottom: 1rem;
}

.practice-palette-legend-item {
    font-weight: 600;
    color: #475569;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.practice-palette-legend-swatch {
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: inline-block;
    margin-right: 0.5rem;
    vertical-align: middle;
    flex-shrink: 0;
}

.practice-palette-legend-swatch.practice-palette-legend-answered {
    background: #10b981;
    border: 1px solid #059669;
}

.practice-palette-legend-swatch.practice-palette-legend-not-visited {
    background: #ffffff;
    border: 2px solid #e2e8f0;
}

.practice-palette-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.practice-palette-util-btn {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-weight: 600;
    padding: 0.75rem;
    border-radius: 12px;
    transition: all 0.2s;
}

.practice-palette-util-btn:hover:not(:disabled) {
    background: #f8fafc;
    color: #334155;
    border-color: #cbd5e1;
}

/* Back to List link (icon only) */
.practice-back-to-list {
    color: #4f46e5;
    font-size: 1.25rem;
    padding: 0.25rem;
    transition: color 0.2s ease;
}
.practice-back-to-list:hover {
    color: #4338ca;
}

/* Timer card (above question palette) */
.practice-timer-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    box-shadow: 0 8px 25px rgba(0,0,0,0.03);
    border: 1px solid rgba(229, 231, 235, 0.5);
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: center;
}

/* Middle Content Area */
.practice-center {
    padding: 0 0.5rem;
}

.practice-scholastic-topbar {
    /* Container only. Title + timer are separate cards. */
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    border: none;
    margin-bottom: 0.75rem;
    gap: 0.75rem;
}

.practice-scholastic-topbar-left {
    background: #ffffff;
    border-radius: 10px;
    padding: .5rem .5rem;
    box-shadow: 0 8px 25px rgba(0,0,0,0.03);
    border: 1px solid rgba(229, 231, 235, 0.5);
    flex: 1 1 auto;
    min-width: 0;
}

.practice-scholastic-topbar-right {
    background: #ffffff;
    border-radius: 20px;
    padding: 0.55rem 0.75rem;
    box-shadow: 0 8px 25px rgba(0,0,0,0.03);
    border: 1px solid rgba(229, 231, 235, 0.5);
    flex: 0 0 auto;
}

.practice-scholastic-brand {
    font-size: 1rem;
    color: #4f46e5;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.practice-scholastic-paper {
    font-size: 1.5rem;
    color: #4f46e5;
    font-weight: 700;
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 576px) {
    /* On mobile, show the full quiz title (no truncation) */
    .practice-scholastic-topbar-left {
        flex-wrap: nowrap;
        align-items: flex-start;
    }
    .practice-scholastic-paper {
        flex: 1 1 auto;
        min-width: 0;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        word-break: break-word;
    }
}

@media (max-width: 576px) {
    /* Mobile: reduce padding for question + options only */
    .practice-question-card {
        padding: 1rem 1rem;
    }
    .practice-question-text {
        font-size: 1.15rem;
        margin-bottom: 1rem;
    }
    .practice-question-diagram-wrap {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }
    .practice-options {
        gap: 0.6rem;
    }
    .practice-option-label {
        padding: 0.75rem 0.9rem;
    }
    .practice-option-letter {
        width: 32px;
        height: 32px;
        margin-right: 0.85rem;
    }
    .practice-option-text {
        font-size: 1.05rem;
    }
}

.practice-scholastic-timer {
    background: transparent;
    color: #dc2626;
    padding: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
    font-weight: 900;
    font-size: 1.35rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.14em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    flex: 0 0 auto;
}

.practice-scholastic-finish-btn {
    background: #f1f5f9;
    color: #334155 !important;
    border-radius: 100px;
    padding: 0.4rem 1.25rem;
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    transition: all 0.2s;
}

.practice-scholastic-finish-btn:hover {
    background: #e2e8f0;
}

/* Question Slides */
.practice-question-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 1rem 1rem;
    box-shadow: 0 12px 35px rgba(0,0,0,0.03);
    border: 1px solid rgba(229, 231, 235, 0.5);
    margin-bottom: 1rem;
    animation: slideIn 0.4s ease-out forwards;
}

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

.practice-question-subbar {
    border-bottom: 2px solid #f8fafc;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.practice-question-subbar-left {
    font-size: 1.2rem;
    color: #475569;
    font-weight: 800;
}

.practice-question-marks-plus {
    background: #ecfdf5;
    color: #059669;
    font-size: 0.95rem;
    padding: 0.35rem 0.85rem;
    border-radius: 100px;
    font-weight: 800;
}

.practice-question-text {
    font-size: 1.4rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.7;
    margin-bottom: 1.25rem;
}

.practice-question-diagram-wrap {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1.25rem;
}

/* Options */
.practice-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.practice-option-label {
    display: flex;
    align-items: center;
    padding: 0.9rem 1.25rem;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: #ffffff;
    position: relative;
}

.practice-option-label:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    transform: translateX(4px);
}

.practice-option-label input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.practice-option-letter {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #f1f5f9;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.05rem;
    margin-right: 1.25rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.practice-option-text {
    flex: 1;
    min-width: 0;
    font-size: 1.2rem;
    color: #334155;
    font-weight: 500;
    line-height: 1.5;
    overflow-wrap: break-word;
    word-break: break-all;
}

/* Selected state using modern :has() - blue border, no selected tag */
.practice-option-label.selected,
.practice-option-label:has(input[type="radio"]:checked) {
    border-color: #4f46e5;
    background: #eef2ff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.12);
    transform: translateX(4px);
}

.practice-option-label.selected .practice-option-letter,
.practice-option-label:has(input[type="radio"]:checked) .practice-option-letter {
    background: #4f46e5;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}

@media (max-width: 576px) {
    .practice-option-label.selected,
    .practice-option-label:has(input[type="radio"]:checked) {
        transform: none;
    }
}

/* Footer Control Bar - in flow below options on web (not floating) */
.practice-scholastic-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border-radius: 10px;
    padding: 0.75rem 1.25rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.06);
    border: 1px solid rgba(229, 231, 235, 0.6);
    margin-top: 1rem;
}

.practice-scholastic-footer .btn-group-left {
    display: flex;
    gap: 0.75rem;
}

.practice-scholastic-footer button {
    padding: 0.65rem 1.25rem;
    border-radius: 100px;
    font-weight: 800;
    font-size: 0.95rem;
    border: none;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* Prev button hidden on first question, shown when .visible is toggled by JS */
.practice-scholastic-prev {
    display: none !important;
    background: #f1f5f9;
    color: #475569;
}
.practice-scholastic-prev.visible {
    display: inline-flex !important;
}

.practice-scholastic-clear {
    background: #fef2f2;
    color: #dc2626;
}

.practice-scholastic-prev:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

.practice-scholastic-clear:hover {
    background: #fee2e2;
    color: #b91c1c;
    transform: translateY(-2px);
}

.practice-scholastic-mark {
    background: #fef3c7;
    color: #d97706;
}

.practice-scholastic-mark:hover {
    background: #fde68a;
    transform: translateY(-2px);
}

.practice-scholastic-next {
    background: #4f46e5;
    color: #ffffff;
    box-shadow: 0 6px 15px rgba(79, 70, 229, 0.25);
}
/* Save & Next hidden on last question (toggled by JS) */
.practice-scholastic-next.hidden {
    display: none !important;
}

.practice-scholastic-next:hover {
    background: #4338ca;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
}

.practice-scholastic-submit {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.25);
}

.practice-scholastic-submit:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
}

/* Footer - Mobile: one button per row, full width, no overflow */
@media (max-width: 768px) {
    .practice-scholastic-footer {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem 0.5rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: visible;
    }
    .practice-scholastic-footer .btn-group-left,
    .practice-scholastic-footer .btn-group-right {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    .practice-scholastic-footer button {
        width: 100%;
        max-width: 100%;
        flex: none;
        justify-content: center;
        min-width: 0;
        min-height: 52px;
        padding: 0.9rem 0.75rem;
        font-size: 0.95rem;
        box-sizing: border-box;
    }
    .practice-palette-util-btn {
        min-height: 52px;
        padding: 0.9rem 0.75rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 576px) {
    .practice-scholastic-footer {
        padding: 0.6rem 0.5rem;
    }
    .practice-scholastic-footer button {
        min-height: 54px;
        padding: 0.95rem 0.85rem;
        font-size: 0.95rem;
    }
    .practice-palette-util-btn {
        min-height: 54px;
    }
}

/* Finish test confirmation modal */
.practice-finish-modal .modal-content {
    border: none;
    border-radius: 24px;
    box-shadow: 0 25px 60px -12px rgba(79, 70, 229, 0.25);
    overflow: hidden;
}

.practice-finish-modal .modal-header {
    border-bottom: none;
    padding: 1.75rem 1.5rem 0;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.practice-finish-modal .modal-header .btn-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.practice-finish-modal .practice-finish-modal-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    color: #4f46e5;
    margin-bottom: 1.25rem;
    box-shadow: 0 12px 24px rgba(79, 70, 229, 0.2);
}

.practice-finish-modal .modal-title {
    font-family: 'Ubuntu', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #1f2937;
    letter-spacing: -0.02em;
}

.practice-finish-modal .modal-body {
    padding: 1rem 1.5rem 1.5rem;
    text-align: center;
    color: #64748b;
    font-size: 1rem;
    line-height: 1.6;
}

.practice-finish-modal .modal-footer {
    border-top: 1px solid #f1f5f9;
    padding: 1.25rem 1.5rem 1.5rem;
    gap: 0.75rem;
    justify-content: center;
}

.practice-finish-modal .practice-finish-modal-cancel {
    padding: 0.65rem 1.5rem;
    font-weight: 600;
    border-radius: 12px;
    background: #f1f5f9;
    color: #475569;
    border: none;
}

.practice-finish-modal .practice-finish-modal-cancel:hover {
    background: #e2e8f0;
    color: #334155;
}

.practice-finish-modal .practice-finish-modal-review {
    padding: 0.65rem 1.5rem;
    font-weight: 600;
    border-radius: 12px;
    background: #fff;
    color: #4f46e5;
    border: 2px solid #818cf8;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.practice-finish-modal .practice-finish-modal-review:hover {
    background: #eef2ff;
    color: #4338ca;
    border-color: #4f46e5;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

.practice-finish-modal .practice-finish-modal-submit {
    padding: 0.65rem 1.75rem;
    font-weight: 600;
    border-radius: 12px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.practice-finish-modal .practice-finish-modal-submit:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
    color: #fff;
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}

/* Review page: no palette on the right; keep content in the middle */
.practice-standalone-page.is-review .practice-sidebar-right,
.practice-standalone-page.is-review .practice-test-palette-wrap {
    display: none !important;
}

.practice-standalone-page.is-review .practice-center-wrap {
    justify-content: center;
}

.practice-standalone-page.is-review .practice-center-wrap .practice-center {
    max-width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
}

@media (max-width: 991px) {
    .practice-standalone-page.is-review .practice-center-wrap .practice-center {
        max-width: 100%;
    }
}

/* Review page: all questions on one page */
.practice-review-wrap .practice-review-questions {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.practice-review-wrap .practice-review-question {
    margin-bottom: 0;
}

.practice-review-wrap .practice-question-num {
    font-weight: 600;
    color: #4f46e5;
    font-size: 0.95rem;
}

.practice-review-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.practice-review-footer .practice-scholastic-finish-btn {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
    display: block;
    padding: 0.85rem 1.5rem;
    min-height: 52px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #fff !important;
    border: none;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.practice-review-footer .practice-scholastic-finish-btn:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
    color: #fff !important;
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}
