* {
    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;
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo h1 {
    font-size: 36px;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 5px;
}

.logo p {
    color: var(--text-secondary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-card h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-primary);
    font-size: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.password-input-wrapper {
    position: relative;
    width: 100%;
}

.password-input-wrapper input {
    padding-right: 45px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.3s;
}

.toggle-password:hover {
    color: var(--primary-color);
}

.toggle-password .eye-icon {
    width: 20px;
    height: 20px;
}

.error-message {
    color: var(--danger-color);
    font-size: 14px;
    margin-bottom: 15px;
    text-align: center;
    min-height: 20px;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.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);
}

.btn-add svg {
    flex-shrink: 0;
}

.admin-panel {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 20px;
    color: var(--primary-color);
    font-weight: 700;
}

.toggle-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.toggle-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    margin: 4px 0;
    transition: 0.3s;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s;
    gap: 12px;
    font-weight: 500;
}

.nav-item:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

.nav-item.active {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.nav-item svg {
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-logout:hover {
    background-color: var(--bg-color);
    color: var(--danger-color);
    border-color: var(--danger-color);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.header {
    background: var(--card-bg);
    padding: 20px 32px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.mobile-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    margin: 5px 0;
}

.header h1 {
    font-size: 24px;
    color: var(--text-primary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info span {
    font-weight: 500;
    color: var(--text-secondary);
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.content {
    padding: 32px;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Remove padding when test-view is active */
.content:has(.test-view-section.active) {
    padding: 0;
}

/* Hide main header when test-view is active */
.main-content:has(.test-view-section.active) .header {
    display: none;
}

.content-section {
    display: none;
}

.content-section.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Special handling for test-view section in admin */
.content-section.test-view-section {
    padding: 0 !important;
}

.content-section.test-view-section.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.blue {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.stat-icon.purple {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.stat-icon.orange {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.stat-details h3 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.card h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    margin-bottom: 0;
}

.placeholder-text {
    color: var(--text-secondary);
    text-align: center;
    padding: 40px;
    font-size: 15px;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 8px;
    transition: all 0.3s;
}

.activity-item:hover {
    background: var(--border-color);
}

.activity-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border-radius: 8px;
    flex-shrink: 0;
}

.activity-details p {
    margin-bottom: 4px;
    color: var(--text-primary);
}

.activity-time {
    font-size: 13px;
    color: var(--text-secondary);
}

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 220px;
    }
    
    .panel-content {
        padding: 24px;
    }
}

@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) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-toggle {
        display: block;
    }

    .header {
        padding: 16px 20px;
    }

    .header h1 {
        font-size: 20px;
    }

    .content {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .user-info span {
        display: none;
    }

    .login-card {
        padding: 30px 24px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .card-header .btn-primary {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 24px 20px;
    }

    .logo h1 {
        font-size: 28px;
    }

    .stat-card {
        padding: 20px;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
    }

    .stat-number {
        font-size: 24px;
    }

    .activity-item {
        padding: 12px;
    }
    
    .answer-fields {
        flex-direction: column;
    }
    
    .small-input {
        max-width: 100%;
    }
    
    .sentence-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .sentence-content {
        margin-bottom: 8px;
    }
    
    .inline-input {
        min-width: 140px;
        max-width: 100%;
    }
    
    .summary-completion {
        line-height: 2.5;
    }
    
    .result-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .result-card button {
        width: 100%;
    }
    
    .result-modal-content {
        max-width: 95vw;
    }
    
    .results-table {
        font-size: 13px;
    }
    
    .results-table th,
    .results-table td {
        padding: 10px 8px;
    }
    
    .question-cell {
        width: 70px;
    }
    
    .question-table {
        font-size: 13px;
    }
    
    .question-table th,
    .question-table td {
        padding: 10px 8px;
    }
}

.settings-form {
    max-width: 500px;
}

.settings-form .form-group {
    margin-bottom: 20px;
}

.password-message {
    min-height: 20px;
    margin-bottom: 15px;
    font-size: 14px;
    text-align: left;
}

.password-message.success {
    color: var(--success-color);
}

.password-message.error {
    color: var(--danger-color);
}

/* Students List */
.students-list {
    margin-top: 20px;
    min-height: 200px;
}

.student-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 12px;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.student-card:hover {
    border-color: var(--primary-color);
    background: white;
}

.student-info h4 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.student-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.student-actions {
    display: flex;
    gap: 8px;
}

.btn-link {
    padding: 8px 16px;
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-link:hover {
    background: var(--primary-color);
    color: white;
}

.btn-delete {
    padding: 8px 16px;
    background: transparent;
    color: var(--danger-color);
    border: 2px solid var(--danger-color);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-delete:hover {
    background: var(--danger-color);
    color: white;
}

.results-list {
    margin-top: 20px;
}

.result-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 12px;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.result-card:hover {
    border-color: var(--primary-color);
    background: white;
}

.result-info h4 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.result-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.result-score {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.btn-view-result {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-view-result:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.result-modal-content {
    max-width: 900px;
    max-height: 90vh;
}

.result-details {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Results Table */
.results-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.results-table thead {
    background: var(--bg-color);
    position: sticky;
    top: 0;
}

.results-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    font-size: 14px;
}

.results-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 14px;
}

.results-table tbody tr:hover {
    background: var(--bg-color);
}

.question-cell {
    font-weight: 600;
    color: var(--primary-color);
    width: 100px;
}

.student-answer-cell {
    color: var(--text-primary);
}

.correct-answer-cell {
    color: var(--text-primary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--danger-color);
}

.modal form {
    padding: 24px;
}

.modal-message {
    min-height: 20px;
    margin-bottom: 15px;
    font-size: 14px;
    text-align: center;
}

.modal-message.success {
    color: var(--success-color);
}

.modal-message.error {
    color: var(--danger-color);
}

.student-link-section {
    padding: 24px;
    text-align: center;
}

.student-link-section h4 {
    color: var(--success-color);
    margin-bottom: 16px;
}

.student-link-section p {
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.link-container {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.link-container input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-color);
}

.btn-copy {
    padding: 12px 24px;
    background-color: var(--success-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-copy:hover {
    background-color: #059669;
    transform: translateY(-1px);
}

.card-header .btn-primary svg {
    margin-right: 0;
}

/* Tests List */
.tests-list {
    margin-top: 20px;
}

.test-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.test-item:hover {
    border-color: var(--primary-color);
    background: white;
}

.test-info h4 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.test-meta {
    font-size: 13px;
    color: var(--text-secondary);
}

.btn-view {
    padding: 8px 16px;
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-view:hover {
    background: var(--primary-color);
    color: white;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-back:hover {
    background: var(--card-bg);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Test Container for Student */
.test-container {
    min-height: 100vh;
}

.test-container .test-view-section {
    height: 100vh;
}

/* Test View Section */
.test-view-section {
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* For standalone test pages (student.html, viewtest) */
.test-container .test-view-section {
    height: 100vh;
}

/* For admin panel test view */
.content-section.test-view-section {
    height: 100%;
    flex: 1;
}

.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 */
.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 */
.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;
}

.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);
}

.left-panel {
    flex: 1;
}

.right-panel {
    width: 40%;
    min-width: 300px;
}

.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 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;
}

/* Question Image Container */
.question-image-container {
    margin-top: 20px;
    background: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
}

.question-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    margin-bottom: 24px;
}

.image-answers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.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 */
.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 */
.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);
}

.matching-options {
    margin-top: 24px;
}

.matching-options h4 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

/* Summary Completion / Inline Inputs */
.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;
}

/* Question Table */
.completion-table {
    margin-top: 20px;
}

.completion-table h4 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 16px;
    font-weight: 600;
}

.question-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.question-table th,
.question-table td {
    padding: 16px;
    border: 2px solid var(--border-color);
    text-align: left;
}

.question-table th {
    background: var(--bg-color);
    font-weight: 600;
    color: var(--text-primary);
}

.question-table td {
    color: var(--text-primary);
}

.question-table td strong {
    color: var(--primary-color);
}

.table-input {
    width: 100%;
    min-width: 0;
    margin-right: 8px;
}

/* Checkbox Questions */
.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 */
.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);
}

.small-select {
    min-width: 120px;
    max-width: 150px;
}

/* Section Content & Questions */
.section-content,
.section-questions {
    display: block;
}

.section-content.hidden,
.section-questions.hidden {
    display: none;
}

/* Submit Section */
.submit-section {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 2px solid var(--border-color);
    display: flex;
    justify-content: center;
}

.submit-section .btn-add {
    padding: 14px 40px;
    font-size: 16px;
}

.section-submit-btn {
    min-width: 200px;
}

/* Section Navigation */
.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;
}

/* Text Highlight Toolbar */
.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 */
.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-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.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;
}

/* Overlay for mobile sidebar */
@media (max-width: 768px) {
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }
    
    .modal-content {
        max-height: 95vh;
    }
    
    .link-container {
        flex-direction: column;
    }
    
    .checkbox-options {
        flex-direction: column;
    }
    
    .checkbox-label {
        width: 100%;
    }
    
    .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;
    }
    
    .test-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .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;
    }
}
