* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #00CC00;
    --primary-dark: #00CC00;
    --primary-light: #00CC00;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --sidebar-width: 260px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

.test-container {
    min-height: 100vh;
}

.test-container .test-view-section {
    height: 100vh;
}

.test-view-section {
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.test-header {
    padding: 20px 32px;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.test-header h2 {
    font-size: 20px;
    color: var(--text-primary);
}

.timer-display {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-color);
    padding: 12px 20px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.timer-display svg {
    color: var(--primary-color);
}

.timer-display.warning {
    border-color: var(--warning-color);
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.timer-display.warning svg {
    color: var(--warning-color);
}

.timer-display.danger {
    border-color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    animation: pulse 1s infinite;
}

.timer-display.danger svg {
    color: var(--danger-color);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.split-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.split-panel {
    overflow-y: scroll;
    overflow-x: hidden;
    background: var(--card-bg);
    position: relative;
    height: 100%;
}

.left-panel {
    position: relative;
    flex: 1;
}

.right-panel {
    width: 40%;
    min-width: 300px;
}

.split-panel::-webkit-scrollbar {
    width: 8px;
}

.split-panel::-webkit-scrollbar-track {
    background: var(--bg-color);
}

.split-panel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.split-panel::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

.split-divider {
    width: 20px;
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 50%, #e2e8f0 100%);
    cursor: col-resize;
    position: relative;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 2px 0 4px rgba(0, 0, 0, 0.05), inset -2px 0 4px rgba(0, 0, 0, 0.05);
}

.split-divider:hover {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 50%, #3b82f6 100%);
    box-shadow: inset 2px 0 4px rgba(0, 0, 0, 0.1), inset -2px 0 4px rgba(0, 0, 0, 0.1), 0 0 10px rgba(37, 99, 235, 0.3);
}

.divider-handle {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 0;
}

.handle-line {
    width: 3px;
    height: 15px;
    background: #94a3b8;
    border-radius: 2px;
    transition: background 0.3s;
}

.split-divider:hover .handle-line {
    background: white;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
}

.panel-content {
    padding: 32px;
    max-width: 800px;
    position: relative;
}

.left-panel .panel-content {
    max-width: 100%;
}

#readingPanel {
    position: relative;
}

.panel-content h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 16px;
    margin-top: 24px;
}

.panel-content h3:first-child {
    margin-top: 0;
}

.panel-content h4 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 12px;
    margin-top: 20px;
    font-weight: 600;
}

.panel-content p {
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.question-text {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
    margin-top: 16px;
}

.question-text p {
    margin-bottom: 16px;
}

.question-text p:last-child {
    margin-bottom: 0;
}

.answer-input {
    padding: 6px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    min-width: 150px;
    transition: all 0.3s;
    background: white;
}

.answer-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.answer-input::placeholder {
    color: var(--text-secondary);
    font-style: italic;
}

.answer-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    transition: all 0.3s;
}

.answer-row:hover {
    background: var(--bg-color);
}

.answer-row label {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 30px;
    font-size: 16px;
}

.answer-row .answer-input {
    flex: 1;
    min-width: 0;
}

.multiple-choice-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.mc-option {
    padding: 12px 16px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    line-height: 1.6;
    transition: all 0.3s;
}

.mc-option:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.mc-option strong {
    color: var(--primary-color);
    margin-right: 8px;
    font-size: 16px;
}

.answer-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.small-input {
    max-width: 80px;
    text-align: center;
    font-weight: 600;
    text-transform: uppercase;
}

.sentence-completion {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.sentence-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: white;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    transition: all 0.3s;
}

.sentence-item:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.02);
}

.sentence-content {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.sentence-number {
    color: var(--primary-color);
    font-weight: 600;
    flex-shrink: 0;
}

.sentence-text {
    line-height: 1.6;
    color: var(--text-primary);
}

.summary-completion {
    line-height: 2.2;
}

.summary-completion p {
    margin-bottom: 0;
}

.inline-input {
    min-width: 180px;
    max-width: 220px;
    display: inline-block;
    vertical-align: middle;
    margin: 0 4px;
}

.checkbox-questions {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.checkbox-question {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
    transition: all 0.3s;
}

.checkbox-question:hover {
    background: white;
    box-shadow: var(--shadow);
}

.question-statement {
    margin-bottom: 12px;
    line-height: 1.6;
    color: var(--text-primary);
}

.checkbox-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    color: var(--text-primary);
}

.checkbox-label:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.checkbox-label input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox-label input[type="radio"]:checked + span {
    color: var(--primary-color);
    font-weight: 600;
}

.checkbox-label:has(input[type="radio"]:checked) {
    background: rgba(37, 99, 235, 0.1);
    border-color: var(--primary-color);
}

.dropdown-questions {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dropdown-question {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
    transition: all 0.3s;
}

.dropdown-question:hover {
    background: white;
    box-shadow: var(--shadow);
}

.answer-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 45px;
}

.answer-select:hover {
    border-color: var(--primary-color);
}

.answer-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.answer-select option {
    padding: 10px;
    font-weight: 500;
}

.answer-select:not([value=""]) {
    background-color: rgba(37, 99, 235, 0.05);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.section-content,
.section-questions {
    display: block;
}

.section-content.hidden,
.section-questions.hidden {
    display: none;
}

.submit-section {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 2px solid var(--border-color);
    display: flex;
    justify-content: center;
}

.btn-add {
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-add:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-add:active {
    transform: translateY(0);
}

.submit-section .btn-add {
    padding: 14px 40px;
    font-size: 16px;
}

.section-submit-btn {
    min-width: 200px;
}

.section-navigation {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 20px 32px;
    background: var(--card-bg);
    border-top: 2px solid var(--border-color);
    flex-shrink: 0;
}

.section-nav-btn {
    padding: 12px 32px;
    background: var(--bg-color);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.section-nav-btn:hover:not(:disabled) {
    background: var(--card-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.section-nav-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.section-nav-btn.completed {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.section-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.highlight-toolbar {
    position: fixed;
    display: none;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px;
    gap: 8px;
    z-index: 1000;
    border: 2px solid var(--border-color);
    transform: translateX(-50%);
}

.highlight-toolbar.visible {
    display: flex;
}

.highlight-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.highlight-btn:hover {
    transform: scale(1.1);
}

.highlight-btn.yellow {
    background: #fef9c3;
    color: #ca8a04;
}

.highlight-btn.yellow:hover {
    background: #fef08a;
}

.highlight-btn.black {
    background: #f1f5f9;
    color: #1e293b;
}

.highlight-btn.black:hover {
    background: #e2e8f0;
}

.highlighted-text {
    background-color: #fef08a;
    border-radius: 3px;
    padding: 1px 3px;
    display: inline;
    margin: 0;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.results-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 20px;
}

.results-modal.visible {
    display: flex;
}

.results-modal-box {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.results-modal-header {
    padding: 24px 28px;
    border-bottom: 2px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.results-modal-header h3 {
    margin: 0 0 8px 0;
    font-size: 22px;
}

.results-modal-header .score-display {
    font-size: 16px;
    opacity: 0.9;
}

.results-modal-body {
    padding: 24px 28px;
    overflow-y: auto;
    flex: 1;
}

.results-answers-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-answer-item {
    display: grid;
    grid-template-columns: 60px 1fr 1fr;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-color);
    border-radius: 8px;
    align-items: center;
    border-left: 4px solid transparent;
}

.result-answer-item.correct {
    border-left-color: var(--success-color);
    background: rgba(16, 185, 129, 0.08);
}

.result-answer-item.incorrect {
    border-left-color: var(--danger-color);
    background: rgba(239, 68, 68, 0.08);
}

.result-answer-item.unanswered {
    border-left-color: var(--secondary-color);
}

.result-question-num {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 15px;
}

.result-student-answer,
.result-correct-answer {
    font-size: 14px;
}

.result-student-answer {
    color: var(--text-primary);
}

.result-correct-answer {
    color: var(--success-color);
    font-weight: 600;
}

.result-answer-item.incorrect .result-student-answer {
    color: var(--danger-color);
    text-decoration: line-through;
}

.result-answer-item.unanswered .result-student-answer {
    color: var(--secondary-color);
    font-style: italic;
}

.results-modal-footer {
    padding: 20px 28px;
    border-top: 2px solid var(--border-color);
    display: flex;
    justify-content: center;
}

.btn-continue {
    padding: 14px 48px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-continue:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

.results-answers-header {
    display: grid;
    grid-template-columns: 60px 1fr 1fr;
    gap: 12px;
    padding: 10px 16px;
    background: var(--border-color);
    border-radius: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 900px) {
    .test-view-section {
        height: 100vh;
        overflow: hidden;
    }
    
    .split-container {
        flex-direction: column;
        height: calc(100vh - 140px);
        overflow: hidden;
    }
    
    .left-panel {
        width: 100% !important;
        height: 50% !important;
        min-height: 50% !important;
        max-height: 50% !important;
        border-bottom: 3px solid var(--primary-color);
        overflow-y: scroll !important;
    }
    
    .right-panel {
        width: 100% !important;
        height: 50% !important;
        min-height: 50% !important;
        max-height: 50% !important;
        overflow-y: scroll !important;
    }
    
    .split-divider {
        display: none;
    }
    
    .section-navigation {
        flex-shrink: 0;
    }
}

@media (max-width: 768px) {
    .test-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .section-navigation {
        flex-direction: row;
        gap: 8px;
        padding: 16px;
    }
    
    .section-nav-btn {
        flex: 1;
        padding: 10px 16px;
    }
    
    .timer-display {
        font-size: 16px;
        padding: 10px 16px;
    }
    
    .results-modal-box {
        max-height: 95vh;
    }
    
    .results-modal-header {
        padding: 20px;
    }
    
    .results-modal-body {
        padding: 16px;
    }
    
    .result-answer-item {
        grid-template-columns: 45px 1fr 1fr;
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .results-answers-header {
        grid-template-columns: 45px 1fr 1fr;
        font-size: 11px;
    }
    
    .highlight-toolbar {
        transform: scale(0.9);
    }
    
    .section-full {
        display: none;
    }
    
    .checkbox-options {
        flex-direction: column;
    }
    
    .checkbox-label {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .inline-input {
        min-width: 140px;
        max-width: 100%;
    }
    
    .summary-completion {
        line-height: 2.5;
    }
    
    .small-input {
        max-width: 100%;
    }
    
    .sentence-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .sentence-content {
        margin-bottom: 8px;
    }
}

