/* English Test Styles - Isolated */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #ffffff;
    background-color: #0f172a;
    overflow-x: hidden;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Header */
.header {
    background: #1e293b;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.nav-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #ffffff;
    font-weight: 600;
    font-size: 1.25rem;
}

.nav-logo img { width: 40px; height: 40px; margin-right: 12px; }

.nav-menu { display: flex; align-items: center; gap: 8px; }

.subject-btn {
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: #ffffff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.subject-btn:hover { background: rgba(255, 255, 255, 0.1); }
.subject-btn.active { background: #3b82f6; border-color: #3b82f6; }

/* Main Content */
.child-test-main {
    padding: 24px 0;
    min-height: calc(100vh - 70px);
}

/* Test Setup Panel */
.test-setup { max-width: 900px; margin: 0 auto; }

.practice-panel {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 32px;
}

.practice-header {
    text-align: center;
    margin-bottom: 32px;
}

.practice-icon { font-size: 48px; margin-bottom: 16px; }

.practice-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #ffffff;
}

.practice-header p { color: rgba(255, 255, 255, 0.7); font-size: 1rem; }

/* Practice Cards */
.practice-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.practice-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.practice-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.card-icon { font-size: 32px; margin-bottom: 12px; }

.practice-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #ffffff;
}

.practice-card p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 16px;
}

.card-timer-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary { background: #3b82f6; color: #ffffff; }
.btn-primary:hover { background: #2563eb; }
.btn-success { background: #22c55e; color: #ffffff; }
.btn-success:hover { background: #16a34a; }
.btn-info { background: #06b6d4; color: #ffffff; }
.btn-info:hover { background: #0891b2; }
.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.2); }

/* Loading Screen */
.loading-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.loading-card {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 48px;
    text-align: center;
    max-width: 400px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

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

.loading-progress { margin-top: 24px; }

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #22c55e);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Test Questions - WIDER for comprehension */
.test-questions {
    max-width: 1200px;
    margin: 0 auto;
}

body.english-comp-mode .test-questions { max-width: 1200px; }

.test-progress {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.progress-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.question-counter {
    font-size: 1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.section-timer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.6);
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 8px;
}

.section-timer-title { font-weight: 500; color: #ffffff; }
.section-timer-time {
    font-family: 'Courier New', monospace;
    font-size: 1.25rem;
    font-weight: 600;
    color: #22c55e;
}

/* Question Card */
.question-card {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 32px;
}

body.english-comp-mode .question-card {
    background: transparent;
    backdrop-filter: none;
    border: none;
    padding: 0;
    box-shadow: none;
}

.question-content { margin-bottom: 24px; }

.question-content h3 {
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.6;
    color: #ffffff;
}

body.english-comp-mode .question-actions { display: none; }

/* ============================================
   ENGLISH COMPREHENSION SPLIT LAYOUT
   ============================================ */

.visual-element {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 24px 0;
}

.visual-element.english-comprehension {
    justify-content: stretch;
    align-items: stretch;
}

/* The split layout container */
.english-comp-layout {
    width: 100%;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 16px;
}

/* Left panel - Passage */
.english-comp-left,
.english-comp-right {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    color: #111827;
}

.english-comp-meta { margin-bottom: 12px; }

.english-comp-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.english-comp-author {
    font-size: 14px;
    color: #64748b;
    font-style: italic;
}

.english-comp-chapter {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 2px;
}

/* Passage with line numbers */
.english-comp-passage {
    font-size: 15px;
    line-height: 1.7;
    color: #334155;
}

.english-comp-passage-lined { padding-right: 8px; }

.english-comp-line {
    display: flex;
    align-items: baseline;
    margin-bottom: 6px;
}

.english-comp-lno {
    width: 28px;
    font-size: 12px;
    color: #94a3b8;
    text-align: right;
    padding-right: 8px;
    flex-shrink: 0;
    font-family: 'Courier New', monospace;
}

.english-comp-ltxt {
    flex: 1;
    color: #334155;
}

/* Right panel - Question */
.english-comp-qtitle {
    font-size: 14px;
    font-weight: 600;
    color: #3b82f6;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

.english-comp-qtext {
    font-size: 15px;
    line-height: 1.6;
    color: #0f172a;
    margin-bottom: 16px;
}

.english-comp-options { margin-bottom: 16px; }

.english-comp-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.english-comp-option:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.english-comp-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
    margin-top: 2px;
}

.english-comp-option label {
    flex: 1;
    cursor: pointer;
    color: #334155;
    font-size: 14px;
    line-height: 1.5;
}

.english-comp-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

/* Passage Word Question Table */
.passage-word-table {
    margin-top: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
}

.passage-word-header {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.passage-word-header > div {
    padding: 10px 12px;
    font-weight: 700;
    font-size: 13px;
    color: #475569;
}

.passage-word-header > div:first-child { flex: 1; }
.passage-word-header > div:last-child {
    width: 120px;
    text-align: right;
    border-left: 1px solid #e2e8f0;
}

.passage-word-row {
    display: flex;
    align-items: flex-start;
    border-bottom: 1px solid #e2e8f0;
}

.passage-word-row:last-child { border-bottom: none; }

.passage-word-row > div:first-child {
    flex: 1;
    padding: 12px;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.passage-word-row > div:last-child {
    width: 120px;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    text-align: right;
    color: #64748b;
    border-left: 1px solid #e2e8f0;
}

/* Missing Letter/Word Box */
.english-missing-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
}

.missing-line {
    font-size: 15px;
    line-height: 1.8;
    color: #334155;
    padding: 4px 0;
    border-bottom: 1px dashed #e2e8f0;
}

.missing-line:last-child { border-bottom: none; }

.missing-line strong {
    color: #3b82f6;
    font-weight: 600;
}

/* Answer Options (non-comprehension) */
.answer-options { margin-bottom: 24px; }

.answer-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.answer-option:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.answer-option input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: #3b82f6;
}

.answer-option label {
    flex: 1;
    cursor: pointer;
    color: #ffffff;
    font-size: 1rem;
}

/* Text Input */
.answer-input {
    display: flex;
    align-items: center;
    gap: 12px;
}

.answer-input input[type="text"] {
    flex: 1;
    padding: 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: #ffffff;
    font-size: 1rem;
}

.answer-input input[type="text"]:focus {
    outline: none;
    border-color: #3b82f6;
}

/* Question Actions */
.question-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Feedback */
.answer-feedback { margin-top: 20px; }

.feedback {
    padding: 16px;
    border-radius: 10px;
    text-align: center;
}

.feedback.correct {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #22c55e;
}

.feedback.incorrect {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

/* Results Screen */
.results-screen { max-width: 600px; margin: 0 auto; }

.setup-card {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 48px;
    text-align: center;
}

.setup-icon { font-size: 48px; margin-bottom: 16px; }

.setup-card h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #ffffff;
}

.score-display { margin: 32px 0; }

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #22c55e);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.score-circle span {
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
}

.results-feedback {
    text-align: left;
    margin: 24px 0;
}

.results-feedback h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #ffffff;
}

.results-feedback ul {
    list-style: none;
    padding: 0;
}

.results-feedback li {
    padding: 8px 0;
    color: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.results-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 32px;
}

/* Paper Test Screen */
#paperTestScreen {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container { padding: 0 16px; }
    .nav-menu { display: none; }
    .practice-panel { padding: 24px; }
    .practice-options { grid-template-columns: 1fr; }
    .question-card { padding: 24px; }
    .card-timer-buttons { flex-direction: column; }
    .card-timer-buttons .btn { width: 100%; }
    
    /* English comprehension mobile */
    .english-comp-layout {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .english-comp-left,
    .english-comp-right { padding: 12px; }
    
    .english-comp-passage {
        font-size: 14px;
        max-height: 300px;
        overflow-y: auto;
    }
}
