/* Root Variables */
:root {
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --secondary-color: #06b6d4;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --text-color: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --hover-bg: #f1f5f9;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #312e81;
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --text-color: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --hover-bg: #334155;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: var(--transition);
    font-size: 16px; /* ✅ Standard base font size for better mobile readability */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

.navbar {
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Hide mobile menu elements on desktop */
.mobile-menu-toggle,
.mobile-menu-overlay {
    display: none;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    cursor: pointer;
}

.nav-brand i {
    font-size: 1.8rem;
}

.nav-links, .nav-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.theme-toggle:hover {
    background-color: var(--bg-color);
}

.hero {
    padding: 4rem 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.hero-content {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-illustration {
    text-align: center;
    margin-top: 3rem;
}

.hero-illustration i {
    font-size: 8rem;
    opacity: 0.2;
}

.features {
    padding: 4rem 0;
}

.features h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature-card {
    background-color: var(--surface-color);
    padding: 2rem;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-card i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-secondary);
}

.feature-card p.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    min-height: 40px; /* Ensure consistent button height */
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 40px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-primary:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #0891b2;
    transform: translateY(-2px);
}

.btn-secondary:focus {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-text {
    background: none;
    color: var(--text-color);
}

.btn-text:hover {
    background-color: var(--bg-color);
}

.btn-text:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Disabled button states */
.btn:disabled,
.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    pointer-events: none;
}

/* Button loading state */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-success {
    background-color: #10b981;
    color: white;
}

.btn-success:hover {
    background-color: #059669;
    transform: translateY(-2px);
}

.btn-info {
    background-color: #3b82f6;
    color: white;
}

.btn-info:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.login-container {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
}

.login-card {
    background-color: var(--surface-color);
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 450px;
    width: 100%;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header i {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.login-header h2 {
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
}

.login-help {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--bg-color);
    border-radius: var(--radius);
    text-align: center;
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    background-color: var(--surface-color);
    color: var(--text-color);
    transition: var(--transition);
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.format-guide {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--bg-color);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--radius);
}

.format-guide strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: 0.5rem;
}

.format-guide ul {
    margin: 0;
    padding-left: 1.5rem;
}

.format-guide li {
    margin-bottom: 0.5rem;
    color: var(--text-color);
    line-height: 1.6;
}

.format-guide li strong {
    display: inline;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
    background-color: var(--surface-color);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}

.error-message {
    white-space: pre-line;
    line-height: 1.6;
    text-align: left;
    max-width: 100%;
    word-wrap: break-word;
    margin: 1rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #991b1b;
    border-radius: 12px;
    border-left: 5px solid #dc2626;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.15);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.95rem;
    display: none;
    animation: slideIn 0.3s ease-out;
}

.error-message.show {
    display: block;
}

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

/* Mobile responsive error messages */
@media (max-width: 768px) {
    .error-message {
        font-size: 0.9rem;
        padding: 1rem;
        margin: 0.5rem 0;
        border-radius: 8px;
    }
}

.success-message {
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: #d4edda;
    color: #155724;
    border-radius: var(--radius);
    border: 1px solid #c3e6cb;
}

.login-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-footer p {
    margin: 0;
    color: var(--text-color);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.login-footer p:first-child {
    margin-top: 0;
}

.login-footer p:last-child {
    margin-bottom: 0;
}

.login-footer a {
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface-color);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.login-footer a:hover {
    background: var(--primary-color);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(79, 70, 229, 0.3);
    border-color: var(--primary-color);
}

.login-footer a:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Enhanced hover effect for better UX */
.login-footer a {
    position: relative;
    overflow: hidden;
}

.login-footer a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.login-footer a:hover::before {
    left: 100%;
}

.lesson-container {
    padding: 2rem 0;
    min-height: calc(100vh - 80px);
}

.lesson-header {
    text-align: center;
    margin-bottom: 2rem;
}

.lesson-progress {
    margin-top: 1rem;
    color: var(--text-secondary);
}

/* ============================================
   ENHANCED VIDEO & MATERIALS SECTION
   ============================================ */

/* Section Title Styling */
.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--primary-color);
}

.section-title i {
    font-size: 1.75rem;
    color: var(--primary-color);
}

.section-title h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
}

.section-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Video Section */
.video-section {
    background: linear-gradient(135deg, var(--surface-color) 0%, rgba(var(--primary-rgb), 0.05) 100%);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 2.5rem;
    border: 1px solid var(--border-color);
}

.video-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.video-wrapper video {
    width: 100%;
    border-radius: var(--radius);
}

#youtube-player-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%; /* Full width on all devices */
}

#youtube-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--radius);
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: white;
    border-radius: var(--radius);
}

.video-overlay i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* OLD fullscreen button (inside video) - DEPRECATED */
.fullscreen-btn {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* NEW fullscreen button (outside video player) */
.fullscreen-btn-external {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.fullscreen-btn-external:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.fullscreen-btn-external:active {
    transform: translateY(0);
}

.fullscreen-btn-external i {
    font-size: 1.2rem;
}

/* Mobile Auto-Rotate Notice */
.mobile-rotate-notice {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    animation: slideIn 0.5s ease-out;
}

.mobile-rotate-notice i {
    font-size: 1.5rem;
    flex-shrink: 0;
}

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

/* Video Info Card */
.video-info-card {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 1.25rem;
    border-radius: 8px;
    margin-top: 1rem;
    border: 1px solid var(--border-color);
}

.info-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: rgba(79, 70, 229, 0.1);
    border-radius: 6px;
}

.info-content i {
    color: var(--primary-color);
    font-size: 1.25rem;
}

.info-content p {
    margin: 0;
    color: var(--text-color);
    font-weight: 500;
}

.video-time-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-weight: 600;
    color: var(--text-color);
}

.video-time-display i {
    color: var(--primary-color);
}

/* Materials Section */
.materials-section {
    background: linear-gradient(135deg, var(--surface-color) 0%, rgba(34, 197, 94, 0.05) 100%);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 2.5rem;
    border: 1px solid var(--border-color);
}

.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.video-wrapper:fullscreen .fullscreen-btn i::before,
.video-wrapper:fullscreen .fullscreen-btn-external i::before {
    content: "\f066"; /* fa-compress icon */
}

.video-wrapper:-webkit-full-screen .fullscreen-btn i::before,
.video-wrapper:-webkit-full-screen .fullscreen-btn-external i::before {
    content: "\f066";
}

.video-wrapper:-moz-full-screen .fullscreen-btn i::before,
.video-wrapper:-moz-full-screen .fullscreen-btn-external i::before {
    content: "\f066";
}

.video-wrapper:-ms-fullscreen .fullscreen-btn i::before,
.video-wrapper:-ms-fullscreen .fullscreen-btn-external i::before {
    content: "\f066";
}

.video-info {
    margin-top: 1rem;
    text-align: center;
}

/* Video Complete Section */
.video-complete-section {
    max-width: 600px;
    margin: 2rem auto;
}

.completion-card {
    background-color: var(--surface-color);
    padding: 3rem 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.completion-icon {
    font-size: 4rem;
    color: var(--success-color);
    margin-bottom: 1.5rem;
}

.completion-card h3 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.completion-card p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.completion-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    min-width: 200px;
}

/* Assessment Instructions */
.instructions-content {
    margin-bottom: 1.5rem;
}

.instruction-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-color);
    border-radius: var(--radius);
    align-items: flex-start;
}

.instruction-item > i {
    font-size: 1.5rem;
    color: var(--primary-color);
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.instruction-item strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-size: 1.05rem;
}

.instruction-item p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.instruction-item ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.5rem;
}

.instruction-item li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.instructions-warning {
    padding: 1rem;
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: var(--radius);
    color: #856404;
    line-height: 1.6;
}

[data-theme="dark"] .instructions-warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

/* ============================================
   DARK MODE - ENHANCED VIDEO & MATERIALS
   ============================================ */

[data-theme="dark"] .video-card {
    background-color: var(--surface-color);
}

[data-theme="dark"] .video-info-card {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .info-content {
    background-color: rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .materials-section {
    background: linear-gradient(135deg, var(--surface-color) 0%, rgba(34, 197, 94, 0.08) 100%);
}

/* Assessment Tabs */
.assessment-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.75rem 1rem;
    background-color: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    color: var(--primary-color);
    background-color: var(--bg-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.tab-btn i {
    font-size: 1rem;
}

.assessment-tab-content {
    display: none;
}

.assessment-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Assessment Pages System */
.assessment-pages-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-color);
    border-radius: var(--radius);
}

.pages-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1;
}

.page-tab {
    padding: 0.75rem 1.25rem;
    background-color: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.page-tab.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

#assessment-pages-container {
    position: relative;
}

.assessment-page {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.assessment-page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--bg-color);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary-color);
}

.page-header h4 {
    margin: 0;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.video-progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px;
    margin: 1rem 0;
    overflow: hidden;
}

.video-progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

/* ============================================
   ASSESSMENT SECTION - WITH COPY/PASTE PROTECTION
   ============================================ */

.assessment-section {
    background-color: var(--surface-color);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    
    /* 🔒 DISABLE TEXT SELECTION */
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE10+/Edge */
    user-select: none; /* Standard */
    
    /* 🔒 DISABLE CONTEXT MENU (Right-click) */
    -webkit-touch-callout: none; /* iOS Safari */
}

/* Ensure inputs and textareas in assessment remain functional but protected */
.assessment-section input[type="radio"],
.assessment-section input[type="checkbox"],
.assessment-section textarea,
.assessment-section input[type="text"] {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.assessment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.quiz-timer {
    display: none; /* Hidden - using sticky timer instead */
}

.assessment-section .quiz-timer {
    display: none !important; /* Ensure it's hidden */
}

.sticky-timer {
    position: sticky;
    top: 0;
    background-color: var(--bg-color);
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    z-index: 1;
}

.question-card {
    background-color: var(--bg-color);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.question-text {
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    line-height: 1.6;
}

.question-number {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.15rem;
}

.answer-option {
    display: flex;
    align-items: center;
    padding: 1rem;
    background-color: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.answer-option:hover {
    border-color: var(--primary-color);
}

.answer-option input[type="radio"] {
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.option-letter {
    font-weight: 700;
    color: var(--primary-color);
    margin-right: 0.75rem;
    font-size: 1.05rem;
    flex-shrink: 0;
    min-width: 30px;
}

.option-text {
    flex: 1;
    line-height: 1.5;
}

.results-section {
    background-color: var(--surface-color);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.results-card {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.results-icon {
    font-size: 5rem;
    color: var(--success-color);
    margin-bottom: 1rem;
}

.score-display {
    margin: 2rem 0;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.score-circle span {
    font-size: 2.5rem;
    font-weight: bold;
    color: white;
}

.results-details {
    text-align: left;
    margin: 2rem 0;
}

.dashboard-container {
    min-height: calc(100vh - 80px);
}

.dashboard-container .container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    padding-top: 2rem;
}

.dashboard-sidebar {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.menu-item {
    padding: 1rem;
    border: none;
    background: none;
    text-align: left;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-color);
    font-size: 1rem;
}

.menu-item:hover {
    background-color: var(--bg-color);
}

.menu-item.active {
    background-color: var(--primary-color);
    color: white;
}

.dashboard-content {
    min-height: 500px;
}

.dashboard-section {
    display: none;
}

.dashboard-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--surface-color);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-card i {
    font-size: 3rem;
    color: var(--primary-color);
}

.stat-info h3 {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.stat-info p {
    color: var(--text-secondary);
}

.table-container {
    background-color: var(--surface-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background-color: var(--bg-color);
}

.data-table th, .data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 600;
}

.data-table tbody tr:hover {
    background-color: var(--bg-color);
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.lessons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.lesson-card {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.lesson-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.lesson-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.lesson-code {
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.lesson-card-body h3 {
    margin-bottom: 0.5rem;
}

.lesson-card-footer {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

.empty-state-card {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state-card i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.group-header {
    background-color: var(--primary-color) !important;
}

.group-header td {
    background-color: var(--primary-color) !important;
    color: white !important;
    font-weight: 600 !important;
    padding: 0.75rem !important;
}

.group-header:hover {
    background-color: var(--primary-dark) !important;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 999;
}

.modal-overlay.active {
    display: block;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--surface-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.modal.active {
    display: block;
}

.modal-large {
    max-width: 700px;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal form, .result-details-content {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* ========================================
   MOBILE & TABLET RESPONSIVE STYLES
   ======================================== */

/* Tablet Styles (768px - 1024px) */
@media (max-width: 1024px) {
    .container {
        padding: 0 15px;
    }
    
    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .modal-content {
        max-width: 90%;
        margin: 2rem auto;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .form-row .form-group {
        width: 100%;
    }
}

/* Mobile Styles (max-width: 768px) - STUDENT PORTAL ONLY */
@media (max-width: 768px) {
    /* Typography */
    .hero h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    h4 {
        font-size: 1.1rem;
    }
    
    /* Navigation */
    .navbar {
        padding: 0.75rem 0;
    }
    
    .nav-brand {
        font-size: 1.25rem;
    }
    
    .nav-brand i {
        font-size: 1.5rem;
    }
    
    .nav-links {
        gap: 0.5rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
    }
    
    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .hero-buttons .btn {
        width: 100%;
    }
    
    /* Feature Grid */
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .feature-card {
        padding: 1.5rem;
    }
    
    /* Forms */
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-control, textarea, select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }
    
    textarea {
        min-height: 150px;
    }
    
    /* Login/Register */
    .login-container {
        padding: 1rem;
    }
    
    .login-card {
        padding: 1.5rem;
    }
    
    /* Video Section - BIGGER */
    #video-container {
        height: auto;
        max-height: 75vh; /* ✅ Bigger video player */
    }
    
    .video-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .video-controls .btn {
        flex: 1;
        min-width: 120px;
    }
    
    /* Assessment */
    .question-card {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .answer-option {
        padding: 0.75rem;
        font-size: 0.95rem;
    }
    
    .quiz-navigation {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .quiz-navigation .btn {
        width: 100%;
    }
    
    .page-indicator {
        order: -1;
        text-align: center;
        padding: 0.75rem;
    }
    
    /* Assessment Pages */
    .assessment-pages-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .pages-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
    }
    
    .page-tab {
        white-space: nowrap;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .page-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    /* Materials */
    .material-field {
        padding: 1rem !important;
    }
    
    .materials-grid {
        grid-template-columns: 1fr;
    }
    
    /* Results */
    .result-details-content {
        padding: 1rem;
    }
    
    /* Timer */
    .quiz-timer {
        font-size: 1.25rem;
        padding: 0.75rem;
    }
    
    /* Student Portal - Lesson View */
    .lesson-header {
        padding: 1rem;
    }
    
    .lesson-header h2 {
        font-size: 1.35rem;
        margin-bottom: 0.5rem;
    }
    
    .lesson-meta {
        font-size: 0.9rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .lesson-content {
        padding: 1rem;
    }
    
    .content-section {
        margin-bottom: 1.5rem;
    }
    
    .content-section h3 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }
    
    /* Student Info Display */
    .student-info {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    /* Materials Section */
    .materials-list {
        gap: 0.75rem;
    }
    
    .material-item {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .material-item i {
        font-size: 1.25rem;
    }
    
    /* Lesson Status */
    #lesson-status {
        font-size: 0.95rem;
        padding: 0.75rem;
    }
}

/* Small Mobile Styles (max-width: 480px) */
@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .nav-brand {
        font-size: 1.1rem;
    }
    
    .nav-brand span {
        display: none;
    }
    
    .btn {
        padding: 0.65rem 1rem;
        font-size: 0.9rem;
    }
    
    .modal-content {
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }
    
    /* Dashboard - DESKTOP ONLY (No Small Mobile Styles) */
    
    /* Student Portal - Small Mobile */
    .lesson-header {
        padding: 0.75rem;
    }
    
    .lesson-header h2 {
        font-size: 1.2rem;
    }
    
    .lesson-meta {
        font-size: 0.85rem;
    }
    
    .lesson-content {
        padding: 0.75rem;
    }
    
    .student-info {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    
    #video-container {
        height: auto;
        max-height: 70vh; /* ✅ Bigger video player */
    }
    
    .question-number {
        font-size: 1rem;
    }
    
    .option-letter {
        min-width: 30px;
    }
    
    /* Tables and Buttons - DESKTOP ONLY (No Small Mobile Styles) */
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    #video-container {
        height: auto;
        max-height: 85vh; /* ✅ Bigger video player */
    }
    
    .modal-content {
        max-height: 95vh;
    }
}

/* Quiz Navigation Styles */
#quiz-navigation {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

#page-indicator {
    text-align: center;
    color: var(--text-color);
    font-weight: bold;
    min-width: 120px;
}

#prev-page-btn,
#next-page-btn {
    flex: 1;
    min-width: 120px;
}

#submit-quiz-btn {
    width: 100%;
}

/* Mobile Quiz Navigation */
@media (max-width: 768px) {
    #quiz-navigation {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    #prev-page-btn,
    #next-page-btn,
    #submit-quiz-btn {
        width: 100%;
        flex: none;
    }
    
    #page-indicator {
        order: -1;
        width: 100%;
        padding: 0.5rem;
        background: var(--bg-secondary);
        border-radius: var(--radius);
    }
}

/* Fullscreen Button Mobile Fix */
.fullscreen-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.75rem 1.5rem;
}

@media (max-width: 768px) {
    .fullscreen-btn {
        width: 100%;
        margin-top: 0.5rem;
    }
}

/* Touch-friendly improvements - STUDENT PORTAL ONLY */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets for student portal only */
    .btn:not(.dashboard-section .btn):not(.section-header .btn):not(.menu-item), .page-tab {
        min-height: 44px;
        min-width: 44px;
    }
    
    .answer-option {
        min-height: 50px;
    }
    
    input[type="radio"],
    input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }
    
    /* Remove hover effects on touch devices - student portal only */
    .btn:not(.dashboard-section .btn):not(.section-header .btn):not(.menu-item):hover {
        transform: none;
    }
    
    /* Add active states for touch feedback - student portal only */
    .btn:not(.dashboard-section .btn):not(.section-header .btn):not(.menu-item):active {
        transform: scale(0.98);
    }
}

/* ============================================ */
/* COMPREHENSIVE MOBILE IMPROVEMENTS */
/* ============================================ */

/* Navbar Mobile Improvements */
@media (max-width: 768px) {
    .navbar {
        padding: 0.75rem 0;
    }
    
    .nav-brand {
        font-size: 1.25rem;
    }
    
    .nav-links {
        gap: 0.5rem;
    }
    
    .nav-links .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* Login/Register Mobile */
@media (max-width: 768px) {
    .login-container {
        padding: 1rem;
        min-height: 100vh;
        display: flex;
        align-items: center;
    }
    
    .login-card {
        width: 100%;
        max-width: 100%;
        padding: 1.5rem;
        margin: 0;
    }
    
    .login-card h2 {
        font-size: 1.5rem;
    }
    
    .form-tabs {
        gap: 0.5rem;
    }
    
    .form-tab {
        flex: 1;
        padding: 0.75rem;
        font-size: 0.95rem;
    }
}

/* ============================================ */
/* TEACHER DASHBOARD MOBILE-FIRST DESIGN */
/* ============================================ */

/* Mobile Navigation & Hamburger Menu */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.mobile-menu-toggle:hover {
    background-color: var(--bg-color);
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 80px; /* Start below navbar */
    left: 280px; /* Start after sidebar width */
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040; /* Lower than sidebar but higher than content */
    opacity: 0;
    transition: opacity 0.3s ease;
    /* Only allow clicks on the overlay itself, not on sidebar area */
    pointer-events: auto;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
    /* When active, cover the area to the right of sidebar */
    left: 280px;
}

/* Mobile Dashboard Layout - Enhanced Scrolling */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    /* Ensure full viewport scrolling */
    body {
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        /* Safe area support */
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .dashboard-container {
        /* Ensure container can scroll */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        /* Full height minus navbar */
        min-height: calc(100vh - 80px);
    }
    
    .dashboard-container .container {
        grid-template-columns: 1fr;
        gap: 0;
        padding-top: 0;
        /* Ensure content doesn't get cut off */
        padding-bottom: 2rem;
    }
    
    .dashboard-sidebar {
        position: fixed;
        top: 80px; /* Start below navbar */
        left: -280px;
        width: 280px;
        height: calc(100vh - 80px); /* Adjust height to account for navbar */
        background-color: var(--surface-color);
        z-index: 9998 !important; /* Maximum z-index */
        transition: left 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        padding: 1rem;
        /* Force sidebar to be interactive */
        pointer-events: auto !important;
        /* Debug background */
        border: 2px solid red !important;
    }
    
    .dashboard-sidebar.active {
        left: 0;
        /* Ensure active sidebar is fully interactive */
        pointer-events: auto;
    }
    
    .sidebar-menu {
        flex-direction: column;
        gap: 0.5rem;
        padding-top: 0.5rem; /* Reduced since sidebar now starts below navbar */
        /* Ensure menu is interactive */
        pointer-events: auto;
    }
    
    .menu-item {
        width: 100% !important;
        padding: 1rem !important;
        text-align: left !important;
        border-radius: 8px !important;
        font-size: 1rem !important;
        min-height: 48px !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.75rem !important;
        transition: all 0.2s ease !important;
        /* Force button properties */
        background: none !important;
        border: none !important;
        color: var(--text-color) !important;
        font-family: inherit !important;
        /* Enhanced touch interaction */
        cursor: pointer !important;
        pointer-events: auto !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
        user-select: none !important;
        -webkit-user-select: none !important;
        /* Ensure always clickable */
        position: relative !important;
        z-index: 1060 !important; /* Higher than sidebar */
    }
    
    .menu-item i {
        font-size: 1.2rem;
        width: 20px;
        text-align: center;
    }
    
    .menu-item:hover {
        background-color: var(--bg-color) !important;
        transform: translateX(4px) !important;
    }
    
    .menu-item.active {
        background-color: var(--primary-color) !important;
        color: white !important;
        box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3) !important;
    }
    
    .menu-item:active {
        transform: scale(0.98) !important;
        background-color: var(--primary-color) !important;
        color: white !important;
    }
    
    .dashboard-content {
        padding: 1rem;
        margin-top: 0;
        /* Enhanced scrolling for dashboard content */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        /* Ensure content doesn't get cut off by mobile UI */
        padding-bottom: 2rem;
        /* Safe area support */
        padding-bottom: calc(2rem + env(safe-area-inset-bottom));
    }
    
    /* Dashboard sections scroll optimization */
    .dashboard-section {
        /* Ensure sections can scroll if content is long */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        /* Better scroll performance */
        will-change: scroll-position;
    }
}

/* Mobile Stats Grid */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.5rem;
        display: flex;
        align-items: center;
        gap: 1rem;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        transition: transform 0.2s ease;
    }
    
    .stat-card:active {
        transform: scale(0.98);
    }
    
    .stat-card i {
        font-size: 2.5rem;
        color: var(--primary-color);
        flex-shrink: 0;
    }
    
    .stat-info {
        flex: 1;
    }
    
    .stat-info h3 {
        font-size: 2rem;
        margin-bottom: 0.25rem;
        color: var(--primary-color);
    }
    
    .stat-info p {
        font-size: 0.9rem;
        color: var(--text-secondary);
        margin: 0;
    }
}

@media (max-width: 480px) {
    .stat-card {
        flex-direction: column;
        text-align: center;
        padding: 1.25rem;
    }
    
    .stat-card i {
        font-size: 3rem;
    }
    
    .stat-info h3 {
        font-size: 2.5rem;
    }
}

/* Mobile Section Headers */
@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
        padding: 1rem;
        background-color: var(--surface-color);
        border-radius: 12px;
        margin-bottom: 1.5rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    
    .section-header h2 {
        font-size: 1.4rem;
        margin-bottom: 0;
        color: var(--text-color);
    }
    
    .section-header > div {
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .section-header .btn {
        flex: 1;
        min-width: 140px;
        min-height: 48px;
        font-size: 0.9rem;
        font-weight: 600;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        transition: all 0.2s ease;
    }
    
    .section-header .btn:active {
        transform: scale(0.98);
    }
}

/* Mobile Lessons Grid */
@media (max-width: 768px) {
    .lessons-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .lesson-card {
        padding: 1.5rem;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        transition: all 0.2s ease;
    }
    
    .lesson-card:active {
        transform: scale(0.98);
    }
    
    .lesson-card-header {
        flex-wrap: wrap;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .lesson-card-body h3 {
        font-size: 1.2rem;
        margin-bottom: 0.75rem;
        line-height: 1.3;
    }
    
    .lesson-info {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
        color: var(--text-secondary);
    }
    
    .lesson-card-footer {
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1.25rem;
    }
    
    .lesson-card-footer .btn {
        width: 100%;
        min-height: 48px;
        font-size: 0.9rem;
        font-weight: 600;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }
}

/* Mobile Dashboard Tables - Compact Design with Scrolling */
@media (max-width: 768px) {
    /* Students, In Progress, Results Tables - NO STICKY BUTTONS */
    #students-section .table-container,
    #in-progress-section .table-container,
    #results-section-teacher .table-container {
        overflow-x: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        border-radius: 8px;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
        margin: 0 -0.5rem;
        padding: 0 0.5rem;
        /* Enhanced scroll performance */
        will-change: scroll-position;
        /* Compact height for more content visibility */
        max-height: 65vh;
        scroll-behavior: smooth;
        /* Compact spacing */
        font-size: 0.8rem;
    }
    
    /* Compact table design for dashboard tabs */
    #students-section .data-table,
    #in-progress-section .data-table,
    #results-section-teacher .data-table {
        min-width: 600px;
        font-size: 0.75rem; /* Smaller font */
        line-height: 1.3;
    }
    
    #students-section .data-table th,
    #in-progress-section .data-table th,
    #results-section-teacher .data-table th {
        padding: 0.5rem 0.4rem; /* Reduced padding */
        font-size: 0.7rem; /* Smaller header font */
        font-weight: 600;
        text-align: left;
        background-color: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color); /* Thinner border */
        white-space: nowrap;
        /* NO STICKY - Let it scroll naturally */
        position: static;
        z-index: auto;
    }
    
    #students-section .data-table td,
    #in-progress-section .data-table td,
    #results-section-teacher .data-table td {
        padding: 0.4rem 0.4rem; /* Very compact padding */
        white-space: nowrap;
        border-bottom: 1px solid var(--border-color);
        font-size: 0.75rem; /* Smaller content font */
        line-height: 1.2;
    }
    
    /* Other tables keep normal styling */
    .data-table:not(#students-section .data-table):not(#in-progress-section .data-table):not(#results-section-teacher .data-table) {
        min-width: 700px;
        font-size: 0.9rem;
    }
    
    .data-table th:not(#students-section .data-table th):not(#in-progress-section .data-table th):not(#results-section-teacher .data-table th) {
        padding: 1rem 0.75rem;
        font-size: 0.85rem;
        font-weight: 600;
        text-align: left;
        background-color: var(--bg-secondary);
        border-bottom: 2px solid var(--border-color);
        white-space: nowrap;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    .data-table td:not(#students-section .data-table td):not(#in-progress-section .data-table td):not(#results-section-teacher .data-table td) {
        padding: 1rem 0.75rem;
        white-space: nowrap;
        border-bottom: 1px solid var(--border-color);
    }
    
    /* Compact buttons for dashboard tables - NO STICKY */
    #students-section .data-table .btn,
    #in-progress-section .data-table .btn,
    #results-section-teacher .data-table .btn {
        padding: 0.3rem 0.5rem; /* Much smaller padding */
        font-size: 0.7rem; /* Smaller font */
        min-width: 36px; /* Smaller width */
        min-height: 36px; /* Smaller height */
        margin: 0.1rem; /* Reduced margin */
        border-radius: 6px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        -webkit-user-select: none;
        /* NO STICKY - scroll naturally */
        position: static;
        z-index: auto;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    }
    
    #students-section .data-table .btn i,
    #in-progress-section .data-table .btn i,
    #results-section-teacher .data-table .btn i {
        font-size: 0.8rem; /* Smaller icons */
        pointer-events: none;
    }
    
    #students-section .data-table td:last-child,
    #in-progress-section .data-table td:last-child,
    #results-section-teacher .data-table td:last-child {
        min-width: 120px; /* Narrower action column */
        text-align: center;
        /* NO STICKY - let it scroll with content */
        position: static;
        background: transparent;
        border-left: none;
    }
    
    /* Other table buttons keep normal styling */
    .data-table .btn:not(#students-section .data-table .btn):not(#in-progress-section .data-table .btn):not(#results-section-teacher .data-table .btn) {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
        min-width: 48px;
        min-height: 48px;
        margin: 0.25rem;
        border-radius: 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        -webkit-user-select: none;
        position: relative;
        z-index: 10;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .data-table .btn:active {
        transform: scale(0.95);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    }
    
    .data-table .btn:focus {
        outline: 2px solid var(--primary-color);
        outline-offset: 1px;
    }
    
    .data-table .btn i:not(#students-section .data-table .btn i):not(#in-progress-section .data-table .btn i):not(#results-section-teacher .data-table .btn i) {
        font-size: 1rem;
        pointer-events: none;
    }
    
    .data-table td:last-child:not(#students-section .data-table td:last-child):not(#in-progress-section .data-table td:last-child):not(#results-section-teacher .data-table td:last-child) {
        min-width: 160px;
        text-align: center;
        position: sticky;
        right: 0;
        background: var(--surface-color);
        border-left: 1px solid var(--border-color);
    }
}

/* Mobile Dashboard Sections - Compact Design */
@media (max-width: 768px) {
    /* Compact section headers for Students, In Progress, Results */
    #students-section .section-header,
    #in-progress-section .section-header,
    #results-section-teacher .section-header {
        padding: 0.75rem !important;
        margin-bottom: 0.5rem !important;
        background: var(--surface-color) !important;
        border-radius: 8px !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    }
    
    #students-section .section-header h2,
    #in-progress-section .section-header h2,
    #results-section-teacher .section-header h2 {
        font-size: 1.1rem !important; /* Smaller header */
        margin: 0 !important;
    }
    
    /* Compact search containers */
    #students-section .dashboard-section > div[style*="padding"],
    #in-progress-section .dashboard-section > div[style*="padding"],
    #results-section-teacher .dashboard-section > div[style*="padding"] {
        padding: 0.75rem !important;
        background: var(--surface-color) !important;
        border-radius: 8px !important;
        margin-bottom: 0.75rem !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    }
    
    /* Other sections keep normal styling */
    .dashboard-section > div[style*="padding"]:not(#students-section .dashboard-section > div):not(#in-progress-section .dashboard-section > div):not(#results-section-teacher .dashboard-section > div) {
        padding: 1rem !important;
        background: var(--surface-color) !important;
        border-radius: 12px !important;
        margin-bottom: 1.5rem !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
    }
    
    /* Compact search inputs for dashboard tabs */
    #student-search-input,
    #progress-search-input,
    #results-search-input {
        width: 100% !important;
        min-height: 40px !important; /* Smaller height */
        padding: 0.6rem 0.75rem !important; /* Reduced padding */
        font-size: 14px !important; /* Smaller font but still prevents iOS zoom */
        border: 1px solid var(--border-color) !important;
        border-radius: 6px !important; /* Smaller radius */
        background-color: var(--bg-color) !important;
        transition: all 0.2s ease !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important; /* Subtler shadow */
    }
    
    #student-search-input:focus,
    #progress-search-input:focus,
    #results-search-input:focus {
        outline: none !important;
        border-color: var(--primary-color) !important;
        box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1), 0 1px 2px rgba(0, 0, 0, 0.1) !important; /* Smaller focus ring */
        transform: translateY(-1px) !important;
    }
}

/* Mobile Progress & Results Sections */
@media (max-width: 768px) {
    /* Progress section optimizations */
    #in-progress-section .table-container,
    #results-section-teacher .table-container {
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        overflow: hidden;
    }
    
    /* Results table mobile optimization */
    #results-section-teacher .data-table {
        min-width: 800px; /* Wider for more columns */
    }
    
    /* Empty state improvements */
    .empty-state,
    .empty-state-card {
        padding: 2rem 1rem !important;
        text-align: center !important;
        color: var(--text-secondary) !important;
        font-size: 1rem !important;
        border-radius: 12px !important;
        background: var(--surface-color) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
    }
    
    .empty-state-card i {
        font-size: 3rem !important;
        color: var(--text-secondary) !important;
        margin-bottom: 1rem !important;
        opacity: 0.5 !important;
    }
}

/* Mobile Responsive Improvements for Small Screens */
@media (max-width: 480px) {
    .dashboard-content {
        padding: 0.75rem;
    }
    
    .section-header {
        padding: 0.75rem;
    }
    
    .section-header h2 {
        font-size: 1.25rem;
    }
    
    .section-header .btn {
        min-width: 120px;
        font-size: 0.85rem;
        padding: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .lesson-card {
        padding: 1.25rem;
    }
    
    .modal-header {
        padding: 0.75rem 1rem !important;
    }
    
    .modal-body,
    .modal form {
        padding: 1rem !important;
        padding-bottom: 5rem !important;
    }
    
    .modal-actions {
        padding: 0.75rem 1rem !important;
    }
}

/* Mobile Teacher Dashboard Modals - CRITICAL SCROLLING FIX */
@media (max-width: 768px) {
    /* LESSON MODALS: Create & Edit - Full Scrolling Access */
    #add-lesson-modal,
    #edit-lesson-modal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        transform: none !important;
        z-index: 1001 !important;
        /* CRITICAL: Full modal scrolling to access ALL buttons */
        overflow-y: scroll !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
        scroll-behavior: smooth !important;
        will-change: scroll-position !important;
        /* Ensure content flows naturally */
        display: block !important;
        padding: 0 !important;
    }
    
    /* All other modals - Enhanced scrolling */
    .modal:not(#add-lesson-modal):not(#edit-lesson-modal) {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        transform: none !important;
        display: flex !important;
        flex-direction: column !important;
        z-index: 1001 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
        scroll-behavior: smooth !important;
        will-change: scroll-position !important;
    }
    
    /* Lesson modal active states */
    #add-lesson-modal.active,
    #edit-lesson-modal.active {
        display: block !important;
    }
    
    .modal.active {
        display: flex !important;
    }
    
    .modal:not(.active) {
        display: none !important;
    }
    
    /* LESSON MODAL CONTENT: Ensure all content is scrollable and accessible */
    #add-lesson-modal .modal-header,
    #edit-lesson-modal .modal-header {
        position: sticky !important;
        top: 0 !important;
        z-index: 1010 !important;
        background: var(--surface-color) !important;
        border-bottom: 1px solid var(--border-color) !important;
        padding: 1rem 1.5rem !important;
        flex-shrink: 0 !important;
    }
    
    #add-lesson-modal .modal-body,
    #edit-lesson-modal .modal-body,
    #add-lesson-modal form,
    #edit-lesson-modal form {
        padding: 1.5rem !important;
        padding-bottom: 2rem !important;
        /* Allow natural content flow */
        overflow: visible !important;
        min-height: auto !important;
        flex: none !important;
    }
    
    #add-lesson-modal .modal-actions,
    #edit-lesson-modal .modal-actions {
        position: relative !important;
        background: var(--surface-color) !important;
        border-top: 1px solid var(--border-color) !important;
        padding: 1.5rem !important;
        margin-top: 1rem !important;
        /* Ensure buttons are always accessible */
        flex-shrink: 0 !important;
        display: flex !important;
        flex-direction: column-reverse !important;
        gap: 0.75rem !important;
    }
    
    /* LESSON MODAL BUTTONS: Always accessible via scroll */
    #add-lesson-modal .modal-actions .btn,
    #edit-lesson-modal .modal-actions .btn {
        width: 100% !important;
        min-height: 52px !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        border-radius: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.5rem !important;
        transition: all 0.2s ease !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
        /* Ensure buttons are always clickable */
        pointer-events: auto !important;
        position: relative !important;
        z-index: 1020 !important;
    }
    
    #add-lesson-modal .modal-actions .btn:active,
    #edit-lesson-modal .modal-actions .btn:active {
        transform: scale(0.98) !important;
    }
    
    /* Modal Header - Sticky */
    .modal-header {
        flex-shrink: 0 !important;
        padding: 1rem 1.5rem !important;
        background: var(--surface-color) !important;
        border-bottom: 1px solid var(--border-color) !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 20 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: wrap !important;
        gap: 1rem !important;
    }
    
    .modal-header h3 {
        font-size: 1.3rem !important;
        margin: 0 !important;
        flex: 1 !important;
        min-width: 0 !important;
    }
    
    .modal-header .btn {
        flex-shrink: 0 !important;
        min-height: 44px !important;
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem !important;
        border-radius: 8px !important;
    }
    
    /* Modal Body - Enhanced Scrolling Support */
    .modal-body,
    .modal form {
        flex: 1 !important;
        /* Allow content to expand and scroll naturally */
        overflow: visible !important;
        padding: 1.5rem !important;
        padding-bottom: 1.5rem !important;
        /* Ensure content can scroll properly */
        min-height: auto !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
        /* Better content flow */
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    /* Specific scrolling for Create/Edit Lesson modals */
    #add-lesson-modal .modal-body,
    #edit-lesson-modal .modal-body,
    #add-lesson-modal form,
    #edit-lesson-modal form {
        /* Ensure lesson modals can scroll all content */
        overflow: visible !important;
        min-height: fit-content !important;
        flex-grow: 1 !important;
    }
    
    /* Ensure content doesn't get cut off */
    .modal-body > *,
    .modal form > * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Modal Actions - Scrollable with Content */
    .modal-actions {
        flex-shrink: 0 !important;
        position: relative !important; /* Changed from fixed to relative */
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        width: 100% !important;
        background: var(--surface-color) !important;
        border-top: 1px solid var(--border-color) !important;
        padding: 1rem 1.5rem !important;
        /* Safe area support for devices with notches */
        padding-bottom: calc(1rem + env(safe-area-inset-bottom)) !important;
        display: flex !important;
        flex-direction: column-reverse !important;
        gap: 0.75rem !important;
        z-index: 1002 !important;
        box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.15) !important;
        /* Ensure proper spacing */
        margin-top: 1rem !important;
        /* Better backdrop */
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
    }
    
    .modal-actions .btn {
        width: 100% !important;
        min-height: 52px !important; /* Larger for better accessibility */
        font-size: 1rem !important;
        font-weight: 600 !important;
        border-radius: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.5rem !important;
        transition: all 0.2s ease !important;
        /* Enhanced touch accessibility */
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
        user-select: none !important;
        -webkit-user-select: none !important;
        /* Ensure buttons are always clickable */
        position: relative !important;
        z-index: 1003 !important;
        /* Better visual feedback */
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    }
    
    .modal-actions .btn:active {
        transform: scale(0.98) !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
    }
    
    .modal-actions .btn:focus {
        outline: 2px solid var(--primary-color) !important;
        outline-offset: 2px !important;
    }
    
    /* Enhanced scroll indicators for lesson modals */
    .modal::-webkit-scrollbar,
    .modal-body::-webkit-scrollbar,
    .modal form::-webkit-scrollbar,
    .table-container::-webkit-scrollbar,
    .dashboard-content::-webkit-scrollbar,
    #add-lesson-modal::-webkit-scrollbar,
    #edit-lesson-modal::-webkit-scrollbar {
        width: 6px !important; /* Slightly wider for better visibility */
        height: 6px !important;
    }
    
    .modal::-webkit-scrollbar-track,
    .modal-body::-webkit-scrollbar-track,
    .modal form::-webkit-scrollbar-track,
    .table-container::-webkit-scrollbar-track,
    .dashboard-content::-webkit-scrollbar-track,
    #add-lesson-modal::-webkit-scrollbar-track,
    #edit-lesson-modal::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.1) !important;
        border-radius: 3px !important;
    }
    
    .modal::-webkit-scrollbar-thumb,
    .modal-body::-webkit-scrollbar-thumb,
    .modal form::-webkit-scrollbar-thumb,
    .table-container::-webkit-scrollbar-thumb,
    .dashboard-content::-webkit-scrollbar-thumb,
    #add-lesson-modal::-webkit-scrollbar-thumb,
    #edit-lesson-modal::-webkit-scrollbar-thumb {
        background: var(--primary-color) !important;
        border-radius: 3px !important;
        opacity: 0.8 !important;
    }
    
    .modal::-webkit-scrollbar-thumb:hover,
    .modal-body::-webkit-scrollbar-thumb:hover,
    .modal form::-webkit-scrollbar-thumb:hover,
    .table-container::-webkit-scrollbar-thumb:hover,
    .dashboard-content::-webkit-scrollbar-thumb:hover,
    #add-lesson-modal::-webkit-scrollbar-thumb:hover,
    #edit-lesson-modal::-webkit-scrollbar-thumb:hover {
        opacity: 1 !important;
        background: var(--primary-color) !important;
    }
    
    /* Form Elements in Modals */
    .modal .form-group {
        margin-bottom: 1.5rem !important;
    }
    
    .modal .form-group label {
        font-size: 1rem !important;
        font-weight: 600 !important;
        margin-bottom: 0.5rem !important;
        display: block !important;
        color: var(--text-color) !important;
    }
    
    .modal .form-control,
    .modal input,
    .modal select,
    .modal textarea {
        width: 100% !important;
        min-height: 48px !important;
        padding: 0.875rem !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
        border: 1px solid var(--border-color) !important;
        border-radius: 8px !important;
        background-color: var(--bg-color) !important;
        transition: border-color 0.2s ease !important;
    }
    
    .modal .form-control:focus,
    .modal input:focus,
    .modal select:focus,
    .modal textarea:focus {
        outline: none !important;
        border-color: var(--primary-color) !important;
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1) !important;
    }
    
    .modal textarea {
        min-height: 120px !important;
        resize: vertical !important;
    }
    
    /* Grid layouts in modals */
    .modal .form-group div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Enhanced scrolling for lesson modal content */
    .modal #videos-container,
    .modal #documents-container {
        gap: 1rem !important;
        /* Ensure containers can expand and scroll */
        overflow: visible !important;
        max-height: none !important;
    }
    
    .modal .video-input-group,
    .modal .document-input-group {
        padding: 1rem !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 8px !important;
        background: var(--bg-secondary) !important;
        margin-bottom: 1rem !important;
        /* Ensure input groups don't restrict scrolling */
        overflow: visible !important;
    }
    
    /* Assessment pages in modals - Enhanced scrolling */
    .modal .assessment-page {
        margin-bottom: 1.5rem !important;
        padding: 1rem !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 8px !important;
        background: var(--bg-secondary) !important;
        /* Allow assessment pages to expand fully */
        overflow: visible !important;
        max-height: none !important;
    }
    
    .modal .assessment-page textarea {
        min-height: 150px !important;
        /* Ensure textareas can expand */
        max-height: none !important;
        resize: vertical !important;
    }
    
    /* Assessment tabs container scrolling */
    .modal #assessment-pages-container {
        overflow: visible !important;
        max-height: none !important;
        /* Allow full expansion of assessment content */
        flex-grow: 1 !important;
    }
    
    /* Form groups in lesson modals */
    .modal .form-group {
        overflow: visible !important;
        /* Ensure form groups don't restrict content */
        max-height: none !important;
    }
    
    /* Student portal modals - keep existing styles */
    #assessment-instructions-modal {
        padding: 0;
        top: 0;
        left: 0;
        transform: none;
        width: 100%;
        height: 100vh;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        overflow-y: auto;
        z-index: 1001;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    #assessment-instructions-modal .modal-header {
        padding: 1rem;
        position: sticky;
        top: 0;
        background: var(--surface-color);
        z-index: 10;
        border-bottom: 1px solid var(--border-color);
    }
    
    #assessment-instructions-modal .modal-body {
        padding: 1rem;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Password modals for student portal */
    #forgot-password-modal form,
    #resend-verification-modal form {
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }
    
    /* Form improvements for mobile */
    .form-group {
        margin-bottom: 1.5rem;
    }
    
    .form-group label {
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
        display: block;
    }
    
    /* Assessment pages container mobile */
    #assessment-pages-container {
        margin-bottom: 2rem;
    }
    
    .assessment-page {
        border: 1px solid var(--border-color);
        border-radius: 8px;
        margin-bottom: 1rem;
        background: var(--surface-color);
    }
    
    .page-header {
        padding: 1rem;
        background: var(--bg-color);
        border-bottom: 1px solid var(--border-color);
        border-radius: 8px 8px 0 0;
    }
    
    .page-header h4 {
        font-size: 1.1rem;
        margin: 0;
    }
    
    /* Page tabs mobile */
    .page-tabs {
        display: flex;
        overflow-x: auto;
        gap: 0.5rem;
        padding: 0.5rem;
        background: var(--bg-color);
        border-bottom: 1px solid var(--border-color);
        -webkit-overflow-scrolling: touch;
    }
    
    .page-tab {
        flex-shrink: 0;
        padding: 0.5rem 1rem;
        background: var(--surface-color);
        border: 1px solid var(--border-color);
        border-radius: 6px;
        cursor: pointer;
        font-size: 0.9rem;
        white-space: nowrap;
    }
    
    .page-tab.active {
        background: var(--primary-color);
        color: white;
        border-color: var(--primary-color);
    }
}

/* Form Inputs Mobile */
@media (max-width: 768px) {
    .form-control,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="datetime-local"],
    select,
    textarea {
        font-size: 16px !important; /* Prevents iOS zoom */
        padding: 0.875rem;
        border-radius: 8px;
    }
    
    textarea {
        min-height: 150px;
        resize: vertical;
    }
    
    .form-group label {
        font-size: 0.95rem;
        font-weight: 600;
    }
}

/* Assessment Pages Mobile */
@media (max-width: 768px) {
    .assessment-pages-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .pages-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        display: flex;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    .page-tab {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
        min-width: 100px;
    }
    
    .page-content {
        padding: 1rem;
    }
    
    .page-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .page-header .btn {
        width: 100%;
    }
}

/* Student Portal - Lesson View Mobile */
@media (max-width: 768px) {
    .lesson-header {
        padding: 1rem;
    }
    
    .lesson-header h2 {
        font-size: 1.35rem;
        line-height: 1.3;
    }
    
    .lesson-meta {
        flex-wrap: wrap;
        gap: 0.75rem;
        font-size: 0.9rem;
    }
    
    .lesson-meta span {
        display: flex;
        align-items: center;
        gap: 0.35rem;
    }
    
    .student-info {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .lesson-content {
        padding: 1rem;
    }
    
    .content-section {
        margin-bottom: 1.5rem;
    }
    
    .content-section h3 {
        font-size: 1.15rem;
        margin-bottom: 0.75rem;
    }
}

/* Video Player Mobile - BIGGER */
@media (max-width: 768px) {
    #video-container {
        height: auto;
        max-height: 75vh; /* ✅ Bigger video player */
        border-radius: 8px;
    }
    
    .video-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-top: 1rem;
    }
    
    .video-controls .btn {
        flex: 1;
        min-width: 140px;
    }
}

@media (max-width: 480px) {
    #video-container {
        height: auto;
        max-height: 70vh; /* ✅ Bigger video player */
    }
    
    .video-controls .btn {
        width: 100%;
        flex: none;
    }
}

/* Materials Section Mobile */
@media (max-width: 768px) {
    .materials-list {
        gap: 0.75rem;
    }
    
    .material-item {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .material-info {
        width: 100%;
    }
    
    .material-item .btn {
        width: 100%;
    }
}

/* Assessment/Quiz Mobile */
@media (max-width: 768px) {
    .quiz-container {
        padding: 1rem;
    }
    
    .quiz-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .quiz-timer {
        font-size: 1.5rem;
        padding: 0.75rem 1.25rem;
        width: 100%;
        text-align: center;
    }
    
    .question-card {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .question-number {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }
    
    .question-text {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    .answer-option {
        padding: 1rem;
        min-height: 54px;
        font-size: 0.95rem;
    }
    
    .answer-option input[type="radio"] {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }
    
    .option-letter {
        min-width: 35px;
        height: 35px;
        font-size: 1rem;
        flex-shrink: 0;
    }
    
    .option-text {
        flex: 1;
        line-height: 1.5;
    }
    
    /* Text inputs for other question types */
    .answer-input {
        font-size: 16px !important;
        padding: 0.875rem;
        width: 100%;
    }
    
    textarea.answer-input {
        min-height: 120px;
    }
}

/* Quiz Navigation Mobile */
@media (max-width: 768px) {
    #quiz-navigation {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
        background: var(--surface-color);
        position: relative;
        border-top: 1px solid var(--border-color);
        margin-bottom: 1rem;
    }
    
    #page-indicator {
        order: -1;
        width: 100%;
        padding: 0.75rem;
        background: var(--bg-color);
        border-radius: 8px;
        font-size: 1rem;
    }
    
    #prev-page-btn,
    #next-page-btn,
    #submit-quiz-btn {
        width: 100%;
        flex: none;
        min-height: 48px;
        font-size: 1rem;
    }
}

/* Results View Mobile */
@media (max-width: 768px) {
    .results-container {
        padding: 1rem;
    }
    
    .results-header {
        padding: 1.25rem;
    }
    
    .results-header h2 {
        font-size: 1.35rem;
    }
    
    .score-display {
        font-size: 2.5rem;
        padding: 1.5rem;
    }
    
    .results-summary {
        gap: 1rem;
    }
    
    .summary-item {
        padding: 1rem;
    }
    
    .summary-item h4 {
        font-size: 0.9rem;
    }
    
    .summary-item p {
        font-size: 1.5rem;
    }
}

/* Documents Viewer Mobile */
@media (max-width: 768px) {
    .documents-viewer {
        padding: 0;
    }
    
    .documents-viewer-header {
        padding: 1rem;
        position: sticky;
        top: 0;
        background: var(--surface-color);
        z-index: 10;
    }
    
    .documents-list {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .document-item {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .document-info {
        width: 100%;
    }
    
    .document-item .btn {
        width: 100%;
    }
}

/* Buttons Mobile Improvements */
@media (max-width: 768px) {
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .btn i {
        font-size: 1.1rem;
    }
    
    .btn-sm {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        min-height: 36px;
    }
    
    .btn-lg {
        padding: 1rem 1.5rem;
        font-size: 1.05rem;
        min-height: 52px;
    }
}

/* Empty States Mobile */
@media (max-width: 768px) {
    .empty-state-card {
        padding: 2rem 1rem;
    }
    
    .empty-state-card i {
        font-size: 3rem;
    }
    
    .empty-state-card p {
        font-size: 1rem;
    }
}

/* Loading States Mobile */
@media (max-width: 768px) {
    .loading {
        font-size: 1rem;
        padding: 2rem 1rem;
    }
}

/* Alerts Mobile */
@media (max-width: 768px) {
    .alert {
        padding: 1rem;
        font-size: 0.95rem;
        border-radius: 8px;
    }
}

/* Prevent text selection on buttons (better UX) - STUDENT PORTAL ONLY */
.btn:not(.dashboard-section .btn):not(.section-header .btn):not(.menu-item), .page-tab, .answer-option {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Smooth scrolling for mobile */
html {
    scroll-behavior: smooth;
}

/* Better tap highlight color */
* {
    -webkit-tap-highlight-color: rgba(79, 70, 229, 0.1);
}

/* Prevent pull-to-refresh on mobile */
body {
    overscroll-behavior-y: contain;
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
    .navbar,
    .modal-header,
    .modal-footer,
    #quiz-navigation {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    .navbar {
        padding-top: max(1rem, env(safe-area-inset-top));
    }
    
    .modal-footer,
    #quiz-navigation {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* ============================================
   ✅ ENHANCED MOBILE IMPROVEMENTS
   ======================================== */

/* Better Mobile Typography */
@media (max-width: 768px) {
    body {
        font-size: 15px; /* Slightly smaller on mobile for better fit */
    }
    
    p, li, span, div {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    .question-card h4 {
        font-size: 1.1rem;
        line-height: 1.4;
        margin-bottom: 1rem;
    }
    
    .question-card p {
        font-size: 0.95rem;
    }
    
    label {
        font-size: 0.95rem;
    }
    
    input, textarea, select {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .question-card h4 {
        font-size: 1rem;
    }
}

/* Better Mobile Spacing */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .question-card {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .form-group {
        margin-bottom: 1.25rem;
    }
}

/* Mobile-Friendly Buttons & Touch Optimization */
@media (max-width: 768px) {
    .btn {
        min-height: 48px; /* Touch-friendly size */
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
        font-weight: 600;
        border-radius: 8px;
        transition: all 0.2s ease;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        -webkit-user-select: none;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .btn:active {
        transform: scale(0.98);
    }
    
    .btn-sm {
        min-height: 44px;
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }
    
    .btn-lg {
        min-height: 56px;
        font-size: 1.1rem;
        padding: 1rem 2rem;
    }
    
    /* Dashboard specific button optimizations */
    .dashboard-section .btn,
    .section-header .btn {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        position: relative;
        z-index: 1;
        min-height: 48px;
        font-weight: 600;
    }
    
    .dashboard-section .btn:active,
    .section-header .btn:active {
        transform: scale(0.98);
    }
    
    /* CRITICAL: Force menu items to be clickable */
    .dashboard-sidebar .menu-item,
    .dashboard-sidebar.active .menu-item {
        /* Highest priority clickability */
        pointer-events: auto !important;
        cursor: pointer !important;
        position: relative !important;
        z-index: 1070 !important; /* Highest z-index */
        /* Remove any blocking elements */
        background: none !important;
        border: none !important;
        outline: none !important;
        /* Touch optimization */
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1) !important; /* Slight highlight for feedback */
        user-select: none !important;
        -webkit-user-select: none !important;
    }
    
    .dashboard-sidebar .menu-item:active,
    .dashboard-sidebar.active .menu-item:active {
        transform: scale(0.95) !important;
        background-color: var(--primary-color) !important;
        color: white !important;
    }
    
    .dashboard-sidebar .menu-item.active,
    .dashboard-sidebar.active .menu-item.active {
        background-color: var(--primary-color) !important;
        color: white !important;
    }
    
    .dashboard-sidebar .menu-item:hover,
    .dashboard-sidebar.active .menu-item:hover {
        background-color: var(--bg-color) !important;
        transform: translateX(4px) !important;
    }
    
    .dashboard-sidebar .menu-item:hover.active,
    .dashboard-sidebar.active .menu-item:hover.active {
        background-color: var(--primary-color) !important;
        color: white !important;
    }
}

/* Mobile Video Player Improvements - MUCH BIGGER SCREENS */
@media (max-width: 768px) {
    #video-container {
        height: auto;
        aspect-ratio: 16 / 9; /* Maintains proper video ratio */
        max-height: 80vh !important; /* ✅ MASSIVE INCREASE - 80vh for bigger mobile video */
        margin: 0 !important;
        width: 100% !important;
    }
    
    #youtube-player-container {
        height: auto;
        aspect-ratio: 16 / 9;
        max-height: 80vh !important; /* ✅ MASSIVE INCREASE - 80vh */
        width: 100% !important;
    }
    
    #youtube-player {
        width: 100% !important;
        height: 100% !important;
    }
    
    .video-wrapper {
        max-height: 80vh !important;
        width: 100% !important;
    }
    
    #lesson-video {
        max-height: 80vh !important;
        width: 100% !important;
        object-fit: contain;
    }
}

@media (max-width: 480px) {
    #video-container,
    #youtube-player-container {
        max-height: 75vh !important; /* ✅ MASSIVE INCREASE from 50vh to 75vh */
    }
    
    .video-wrapper {
        max-height: 75vh !important;
    }
}

/* Mobile Assessment Improvements */
@media (max-width: 768px) {
    .quiz-header {
        padding: 1rem;
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
    
    .quiz-timer {
        font-size: 1.25rem;
        padding: 0.75rem 1.5rem;
    }
    
    .quiz-questions {
        padding: 1rem;
    }
    
    .option-label {
        padding: 1rem;
        font-size: 0.95rem;
        min-height: 48px;
        display: flex;
        align-items: center;
    }
    
    textarea.form-control {
        font-size: 16px !important;
        min-height: 120px;
        padding: 1rem;
    }
    
    input[type="text"].form-control {
        font-size: 16px !important;
        min-height: 48px;
        padding: 0.875rem;
    }
}

/* Mobile Table Improvements */
@media (max-width: 768px) {
    table {
        font-size: 0.9rem;
    }
    
    th, td {
        padding: 0.75rem 0.5rem;
    }
    
    .table-container {
        border-radius: 8px;
    }
}

/* Additional Mobile Modal Improvements for smaller screens */
@media (max-width: 480px) {
    .modal-header {
        padding: 0.75rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
        text-align: center;
        margin-bottom: 0.5rem;
    }
    
    .modal-header > div {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    
    .modal form {
        padding: 0.75rem;
        padding-bottom: 7rem;
    }
    
    .modal-actions {
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .modal-actions .btn {
        padding: 1rem;
        font-size: 0.95rem;
        border-radius: 8px;
    }
    
    /* Button improvements for mobile */
    .btn {
        min-height: 44px; /* Touch target size */
        border-radius: 8px;
        font-weight: 600;
        transition: all 0.2s ease;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        -webkit-user-select: none;
    }
    
    /* Dashboard buttons - DESKTOP ONLY (No Mobile Touch Styles) */
    
    .btn-sm {
        min-height: 36px;
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    /* Form grid improvements */
    .form-group div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Video container mobile */
    #videos-container {
        gap: 1rem !important;
    }
    
    .video-input-group {
        padding: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: var(--bg-color);
    }
    
    /* Documents container mobile */
    #documents-container {
        gap: 1rem !important;
    }
    
    .document-input-group {
        padding: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: var(--bg-color);
    }
    
    /* Assessment pages mobile */
    .assessment-page {
        margin-bottom: 1.5rem;
    }
    
    .assessment-page textarea {
        min-height: 200px;
        font-size: 14px;
        line-height: 1.5;
    }
    
    /* Preview buttons mobile */
    .btn[onclick*="preview"] {
        width: 100%;
        margin-top: 0.5rem;
        padding: 0.75rem;
    }
}

/* ============================================
   MOBILE RESPONSIVE - ENHANCED VIDEO & MATERIALS
   ============================================ */

@media (max-width: 768px) {
    /* Section Title Mobile */
    .section-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
    }
    
    .section-title i {
        font-size: 1.5rem;
    }
    
    .section-title h3 {
        font-size: 1.25rem;
    }
    
    .section-description {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    /* Video Section Mobile */
    .video-section {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .video-card {
        padding: 1rem;
    }
    
    .video-info-card {
        padding: 1rem;
    }
    
    .info-content {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    .video-time-display {
        font-size: 0.9rem;
    }
    
    /* Materials Section Mobile */
    .materials-section {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .materials-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Fullscreen Button Mobile */
    .fullscreen-btn-external {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
    }
    
    /* Mobile Rotate Notice */
    .mobile-rotate-notice {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }
    
    .mobile-rotate-notice i {
        font-size: 1.25rem;
    }
}

/* Mobile Navigation Improvements */
@media (max-width: 768px) {
    #quiz-navigation {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    #quiz-navigation .btn {
        flex: 1;
        min-width: 0;
    }
    
    .page-indicator {
        font-size: 1rem;
        font-weight: 600;
        padding: 0.5rem;
    }
}

/* Mobile Dashboard - DESKTOP ONLY (No Mobile Styles) */

/* Mobile Login/Register Improvements */
@media (max-width: 768px) {
    .login-card {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .login-card h2 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
}

/* Landscape Mobile Optimizations - AUTO-ROTATE FEATURE */
@media (max-width: 768px) and (orientation: landscape) {
    /* Video player takes full screen in landscape */
    #video-container,
    #youtube-player-container {
        max-height: 95vh !important; /* ✅ Nearly full screen in landscape */
        height: 95vh !important;
    }
    
    .video-wrapper {
        max-height: 95vh !important;
        height: 95vh !important;
    }
    
    /* Hide mobile notice in landscape (already in landscape!) */
    .mobile-rotate-notice {
        display: none !important;
    }
    
    /* Compact fullscreen button in landscape */
    .fullscreen-btn-external {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        margin-top: 0.5rem;
    }
    
    /* Compact video info in landscape */
    .video-info {
        margin-top: 0.5rem;
        font-size: 0.85rem;
    }
    
    .quiz-container {
        padding: 0.75rem;
    }
    
    .question-card {
        padding: 1rem;
    }
}

/* Mobile Portrait - Show rotate notice */
@media (max-width: 768px) and (orientation: portrait) {
    .mobile-rotate-notice {
        display: flex !important;
    }
    
    .fullscreen-btn-external {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
}

/* Document Viewer Mobile Optimizations */
.document-fullscreen-modal {
    /* Mobile-friendly scrolling */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.document-fullscreen-modal iframe {
    /* Enable pinch-to-zoom on mobile */
    touch-action: pan-x pan-y pinch-zoom;
    /* Better rendering on mobile */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

@media (max-width: 768px) {
    .document-fullscreen-modal {
        /* Full screen on mobile */
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
    }
    
    .document-fullscreen-modal iframe {
        /* Better mobile PDF viewing */
        min-height: 100vh !important;
        width: 100% !important;
        /* Enable smooth scrolling */
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

@media (max-width: 480px) {
    .document-fullscreen-modal iframe {
        /* Extra height for small mobile screens */
        min-height: 120vh !important;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Enhanced error message styling for blocking messages */
.error-message {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.95rem;
    padding: 1.5rem;
    margin: 1rem 0;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.2);
    border-left: 5px solid #dc2626;
}

.error-message.show {
    display: block;
    animation: slideIn 0.3s ease-out;
}

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

/* Mobile responsive error messages */
@media (max-width: 768px) {
    .error-message {
        font-size: 0.9rem;
        padding: 1rem;
        margin: 0.5rem 0;
    }
    
    /* Login Footer Mobile Optimization */
    .login-footer {
        margin-top: 1.5rem;
        padding-top: 1rem;
        gap: 0.75rem;
    }
    
    .login-footer p {
        font-size: 0.85rem;
        flex-direction: column;
        align-items: stretch;
    }
    
    .login-footer a {
        width: 100%;
        justify-content: center;
        padding: 0.7rem 1rem;
        font-size: 0.85rem;
    }
}

/* ========================================
   STICKY FLOATING TIMER FOR ASSESSMENT
   ======================================== */
#sticky-timer {
    position: fixed !important;
    top: 80px !important;
    left: 20px !important;
    z-index: 9999 !important;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)) !important;
    color: white !important;
    padding: 12px 20px !important;
    border-radius: 50px !important;
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4) !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(10px) !important;
    animation: pulse-timer 1s ease-in-out infinite !important;
}

#sticky-timer i {
    font-size: 1.3rem !important;
    animation: spin-timer 2s linear infinite !important;
    color: white !important;
}

#timer-display {
    min-width: 60px !important;
    text-align: center !important;
    font-family: 'Courier New', monospace !important;
    letter-spacing: 2px !important;
    color: white !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    font-weight: 800 !important;
}

/* Color change based on time remaining */
#sticky-timer.timer-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4) !important;
}

#sticky-timer.timer-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4) !important;
    animation: pulse-danger 0.6s ease-in-out infinite !important;
}

@keyframes pulse-timer {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes pulse-danger {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 4px 25px rgba(239, 68, 68, 0.6);
    }
}

@keyframes spin-timer {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Mobile responsive timer */
@media (max-width: 768px) {
    #sticky-timer {
        top: 75px !important;
        left: 12px !important;
        transform: none !important;
        padding: 6px 12px !important;
        font-size: 0.85rem !important;
        border-radius: 50px !important;
        min-width: 90px !important;
        max-width: 110px !important;
        justify-content: center !important;
        gap: 4px !important;
        box-shadow: 0 4px 12px rgba(79, 70, 229, 0.5) !important;
    }
    
    #sticky-timer i {
        font-size: 0.85rem !important;
        display: none !important; /* Hide icon on mobile for more compact design */
    }
    
    #timer-display {
        min-width: 50px !important;
        font-size: 0.85rem !important;
        font-weight: 800 !important;
        letter-spacing: 1px !important;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    }
    
    /* Ensure visibility on all backgrounds */
    #sticky-timer.timer-warning #timer-display,
    #sticky-timer.timer-danger #timer-display {
        text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
    }
    
    /* Violation counter mobile positioning - aligned with timer */
    #violation-counter-main {
        top: 75px !important;
        right: 12px !important;
        font-size: 0.85rem !important;
        padding: 6px 12px !important;
        min-width: 90px !important;
        max-width: 110px !important;
        min-height: auto !important;
        border-radius: 50px !important;
    }
    
    #violation-counter-content {
        padding: 6px 12px !important;
        font-size: 0.85rem !important;
    }
    
    #violation-counter-collapsed {
        padding: 6px 12px !important;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    #sticky-timer {
        top: 70px !important;
        left: 10px !important;
        transform: none !important;
        padding: 5px 10px !important;
        font-size: 0.75rem !important;
        min-width: 80px !important;
        max-width: 100px !important;
    }
    
    #timer-display {
        min-width: 45px !important;
        font-size: 0.75rem !important;
    }
    
    /* Violation counter extra small - aligned with timer */
    #violation-counter-main {
        top: 70px !important;
        right: 10px !important;
        font-size: 0.75rem !important;
        padding: 5px 10px !important;
        min-width: 80px !important;
        max-width: 100px !important;
        min-height: auto !important;
        border-radius: 50px !important;
    }
    
    #violation-counter-content {
        padding: 5px 10px !important;
        font-size: 0.75rem !important;
    }
    
    #violation-counter-collapsed {
        padding: 5px 10px !important;
    }
}

/* Ensure text is always readable */
#timer-display {
    color: white !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    font-weight: 800 !important;
}

#sticky-timer.timer-warning #timer-display {
    color: white !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
}

#sticky-timer.timer-danger #timer-display {
    color: white !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
    font-weight: 900 !important;
}

/* ========================================
   VIDEO CAROUSEL MOBILE OPTIMIZATION
   ======================================== */
#video-carousel-controls {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 1rem !important;
    margin-top: 1rem !important;
    padding: 1rem !important;
    background: var(--bg-secondary) !important;
    border-radius: 8px !important;
    flex-wrap: wrap !important;
}

#video-carousel-controls button {
    min-width: 100px !important;
    padding: 10px 15px !important;
    font-size: 0.95rem !important;
    min-height: 44px !important;
    cursor: pointer !important;
}

#video-carousel-controls button:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

#video-carousel-controls button:not(:disabled):hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Mobile responsive carousel controls */
@media (max-width: 768px) {
    #video-carousel-controls {
        gap: 0.75rem !important;
        padding: 0.75rem !important;
        margin-top: 0.75rem !important;
    }
    
    #video-carousel-controls button {
        min-width: 90px !important;
        padding: 8px 12px !important;
        font-size: 0.85rem !important;
        flex: 1 !important;
        min-height: 40px !important;
    }
    
    #video-carousel-controls > div {
        flex-basis: 100% !important;
        order: 3 !important;
        min-width: 100% !important;
    }
    
    #video-carousel-controls button:first-child {
        order: 1 !important;
    }
    
    #video-carousel-controls button:last-child {
        order: 2 !important;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    #video-carousel-controls {
        gap: 0.5rem !important;
        padding: 0.5rem !important;
        margin-top: 0.5rem !important;
    }
    
    #video-carousel-controls button {
        min-width: 80px !important;
        padding: 6px 10px !important;
        font-size: 0.75rem !important;
        min-height: 38px !important;
    }
    
    #video-carousel-controls button i {
        font-size: 0.8rem !important;
    }
    
    #video-carousel-controls > div {
        font-size: 0.85rem !important;
    }
    
    #video-carousel-controls > div small {
        font-size: 0.7rem !important;
    }
}

/* ========================================
   VIOLATION COUNTER MOBILE OPTIMIZATION
   ======================================== */
@media (max-width: 768px) {
    #violation-counter-main {
        top: 12px !important;
        right: 12px !important;
        min-width: 45px !important;
        min-height: 45px !important;
        font-size: 12px !important;
    }
    
    #violation-counter-content {
        padding: 8px 12px !important;
        font-size: 0.85rem !important;
    }
    
    #violation-counter-content i {
        margin-right: 4px !important;
        font-size: 0.9rem !important;
    }
    
    #violation-counter-collapsed {
        padding: 8px !important;
    }
    
    #violation-counter-collapsed i {
        font-size: 0.9rem !important;
    }
}

@media (max-width: 480px) {
    #violation-counter-main {
        top: 10px !important;
        right: 10px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        font-size: 11px !important;
    }
    
    #violation-counter-content {
        padding: 6px 10px !important;
        font-size: 0.75rem !important;
    }
    
    #violation-counter-content i {
        margin-right: 3px !important;
        font-size: 0.8rem !important;
    }
    
    #violation-counter-collapsed {
        padding: 6px !important;
    }
    
    #violation-counter-collapsed i {
        font-size: 0.8rem !important;
    }
}
