/* Modern Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f5f7;
    color: #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100vh;
}

/* Header Styles */
.header {
    background-color: #ffffff;
    padding: 12px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 60px;
    gap: 20px;
}

.ielts-header {
    background-color: #ffffff;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    z-index: 20;
    position: relative;
}

.logo-container {
    display: flex;
    align-items: center;
}

.ielts-logo {
    height: 35px;
    width: auto;
    display: none;
}

.header-logo {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.timer-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.listening-timer-display {
    font-size: 13px;
    font-weight: normal;
    color: #666;
    padding: 4px 8px;
    background: transparent;
    border-radius: 4px;
    margin-top: 0;
    text-align: left;
}

.listening-timer-display.warning {
    color: #ff6b00;
}

.listening-timer-display.critical {
    color: #dc3545;
    animation: pulse-timer 1s infinite;
}

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

.header-icons {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Info Banner */
.info-banner {
    background-color: #e0e0e0;
    padding: 12px 40px;
    border-bottom: 1px solid #ccc;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
    margin-top: 60px;
}

.part-label {
    font-weight: 700;
    color: #333;
}

.instruction-text {
    color: #555;
    font-style: italic;
}

/* Highlights and Notes Panel */
.notes-panel {
    display: none;
    width: 25%;
    background-color: #f5f5f5;
    border-left: 1px solid #ddd;
    overflow-y: auto;
    padding: 15px;
    font-size: 13px;
    flex-direction: column;
    gap: 10px;
}

.notes-panel.active {
    display: flex;
}

.test-interface.with-notes .panel {
    width: 37.5%;
}

.test-interface.with-notes .notes-panel {
    display: flex;
}

.note-item {
    background: white;
    border-left: 4px solid #007bff;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.note-item.highlight {
    border-left-color: #ffc107;
}

.note-item.annotation {
    border-left-color: #007bff;
}

.note-text {
    color: #333;
    margin-bottom: 4px;
    line-height: 1.4;
}

.note-type {
    display: inline-block;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
}

.note-type.highlight {
    background: #ffc107;
    color: #333;
}

.note-type.annotation {
    background: #007bff;
    color: white;
}

.highlighted-text {
    background-color: #ffff99;
    padding: 2px 4px;
    border-radius: 2px;
    cursor: pointer;
}

.highlighted-text.active {
    outline: 2px solid #ffc107;
}

/* Split Interface Layout */
.test-interface {
    flex-grow: 1;
    display: flex;
    overflow: hidden;
    position: relative;
    background-color: #fff;
    height: calc(100vh - 60px - 50px);
}

.panel {
    overflow-y: auto;
    height: 100%;
    width: 50%;
    padding: 0;
    flex: 0 0 auto;
}

.panel-content {
    padding: 25px 40px;
    line-height: 1.6;
}

/* Panel Specifics */
.question-panel {
    background-color: #f9f9f9;
    /* No border-right needed if it's on the right now */
}

.text-panel {
    background-color: #ffffff;
    border-right: 1px solid #ddd;
    /* Divider line */
}

.text-panel h2 {
    margin-bottom: 15px;
    font-size: 1.5rem;
    color: #222;
}

.text-panel h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.2rem;
    color: #333;
}

.text-panel p {
    margin-bottom: 15px;
    text-align: justify;
}

/* Resizer Handle */
.resizer {
    width: 10px;
    background-color: #e0e0e0;
    cursor: col-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    flex-shrink: 0;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
    transition: background-color 0.2s;
}

.resizer:hover,
.resizer.active {
    background-color: #d0d0d0;
}

.resizer-handle {
    width: 24px;
    height: 40px;
    background: #fff;
    border: 1px solid #aaa;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #555;
    font-weight: bold;
    user-select: none;
    cursor: col-resize;
    position: absolute;
    z-index: 11;
}

/* Footer Palette */
.footer-palette {
    background-color: #f0f0f0;
    border-top: 1px solid #ccc;
    padding: 10px 40px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
    height: 60px;
}

.palette-label {
    font-weight: 700;
    font-size: 0.9rem;
    margin-right: 10px;
    cursor: pointer;
}

.palette-items {
    display: flex;
    gap: 5px;
}

.q-item {
    font-family: 'Arial', sans-serif;
    font-size: 14px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    border-radius: 2px;
    color: #333;
    transition: background-color 0.2s;
}

.q-item:hover {
    background-color: #e0e0e0;
}

.q-item::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #ccc;
}

.q-item.answered::before {
    background-color: #4CAF50;
}

.q-item.answered {
    font-weight: bold;
}

.q-item.active {
    border: 1px solid #0078d7;
    background-color: #e6f7ff;
    font-weight: bold;
}

/* --- Question Content Styles --- */

.question-group {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.question-group:last-child {
    border-bottom: none;
}

.q-group-title {
    font-size: 1.1rem;
    color: #0078d7;
    /* Changed from Red to Blue */
    margin-bottom: 10px;
    font-weight: 700;
}

.instruction {
    font-style: italic;
    background-color: #f0f0f0;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.q-item-container {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.block-layout {
    display: block;
}

/* Specific Focus for Q1-6: The Number Box */
.q-number {
    font-weight: bold;
    min-width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    border-radius: 3px;
    transition: all 0.2s;

    /* Default visibility as a box */
    background-color: #eee;
    border: 1px solid #ccc;
    font-size: 0.9rem;
}

.q-number.active-focus {
    background-color: #0078d7;
    color: #fff;
    box-shadow: 0 0 0 2px #cce4f7;
    /* Optional glow ring */
}

.q-body {
    flex: 1;
}

.q-text {
    margin-bottom: 10px;
    font-weight: 500;
}

.radio-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
}

.radio-options input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #0078d7;
}

/* Fill in the blanks styles */
.notes-wrapper {
    background-color: #fff;
    border: 1px solid #ddd;
    padding: 20px;
    border-radius: 4px;
}

.notes-title {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: #222;
}

.note-item {
    margin-bottom: 15px;
    line-height: 2;
    /* Increased line-height for inputs to fit */
    font-size: 0.95rem;
}

.summary-text {
    line-height: 2.2;
    font-size: 0.95rem;
}

/* Specific Focus for Q7-13: The Input Group */
.input-group {
    display: inline-flex;
    align-items: center;
    border: 1px solid #999;
    border-radius: 2px;
    margin: 0 5px;
    background-color: #fff;
    vertical-align: middle;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group.active-focus {
    border-color: #0078d7;
    box-shadow: 0 0 0 2px rgba(0, 120, 215, 0.3);
}

.input-number {
    background-color: #eee;
    padding: 2px 6px;
    font-size: 0.8rem;
    font-weight: bold;
    color: #555;
    border-right: 1px solid #999;
    height: 100%;
    /* Ensure full height fill */
    display: flex;
    align-items: center;
}

.line-input {
    border: none;
    outline: none;
    padding: 4px 8px;
    font-size: 0.95rem;
    width: 120px;
    color: #000;
}

.line-input:focus {
    background-color: #e6f7ff;
}

/* --- Expanded Footer Styles --- */
.nav-arrows {
    position: fixed;
    bottom: 100px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 101;
}

.nav-btn {
    width: 50px;
    height: 50px;
    background: #f5f5f5;
    color: #888;
    border: 2px solid #d0d0d0;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.nav-btn:hover:not(:disabled) {
    background: #e8e8e8;
    border-color: #bbb;
}

.nav-btn:disabled {
    background: #f5f5f5;
    border-color: #e0e0e0;
    color: #ccc;
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-btn svg {
    pointer-events: none;
}

/* Button styles matching listening.html */
.footer__deliverButton___3FM07 {
    margin-left: auto;
    margin-right: 10px;
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s, border-color 0.2s;
    min-width: 170px;
    justify-content: center;
}

.footer__deliverButton___3FM07:hover {
    background-color: #e0e0e0;
    border-color: #bbb;
}

.footer__deliverButton___3FM07.success {
    background-color: #28a745;
    color: #fff;
    border-color: #28a745;
}

.footer__deliverButton___3FM07.success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.footer__deliverButton___3FM07:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    border-color: #ddd;
}

.footer__exitButton___3FM07 {
    margin-right: 20px;
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s, border-color 0.2s;
    min-width: 100px;
    justify-content: center;
}

.footer__exitButton___3FM07:hover {
    background-color: #e0e0e0;
    border-color: #bbb;
}

.fa-check::before {
    content: "✓";
}

.part-section {
    display: flex;
    align-items: center;
    border-right: 1px solid #ccc;
    /* Separator */
    padding-right: 20px;
    margin-right: 20px;
}

.part-stats {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    color: #555;
    font-weight: 600;
}

/* --- Part Toggling Helpers --- */
.part-content.hidden,
.part-section.hidden {
    display: none !important;
}

.part-content.active {
    display: block;
}

.part-section.active-part {
    display: flex !important;
    /* Footer sections need flex */
}

/* --- Text Section Markers (14, 15, 16...) --- */
.text-section-marker {
    background-color: #333;
    color: #fff;
    font-weight: bold;
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 10px;
    margin-bottom: 10px;
    margin-top: 20px;
}

/* --- Drag & Drop Headings --- */
.headings-pool {
    background-color: #f0f4f8;
    padding: 15px;
    border: 1px solid #d1d9e6;
    border-radius: 5px;
    margin-bottom: 25px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.heading-item {
    background-color: #fff;
    border: 1px solid #0078d7;
    color: #0078d7;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: grab;
    font-size: 0.9rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.heading-item:hover {
    background-color: #e6f7ff;
}

.heading-item.dragging {
    opacity: 0.5;
}

.heading-match-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.heading-dropzone {
    flex: 1;
    height: 40px;
    background-color: #fff;
    border: 1px dashed #999;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding-left: 10px;
    color: #888;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.heading-dropzone.drag-over {
    background-color: #e6f7ff;
    border-color: #0078d7;
}

.heading-dropzone.has-item {
    border-style: solid;
    border-color: #0078d7;
    background-color: #f0f8ff;
    color: #333;
    font-weight: 500;
}

/* --- Checkbox Styles --- */
.checkbox-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.checkbox-options label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1.4;
    padding: 5px;
    border-radius: 4px;
}

.checkbox-options label:hover {
    background-color: #f0f0f0;
}

.checkbox-options input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: #0078d7;
}

.part-stat-item {
    cursor: pointer;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 600;
}

.part-stat-item span {
    font-weight: 400;
    font-size: 14px;
}

/* --- Results Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: none;
    /* Toggled via JS */
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    /* Handle small screens */
    padding: 20px;
}

.result-card {
    background: #fff;
    width: 100%;
    max-width: 800px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    /* For header rounded corners */
    display: none;
    flex-direction: column;
    max-height: 90vh;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2001;
}

.result-header {
    background: linear-gradient(135deg, #0078d7, #005a9e);
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
    flex-shrink: 0;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.band-score-display {
    margin-top: 10px;
    display: inline-block;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    padding: 10px 30px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.band-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
    display: block;
    margin-bottom: 2px;
    font-weight: 600;
}

.band-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: #0078d7;
    line-height: 1;
}

.result-content {
    padding: 20px 30px;
    overflow-y: auto;
    flex-grow: 1;
}

.score-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
    text-align: center;
}

.stat-box {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.stat-label {
    font-size: 0.85rem;
    color: #666;
}

.results-table-container {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.results-table th {
    background: #f1f3f5;
    color: #495057;
    font-weight: 600;
    text-align: left;
    padding: 12px 15px;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
    background-clip: padding-box;
    /* Fix for sticky header border */
}

.results-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    color: #333;
    vertical-align: middle;
}

.results-table tr:last-child td {
    border-bottom: none;
}

.results-table tr.correct-row {
    background-color: rgba(40, 167, 69, 0.05);
    /* Subtle Green */
}

.results-table tr.incorrect-row {
    background-color: rgba(220, 53, 69, 0.05);
    /* Subtle Red */
}

.status-icon {
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    line-height: 0;
    /* Align perfectly */
}

.status-correct {
    color: #28a745;
    background: rgba(40, 167, 69, 0.15);
}

.status-incorrect {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.15);
}

.ua-text {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9em;
    color: #000;
    font-weight: 500;
}

.ca-text {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9em;
    color: #555;
    opacity: 0.8;
}

/* Improved Notes Panel Styles */
#notes-panel {
    display: flex;
    flex-direction: column;
    padding: 15px;
    background-color: #f8f8f8;
    border-left: 1px solid #ddd;
}

.notes-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.note-input {
    width: 100%;
    min-height: 60px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
    resize: vertical;
}

.note-input:focus {
    outline: none;
    border-color: #0288d1;
    box-shadow: 0 0 4px rgba(2, 136, 209, 0.2);
}

.note-delete-btn {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    padding: 4px 8px;
    transition: color 0.2s;
}

.note-delete-btn:hover {
    color: #c82333;
}

#notes-eye-icon {
    cursor: pointer;
    font-size: 16px;
    transition: opacity 0.2s;
}

#notes-eye-icon:hover {
    opacity: 0.7;
}

#close-notes-btn {
    cursor: pointer;
    font-size: 16px;
    color: #999;
    transition: color 0.2s;
}

#close-notes-btn:hover {
    color: #333;
}

@keyframes flash {
    0% { background-color: #fff3cd; }
    100% { background-color: transparent; }
}

@keyframes flash-note {
    0% { background-color: #fff3cd; }
    100% { background-color: transparent; }
}

.highlighted-text[data-type="annotation"] {
    cursor: pointer;
    transition: background-color 0.2s;
}

.highlighted-text[data-type="annotation"]:hover {
    background-color: #81d4fa !important;
}
/* Notes Panel Resizer */
.resizer-notes {
    width: 8px;
    background-color: #e0e0e0;
    cursor: col-resize;
    user-select: none;
    transition: background-color 0.2s;
}

.resizer-notes:hover {
    background-color: #999;
}