/* ==================== GLOBAL STYLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

:root {
    --primary-color: #fff7eb;
    --primary-dark: #fef3e2;
    --secondary-color: #3d5f80;
    --accent-color: #fff7eb;
    --success-color: #48bb78;
    --danger-color: #f56565;
    --warning-color: #ed8936;
    --info-color: #3d5f80;
    --light-bg: #f8f9fa;
    --lighter-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --navbar-primay: #416666;
    --navbar-secondary: #2d4f4f;
    --new-background: #f8fafc;
    --new-text-color: #3d5f80;
    --new-accent: #fff7eb;
    --new-border: #e2e8f0;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    zoom: 1;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==================== SIDEBAR NAVIGATION ==================== */

/* Sidebar Container */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, #406766 0%, #2d4d4c 100%);
    color: white;
    padding: 0;
    z-index: 1000;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* Sidebar Logo Section */
.sidebar-logo {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-brand {
    font-size: 26px;
    font-weight: bold;
    font-style: italic;
    color: white;
    margin-bottom: 5px;
}

.sidebar-subtitle {
    font-size: 11px;
    font-weight: lighter;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.7);
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 20px 0;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 25px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    position: relative;
    cursor: pointer;
}

.sidebar-nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: #18a1ec;
}

.sidebar-nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: #18a1ec;
    font-weight: 600;
}

.sidebar-nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-nav-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Sidebar File Selector */
.sidebar-file-selector {
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.2);
    margin: 0;
}

.sidebar-file-dropdown {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    line-height: 1.4;
    min-height: 60px;
    max-height: 200px;
}

.sidebar-file-dropdown:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

.sidebar-file-dropdown:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    border-color: #18a1ec;
    box-shadow: 0 0 0 2px rgba(24, 161, 236, 0.2);
}

.sidebar-file-dropdown option {
    background-color: #2d4d4c;
    color: white;
    padding: 8px;
    margin: 4px 0;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: normal;
    overflow-wrap: break-word;
    max-width: 100%;
}

.sidebar-file-dropdown option:checked {
    background: linear-gradient(#18a1ec, #18a1ec);
    background-color: #18a1ec;
}

/* ==================== HAMBURGER MENU ==================== */

.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1003;
    position: fixed;
    top: 18px;
    left: 20px;
}

.hamburger-menu span {
    width: 100%;
    height: 3px;
    background-color: #406766;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-menu:hover span {
    background-color: #18a1ec;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ==================== MAIN CONTENT AREA ==================== */

.main-content {
    margin-left: 260px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;

}

#tab-chat {
    padding: 0 !important;
}

.container {
    max-width: 100vw;
    margin: 0 auto;
}

#tab-chat .container {
    max-width: none;
    margin: 0;
    padding: 0;
}

/* ==================== UPLOAD SECTION ==================== */

.upload-section {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    border: 2px solid #406766;
}

.upload-section h2 {
    color: #406766;
    margin-bottom: 20px;
    font-size: 1.8em;
    font-weight: 700;
}

.upload-area {
    border: 3px dashed #406766;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.upload-area:hover {
    background: #f0f6ff;
    border-color: #18a1ec;
}

.upload-area.dragover {
    background: #e8f4ff;
    border-color: #18a1ec;
    transform: scale(1.02);
}

.upload-content svg {
    color: #406766;
    margin-bottom: 20px;
}

.upload-content p {
    color: #333;
    font-size: 1.2em;
    margin-bottom: 10px;
    font-weight: 600;
}

.upload-hint {
    color: #666;
    font-size: 0.9em !important;
    font-weight: 400 !important;
}

/* ==================== CONTENT SECTION ==================== */

.content-section {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 2px solid #406766;
}

.tab-content {
    display: none;
    padding: 20px;
}

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

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

.tab-content h3 {
    color: #406766;
    margin-bottom: 20px;
    font-size: 1.6em;
    font-weight: 700;
}

/* ==================== VIDEO PLAYER ==================== */

.video-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto 30px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.video-container video {
    width: 100%;
    height: auto;
    display: block;
    background: #000;
}

.video-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

/* ==================== TRANSCRIPT ==================== */

.transcript-container {
    max-height: 600px;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.transcript-segment {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #406766;
    transition: all 0.3s ease;
}

.transcript-segment:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateX(5px);
}

.transcript-time {
    display: inline-block;
    background: #406766;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px;
}

.transcript-time:hover {
    background: #2d4d4c;
    transform: scale(1.05);
}

.transcript-text {
    color: #333;
    line-height: 1.6;
    font-size: 1em;
    margin-top: 10px;
}

.empty-state {
    text-align: center;
    color: #6b7280;
    font-size: 1.1em;
    padding: 40px 20px;
    font-style: italic;
}

/* ==================== CHAT ==================== */

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
    overflow: visible;
}

.chat-header-top {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.chat-header h3 {
    margin: 0;
}

.chat-video-selector {
    position: relative;
    display: inline-block;
    overflow: visible;
}

.video-selector-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    transition: all 0.2s ease;
    max-width: 300px;
}

.video-selector-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.video-selector-btn i:first-child {
    color: #406766;
}

.video-selector-btn i:last-child {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.video-selector-btn[aria-expanded="true"] i:last-child {
    transform: rotate(180deg);
}

.video-selector-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    margin-top: 4px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 10000;
    display: none;
    overflow: visible;
}

.video-selector-list {
    max-height: 250px;
    overflow-y: auto;
    padding: 8px 0;
}

.video-selector-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.video-selector-item:hover {
    background: #f3f4f6;
}

.video-selector-checkbox {
    cursor: pointer;
    margin-right: 10px;
    width: 16px;
    height: 16px;
}

.video-selector-label {
    color: #374151;
    font-size: 14px;
    word-break: break-word;
}

.video-selector-empty {
    padding: 15px 12px;
    color: #9ca3af;
    text-align: center;
    font-size: 14px;
}

.chat-container {
    height: 500px;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid #e5e7eb;
}

.chat-welcome {
    text-align: center;
    padding: 60px 20px;
}

.chat-welcome p {
    color: #333;
    font-size: 1.1em;
    margin-bottom: 15px;
    line-height: 1.6;
}

.chat-hint {
    color: #666 !important;
    font-size: 0.95em !important;
}

.chat-info {
    color: #666 !important;
    font-size: 0.9em !important;
}

.chat-info code {
    background: #e5e7eb;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.chat-message {
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}

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

.message-user {
    display: flex;
    justify-content: flex-end;
}

.message-assistant {
    display: flex;
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 15px 20px;
    border-radius: 12px;
    line-height: 1.6;
}

.message-user .message-content {
    background: #406766;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-assistant .message-content {
    background: white;
    color: #333;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.message-content sup {
    color: #406766;
    font-weight: bold;
    font-size: 0.75em;
    margin-left: 2px;
    cursor: default;
}

.message-text {
    word-wrap: break-word;
}

.message-text p {
    margin: 0 0 10px 0;
    line-height: 1.6;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text strong {
    color: #2d4d4c;
    font-weight: 600;
}

.message-text h2,
.message-text h3,
.message-text h4 {
    margin-top: 12px;
    margin-bottom: 8px;
    color: #406766;
    line-height: 1.4;
}

.message-text sup {
    color: #406766;
    font-weight: bold;
}

.message-timestamps {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
    font-size: 0.9em;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.message-timestamps strong {
    color: #406766;
    margin-right: 8px;
    display: inline;
}

.reference-number {
    color: #406766;
    font-weight: bold;
}

.message-timestamps .transcript-time {
    display: inline-flex;
    align-items: center;
    background: #406766;
    color: white;
    padding: 6px 12px;
    border-radius: 18px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0;
    gap: 6px;
    max-width: 300px;
    min-width: fit-content;
    white-space: nowrap;
    overflow: hidden;
    flex-shrink: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    unicode-bidi: embed;
}

.message-timestamps .transcript-time span:first-child {
    /* Video name - ensure proper truncation */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
    min-width: 0;
    flex-shrink: 1;
}

.message-timestamps .transcript-time span:last-child {
    /* Timestamp - never truncate */
    flex-shrink: 0;
    white-space: nowrap;
}

.message-timestamps .transcript-time:hover {
    background: #2d4d4c;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(64, 103, 102, 0.3);
}

.message-timestamps .transcript-time span:first-child {
    /* Video name */
    font-weight: 500;
    opacity: 0.95;
    /* Ensure proper Unicode rendering for French characters */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.message-timestamps .transcript-time span:last-child {
    /* Timestamp */
    font-weight: 600;
    opacity: 1;
}

/* Ensure proper Unicode character rendering */
.message-timestamps .transcript-time {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    unicode-bidi: embed;
}

.message-timestamp {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 5px;
}

.message-assistant .message-timestamp {
    color: #999;
}

.chat-input-container {
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 12px 20px;
    border: 1px solid #e5e7eb;
    border-radius: 25px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.chat-input:focus {
    outline: none;
    border-color: #406766;
    box-shadow: 0 0 0 3px rgba(64, 103, 102, 0.1);
}

/* ==================== MCQ ==================== */

.mcq-video-selection {
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
}

.mcq-video-selection h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #406766;
    font-size: 1.1em;
}

.mcq-video-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.mcq-video-item {
    padding: 15px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mcq-video-item:hover {
    border-color: #406766;
    background: #f0f5f5;
}

.mcq-video-item.selected {
    border-color: #406766;
    background: #e6f0ef;
    box-shadow: 0 2px 8px rgba(64, 103, 102, 0.15);
}

.mcq-video-item-radio {
    width: 18px;
    height: 18px;
    border: 2px solid #406766;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
}

.mcq-video-item.selected .mcq-video-item-radio::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: #406766;
    border-radius: 50%;
}

.mcq-video-item-info {
    flex: 1;
}

.mcq-video-item-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.mcq-video-item-meta {
    font-size: 0.85em;
    color: #6b7280;
}

.mcq-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.mcq-controls label {
    font-weight: 600;
    color: #333;
}

.num-input {
    width: 80px;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1em;
    text-align: center;
}

.num-input:focus {
    outline: none;
    border-color: #406766;
    box-shadow: 0 0 0 3px rgba(64, 103, 102, 0.1);
}

.mcq-container {
    max-height: 600px;
    overflow-y: auto;
}

.mcq-item {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    transition: all 0.3s ease;
}

.mcq-item:hover {
    border-color: #406766;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mcq-question {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.6;
}

.mcq-options {
    margin-bottom: 20px;
}

.mcq-option {
    padding: 12px 20px;
    margin-bottom: 10px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mcq-option:hover {
    background: #f0f6ff;
    border-color: #406766;
}

.mcq-option.correct {
    background: #d1fae5;
    border-color: #10b981;
}

.mcq-option.incorrect {
    background: #fee2e2;
    border-color: #ef4444;
}

.mcq-answer {
    padding: 15px 20px;
    background: #f0f6ff;
    border-left: 4px solid #406766;
    border-radius: 8px;
    margin-bottom: 15px;
}

.mcq-answer strong {
    color: #406766;
}

.mcq-explanation {
    padding: 15px 20px;
    background: #f9fafb;
    border-radius: 8px;
    color: #666;
    line-height: 1.6;
}

.mcq-timestamp {
    display: inline-block;
    background: #406766;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mcq-timestamp:hover {
    background: #2d4d4c;
    transform: scale(1.05);
}

/* ==================== BUTTONS ==================== */

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #406766;
    color: white;
}

.btn-primary:hover {
    background: #2d4d4c;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(64, 103, 102, 0.3);
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ==================== STATUS MESSAGES ==================== */

.status-message {
    margin-top: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    font-weight: 500;
    display: none;
}

.status-message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
    display: block;
}

.status-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
    display: block;
}

.status-message.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #3b82f6;
    display: block;
}

/* ==================== SCROLLBAR CUSTOMIZATION ==================== */

.transcript-container::-webkit-scrollbar,
.chat-container::-webkit-scrollbar,
.mcq-container::-webkit-scrollbar {
    width: 8px;
}

.transcript-container::-webkit-scrollbar-track,
.chat-container::-webkit-scrollbar-track,
.mcq-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.transcript-container::-webkit-scrollbar-thumb,
.chat-container::-webkit-scrollbar-thumb,
.mcq-container::-webkit-scrollbar-thumb {
    background: #406766;
    border-radius: 10px;
}

.transcript-container::-webkit-scrollbar-thumb:hover,
.chat-container::-webkit-scrollbar-thumb:hover,
.mcq-container::-webkit-scrollbar-thumb:hover {
    background: #2d4d4c;
}

/* ==================== VIDEO MODAL ==================== */

.video-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.video-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.video-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    margin: 5vh auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: #406766;
    color: white;
}

.video-modal-header h3 {
    margin: 0;
    font-size: 1.25em;
    font-weight: 600;
}

.video-modal-close {
    background: transparent;
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.video-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.video-modal-close svg {
    width: 20px;
    height: 20px;
}

.video-modal-body {
    padding: 0;
    background: black;
}

.video-modal-body video {
    width: 100%;
    height: auto;
    max-height: calc(90vh - 80px);
    display: block;
}

/* ==================== RESPONSIVE DESIGN ==================== */

@media (max-width: 768px) {
    /* Show Hamburger Menu */
    .hamburger-menu {
        display: flex;
    }

    /* Hide sidebar by default on mobile */
    .sidebar {
        left: -260px;
    }

    .sidebar.mobile-active {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        
    }

    .upload-section,
    .content-section {
        padding: 20px;
    }

    .video-actions {
        flex-direction: column;
    }

    .message-content {
        max-width: 85%;
    }

    .mcq-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .chat-input-container {
        flex-direction: column;
    }

    .chat-input {
        border-radius: 12px;
    }
}

@media (max-width: 480px) {
    .sidebar-brand {
        font-size: 22px;
    }

    .sidebar-subtitle {
        font-size: 10px;
    }

    .upload-area {
        padding: 40px 20px;
    }

    .upload-content svg {
        width: 48px;
        height: 48px;
    }

    .upload-content p {
        font-size: 1em;
    }

    .message-content {
        max-width: 95%;
    }

    .tab-content h3 {
        font-size: 1.3em;
    }
}

/* ==================== VIDEO LIBRARY ==================== */

.library-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
    margin: 20px 0;
    border: 1px solid #e5e7eb;
}

.selection-info {
    font-weight: 600;
    color: #333;
    font-size: 1.1em;
}

.library-actions {
    display: flex;
    gap: 10px;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.video-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.video-card:hover {
    border-color: #406766;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.video-card.selected {
    border-color: #406766;
    background: #f0f6ff;
}

.video-card-checkbox {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: #406766;
}

.video-card-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #406766 0%, #2d4d4c 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.video-card-icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

.video-card-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    word-break: break-word;
}

.video-card-info {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.video-card-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    margin-top: 10px;
}

.status-transcribed {
    background: #d1fae5;
    color: #065f46;
}

.status-not-transcribed {
    background: #fee2e2;
    color: #991b1b;
}

.video-card-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

.video-card-btn {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-delete {
    background: #fee2e2;
    color: #dc2626;
}

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

/* ==================== VIDEO/TRANSCRIPT SELECTORS ==================== */

.video-selector,
.transcript-selector {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.video-selector label,
.transcript-selector label {
    display: inline-block;
    margin-right: 10px;
    font-weight: 600;
    color: #333;
}

.video-dropdown {
    padding: 10px 15px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    color: #333;
    font-size: 1em;
    min-width: 250px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.video-dropdown:focus {
    outline: none;
    border-color: #406766;
    box-shadow: 0 0 0 3px rgba(64, 103, 102, 0.1);
}

.video-dropdown:hover {
    border-color: #406766;
}

/* ==================== CHAT INFO BANNER ==================== */

.chat-info-banner {
    padding: 12px 20px;
    background: #e8f4f3;
    border: 1px solid #406766;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
}

.chat-info-banner p {
    margin: 0;
    color: #333;
    font-size: 0.95em;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.chat-info-banner strong {
    color: #406766;
    display: block;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ==================== MCQ VIDEO SOURCE LABEL ==================== */

.mcq-video-source {
    display: inline-block;
    background: #f0f6ff;
    color: #406766;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 10px;
    border: 1px solid #406766;
}

/* ==================== RESPONSIVE UPDATES ==================== */

@media (max-width: 768px) {
    .library-controls {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .library-actions {
        width: 100%;
        flex-direction: column;
    }

    .video-grid {
        grid-template-columns: 1fr;
    }

    .video-selector,
    .transcript-selector {
        flex-direction: column;
        align-items: flex-start;
    }

    .video-dropdown {
        width: 100%;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    .video-card-actions {
        flex-direction: column;
    }

    .library-actions button {
        width: 100%;
    }
}

/* ==================== NEW TABLE STYLES ==================== */

.library-card,
.mcq-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 30px;
}

.card-header {
    background: #f8f9fa;
    border-bottom: 2px solid #e5e7eb;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h5 {
    margin: 0;
    font-size: 1.25em;
    color: #333;
    font-weight: 600;
}

.card-header i {
    margin-right: 10px;
    color: #406766;
}

.card-body {
    padding: 25px;
}

.table-responsive {
    overflow-x: auto;
    margin-bottom: 20px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.table thead {
    background: #f8f9fa;
}

.table thead th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e5e7eb;
    font-size: 0.9em;
}

.table thead th i {
    margin-right: 8px;
    color: #406766;
}

.table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table tbody td {
    padding: 15px;
    color: #333;
}

.table tbody td.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.text-center {
    text-align: center;
}

.py-5 {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.form-check-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #406766;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 500;
}

.badge.success {
    background: #d1fae5;
    color: #065f46;
}

.badge.pending {
    background: #fee2e2;
    color: #991b1b;
}

.badge.info {
    background: #dbeafe;
    color: #1e40af;
}

.selection-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 20px;
}

.selection-info {
    font-weight: 500;
    color: #333;
}

.selection-actions {
    display: flex;
    gap: 10px;
}

/* ==================== QUIZ OPTIONS ==================== */

.quiz-options {
    margin-top: 30px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 12px;
}

.quiz-options h5 {
    color: #333;
    margin-bottom: 20px;
}

.quiz-options h5 i {
    color: #406766;
}

.options-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.option-card {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.95em;
}

.form-label i {
    margin-right: 8px;
    color: #406766;
}

.form-select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    font-size: 1em;
    color: #333;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.form-select:focus {
    outline: none;
    border-color: #406766;
    box-shadow: 0 0 0 3px rgba(64, 103, 102, 0.1);
}

.mt-4 {
    margin-top: 1.5rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

/* ==================== UPDATED CHAT INPUT ==================== */

.chat-input-area {
    padding: 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.input-container {
    max-width: 100%;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 25px;
    padding: 8px 15px;
    transition: border-color 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: #406766;
    box-shadow: 0 0 0 3px rgba(64, 103, 102, 0.1);
}

.input-wrapper textarea {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 1em;
    line-height: 1.5;
    padding: 8px 12px;
    max-height: 150px;
    min-height: 20px;
    font-family: inherit;
}

.input-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    padding-left: 10px;
}

.input-btn {
    background: #406766;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s ease;
}

.input-btn:hover {
    background: #2d4d4c;
    transform: scale(1.05);
}

.input-btn i {
    font-size: 1.1em;
}

.send-btn {
    background: #406766;
}

.send-btn:hover {
    background: #2d4d4c;
}

/* ==================== QUIZ PAGE STYLES ==================== */

.quiz-page {
    background: #f8f9fa;
    min-height: 100vh;
}

.quiz-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

.quiz-header {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    text-align: center;
}

.quiz-header h1 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 2em;
}

.quiz-header i {
    color: #406766;
    margin-right: 10px;
}

.quiz-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 20px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2em;
    font-weight: bold;
    color: #406766;
}

.stat-label {
    color: #666;
    font-size: 0.9em;
    margin-top: 5px;
}

.quiz-progress {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 500;
    color: #333;
}

.progress-bar-container {
    background: #e5e7eb;
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #406766, #2d4d4c);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

.question-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.question-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.question-card.correct {
    border-left: 4px solid #48bb78;
    background: #f0fdf4;
}

.question-card.incorrect {
    border-left: 4px solid #f56565;
    background: #fef2f2;
}

.question-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
}

.question-number {
    background: #406766;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
    margin-right: 15px;
}

.question-text {
    flex: 1;
    font-size: 1.1em;
    color: #333;
    font-weight: 500;
    line-height: 1.6;
}

.question-body {
    margin-top: 15px;
}

.option-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-item:hover {
    border-color: #406766;
    background: #f8f9fa;
}

.option-item input[type="radio"] {
    margin-right: 15px;
}

.option-content {
    display: flex;
    align-items: center;
    flex: 1;
}

.option-label {
    background: #406766;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 15px;
    flex-shrink: 0;
}

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

.option-item.correct-answer {
    border-color: #48bb78;
    background: #f0fdf4;
}

.question-timestamp {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

.timestamp-btn {
    background: transparent;
    border: 1px solid #406766;
    color: #406766;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.timestamp-btn:hover {
    background: #406766;
    color: white;
}

.timestamp-btn i {
    margin-right: 5px;
}

.quiz-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

/* ==================== BUTTON UPDATES ==================== */

.btn-lg {
    padding: 14px 30px;
    font-size: 1.1em;
}

.btn i {
    margin-right: 8px;
}

/* ==================== DASHBOARD LAYOUT ==================== */

.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    min-height: 100vh;
    padding: 20px;
}

.dashboard-main {
    flex: 1;
}

.dashboard-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Action Card */
.action-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.action-card-header {
    background: linear-gradient(135deg, #406766 0%, #2d4d4c 100%);;
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.action-card-header i {
    font-size: 18px;
}

.action-card-header h5 {
    margin: 0;
    font-size: 16px;
}

.action-card-body {
    padding: 20px;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Stats Card */
.stats-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.stats-card-header {
    background: linear-gradient(135deg, #406766 0%, #2d4d4c 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.stats-card-header i {
    font-size: 18px;
}

.stats-card-header h5 {
    margin: 0;
    font-size: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 20px;
}

.stat-item {
    text-align: center;
    padding: 16px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.stat-icon {
    font-size: 24px;
    color: #18a1ec;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #406766;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==================== CHAT LAYOUT ==================== */

.chat-simple-layout {
    display: flex;
    min-height: 100vh;
    min-width: auto;
    padding: 0;
    width: 100%;
}

.chat-wrapper {
    width: 100%;
    background: white;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 20px;
    gap: 0;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
}

.chat-header h3 {
    margin: 0;
    color: #406766;
    font-size: 18px;
}

.chat-info-banner p {
    margin: 0;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-welcome {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.chat-welcome p {
    margin: 0;
    font-size: 14px;
}

.chat-hint {
    color: #bbb;
    font-size: 12px !important;
}

.chat-info {
    color: #18a1ec;
    font-weight: 500;
    font-size: 14px !important;
}

.chat-input-area {
    border-top: 1px solid #e9ecef;
    padding-top: 16px;
    margin-top: 12px;
}

.input-container {
    display: flex;
    gap: 8px;
}

.input-wrapper {
    flex: 1;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px;
    transition: border-color 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: #18a1ec;
    background: #fff;
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-size: 14px;
    font-family: inherit;
    max-height: 120px;
    padding: 0;
    outline: none;
}

.input-actions {
    display: flex;
    gap: 4px;
}

.input-btn {
    background: none;
    border: none;
    color: #18a1ec;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.input-btn:hover {
    background-color: rgba(24, 161, 236, 0.1);
}

.send-btn {
    background: #406766;
    color: white;
    padding: 8px 12px;
}

.send-btn:hover {
    background: #406766;
}

.send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ==================== RESPONSIVE UPDATES ==================== */

@media (max-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .quiz-stats {
        gap: 20px;
    }

    .stat-number {
        font-size: 1.5em;
    }

    .quiz-actions {
        flex-direction: column;
    }

    .quiz-actions .btn {
        width: 100%;
    }

    .options-row {
        flex-direction: column;
    }

    .option-card {
        max-width: 100%;
    }

    .dashboard-sidebar {
        flex-direction: row;
        gap: 16px;
    }

    .action-card,
    .stats-card {
        flex: 1;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .chat-wrapper {
        max-height: none;
        height: auto;
        min-height: 500px;
    }
}

/* ==================== DELETE BUTTON STYLES ==================== */
.btn-danger {
    background-color: #fee;
    color: #c33;
    border: 2px solid #f88;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background-color: #f88;
    color: white;
    border-color: #d33;
    box-shadow: 0 4px 12px rgba(255, 136, 136, 0.4);
}

.delete-btn {
    background-color: #fee;
    color: #c33;
    border: 2px solid #f88;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    background-color: #f88;
    color: white;
    border-color: #d33;
    box-shadow: 0 4px 12px rgba(255, 136, 136, 0.4);
}

/* ==================== DRAG AND DROP UPLOAD ==================== */
#uploadDropZone {
    border: 3px dashed #406766;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    background-color: rgba(64, 103, 102, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

#uploadDropZone:hover {
    background-color: rgba(64, 103, 102, 0.1);
    border-color: #2d4d4c;
}

#uploadDropZone.drag-over {
    background-color: rgba(64, 103, 102, 0.2);
    border-color: #2d4d4c;
    box-shadow: 0 4px 12px rgba(64, 103, 102, 0.3);
}

#uploadDropZone i {
    font-size: 2rem;
    color: #406766;
    margin-bottom: 10px;
    display: block;
}

#uploadDropZone p {
    color: #666;
    margin: 5px 0;
}

#uploadDropZone .upload-hint {
    font-size: 0.9em;
    color: #999;
}

/* ==================== QUIZ HISTORY TABLE ==================== */
.quiz-history-section {
    margin-top: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.quiz-history-section h3 {
    margin-bottom: 20px;
    color: #406766;
    display: flex;
    align-items: center;
    gap: 10px;
}

.quiz-history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.quiz-history-table thead {
    background-color: #f0f6ff;
}

.quiz-history-table th {
    padding: 12px;
    text-align: left;
    color: #406766;
    font-weight: bold;
    border-bottom: 2px solid #e5e7eb;
}

.quiz-history-table td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.quiz-history-table tr:hover {
    background-color: #f9fafb;
}

.quiz-status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: bold;
    border: 1.5px solid #406766;
    color: #406766;
    background-color: white;
}

.quiz-status-not-attempted {
    border-color: #ed8936;
    color: #ed8936;
    background-color: white;
}

.quiz-status-completed {
    border-color: #406766;
    color: #406766;
    background-color: white;
}

.quiz-score-text {
    font-weight: bold;
    color: #406766;
}

.quiz-action-button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
    min-width: 140px;
    text-align: center;
}

.quiz-attempt-btn {
    background-color: #406766;
    color: white;
}

.quiz-view-btn {
    background-color: #10a37f;
    color: white;
}

.quiz-view-btn:hover {
    background-color: #0d8b6f;
}

/* ==================== RESPONSIVE ZOOM FOR SMALLER SCREENS ==================== */
@media (max-width: 1200px) {
    body { zoom: 0.95; }
}

@media (max-width: 992px) {
    body { zoom: 0.9; }
}

@media (max-width: 768px) {
    body { zoom: 0.85; }
}

@media (max-width: 576px) {
    body { zoom: 0.8; }
}

/* ==================== RESULT PAGE STYLES ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(10rem, 25vw, 12.5rem), 1fr));
    gap: clamp(0.75rem, 2.5vw, 1rem);
    margin: clamp(1.5rem, 4vw, 2rem) 0;
}

.stat-card {
    background: var(--lighter-bg);
    border-radius: clamp(0.75rem, 3vw, 1rem);
    padding: clamp(1rem, 3vw, 1.5rem);
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 0.0625rem solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: clamp(0.1875rem, 0.8vw, 0.25rem);
    background: linear-gradient(90deg, var(--success-color), var(--info-color), var(--warning-color));
}

.stat-card:hover {
    transform: translateY(-clamp(0.25rem, 1.5vw, 0.5rem)) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.stat-number {
    font-size: clamp(1.8rem, 5vw, 2.2rem);
    font-weight: bold;
    color: var(--new-text-color);
}

.stat-label {
    font-size: clamp(0.75rem, 2.2vw, 0.875rem);
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* ==================== QUESTION RESULT STYLES ==================== */
.question-container {
    background: var(--lighter-bg);
    border-radius: clamp(0.75rem, 3vw, 1rem);
    margin-bottom: clamp(1.5rem, 4vw, 2rem);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 0.0625rem solid var(--border-color);
    transition: all 0.3s ease;
}

.question-container:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-clamp(0.0625rem, 0.3vw, 0.125rem));
}

.correct-indicator {
    border-left: clamp(0.25rem, 1.2vw, 0.375rem) solid var(--success-color);
}

.incorrect-indicator {
    border-left: clamp(0.25rem, 1.2vw, 0.375rem) solid var(--danger-color);
}

.question-content {
    padding: clamp(1rem, 3vw, 1.5rem);
}

.question-text {
    font-size: clamp(1rem, 3vw, 1.125rem);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: clamp(0.75rem, 2.5vw, 1rem);
    line-height: 1.6;
}

.question-number {
    background: var(--new-text-color);
    color: white;
    border-radius: 50%;
    width: clamp(2rem, 5vw, 2.5rem);
    height: clamp(2rem, 5vw, 2.5rem);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: clamp(0.75rem, 2.5vw, 1rem);
    box-shadow: var(--shadow-sm);
    font-size: 0.875rem;
}

/* ==================== ANSWER SECTION STYLES ==================== */
.answer-section {
    background: rgba(102, 126, 234, 0.05);
    border-radius: clamp(0.5rem, 2vw, 0.75rem);
    padding: clamp(0.75rem, 3vw, 1rem);
    margin: clamp(0.75rem, 2.5vw, 1rem) 0;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.answer-section h6 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: clamp(0.5rem, 2vw, 0.75rem);
    font-size: 0.875rem;
}

.answer-correct {
    color: var(--success-color);
    font-weight: 600;
}

.answer-incorrect {
    color: var(--danger-color);
    font-weight: 600;
}

.answer-user {
    background: rgba(244, 63, 94, 0.1);
    color: var(--danger-color);
    padding: clamp(0.25rem, 1.2vw, 0.375rem) clamp(0.5rem, 2vw, 0.75rem);
    border-radius: clamp(0.25rem, 1.2vw, 0.375rem);
    display: inline-block;
    margin: clamp(0.125rem, 0.6vw, 0.1875rem) 0;
    font-size: clamp(0.8rem, 2.2vw, 0.9rem);
}

.answer-correct-display {
    background: rgba(72, 187, 120, 0.1);
    color: var(--success-color);
    padding: clamp(0.25rem, 1.2vw, 0.375rem) clamp(0.5rem, 2vw, 0.75rem);
    border-radius: clamp(0.25rem, 1.2vw, 0.375rem);
    display: inline-block;
    margin: clamp(0.125rem, 0.6vw, 0.1875rem) 0;
    font-size: clamp(0.8rem, 2.2vw, 0.9rem);
}

/* ==================== EXPLANATION SECTION ==================== */
.explanation-section {
    background: rgba(67, 153, 225, 0.05);
    border-radius: clamp(0.5rem, 2vw, 0.75rem);
    padding: clamp(0.75rem, 3vw, 1rem);
    margin: clamp(0.75rem, 2.5vw, 1rem) 0;
    border-left: clamp(0.1875rem, 0.8vw, 0.25rem) solid var(--info-color);
}

.explanation-section h6 {
    color: var(--info-color);
    font-weight: 600;
    margin-bottom: clamp(0.5rem, 2vw, 0.75rem);
    font-size: 0.875rem;
}

.explanation-text {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.875rem;
}

/* ==================== SOURCE SECTION ==================== */
.source-section {
    background: rgba(237, 137, 54, 0.05);
    border-radius: clamp(0.5rem, 2vw, 0.75rem);
    padding: clamp(0.75rem, 3vw, 1rem);
    margin: clamp(0.75rem, 2.5vw, 1rem) 0;
    border-left: clamp(0.1875rem, 0.8vw, 0.25rem) solid var(--warning-color);
}

.source-section h6 {
    color: var(--warning-color);
    font-weight: 600;
    margin-bottom: clamp(0.5rem, 2vw, 0.75rem);
    font-size: 0.875rem;
}

.source-chunk {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.source-chunk:hover {
    background: #e9ecef;
    box-shadow: var(--shadow-sm);
}

.source-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-primary);
}

.source-header i {
    margin-right: 8px;
    color: #007bff;
}

.source-content {
    color: #495057;
    line-height: 1.7;
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.source-text {
    color: var(--text-secondary);
    font-style: italic;
    font-size: clamp(0.8rem, 2.2vw, 0.9rem);
}

/* ==================== PERFORMANCE BADGES ==================== */
.performance-badge {
    display: inline-block;
    padding: clamp(0.5rem, 2vw, 0.75rem) clamp(1rem, 3vw, 1.5rem);
    border-radius: clamp(2.5rem, 10vw, 3.125rem);
    font-weight: 600;
    margin-top: clamp(0.75rem, 2.5vw, 1rem);
    font-size: 0.875rem;
}

.performance-excellent { 
    background: linear-gradient(45deg, var(--success-color), #68d391); 
    color: white; 
}

.performance-good { 
    background: linear-gradient(45deg, var(--info-color), var(--secondary-color)); 
    color: white; 
}

.performance-fair { 
    background: linear-gradient(45deg, var(--warning-color), #f6ad55); 
    color: white; 
}

.performance-poor { 
    background: linear-gradient(45deg, var(--danger-color), #fc8181); 
    color: white; 
}

/* ==================== ACTION BUTTONS ==================== */
.submit-quiz-btn {
    background: linear-gradient(135deg, var(--success-color) 0%, #38a169 100%);
    color: white;
    border: none;
    padding: clamp(0.75rem, 3vw, 1rem) clamp(2rem, 6vw, 3rem);
    border-radius: clamp(0.75rem, 3vw, 1rem);
    font-weight: 500;
    font-size: clamp(0.875rem, 2.5vw, 1.125rem);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    text-transform: none;
    letter-spacing: 0.05em;
    min-width: clamp(10rem, 25vw, 12rem);
}

.submit-quiz-btn:hover {
    transform: translateY(-clamp(0.125rem, 0.6vw, 0.1875rem)) scale(1.02);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    color: white;
}

.submit-quiz-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: var(--shadow-sm);
}

.back-dashboard-btn {
    background: linear-gradient(135deg, var(--text-secondary) 0%, #4a5568 100%);
    color: white;
    border: none;
    padding: clamp(0.75rem, 3vw, 1rem) clamp(2rem, 6vw, 3rem);
    border-radius: clamp(0.75rem, 3vw, 1rem);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    min-width: clamp(10rem, 25vw, 12rem);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.back-dashboard-btn:hover {
    transform: translateY(-clamp(0.0625rem, 0.3vw, 0.125rem)) scale(1.02);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
    text-decoration: none;
}

/* ==================== RESPONSIVE ADJUSTMENTS ==================== */
@media (max-width: 48rem) {
    .navbar {
        padding: clamp(0.375rem, 1.5vw, 0.5rem) 0;
    }
    
    .quiz-stats {
        flex-direction: column;
        gap: clamp(0.75rem, 2.5vw, 1rem);
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(clamp(8rem, 20vw, 9.375rem), 1fr));
        gap: clamp(0.5rem, 2vw, 0.75rem);
    }
    
    .quiz-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .quiz-actions .btn {
        width: 100%;
        max-width: 20rem;
    }
}

.quiz-attempt-btn:hover {
    background-color: #2d4d4c;
    box-shadow: 0 2px 8px rgba(64, 103, 102, 0.3);
}

.quiz-view-btn {
    background-color: #e8f0ff;
    color: #406766;
    border: 1px solid #406766;
}

.quiz-view-btn:hover {
    background-color: #d0e0ff;
}

.empty-quiz-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-quiz-state i {
    font-size: 3rem;
    opacity: 0.3;
    display: block;
    margin-bottom: 15px;
}

/* ==================== FILENAME TRUNCATION ==================== */
.filename-truncate {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filename-truncate-block {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filename-short {
    max-width: 250px;
}

.filename-medium {
    max-width: 400px;
}

.filename-long {
    max-width: 600px;
}

/* ==================== QUIZ RESULTS PAGE STYLES ==================== */
.results-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 12px;
    padding: 40px;
    color: #406766;
    margin: 30px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.score-display {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.score-circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, #406766, #2d4d4c);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    font-weight: bold;
    border: 4px solid white;
    box-shadow: 0 10px 30px rgba(64, 103, 102, 0.3);
    color: white;
}

.score-percentage {
    text-align: center;
}

.results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.result-stat {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.result-stat .stat-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 5px;
    color: #666;
}

.result-stat .stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #406766;
}

.performance-message {
    text-align: center;
    margin-top: 20px;
    font-size: 18px;
    color: #333;
}

.performance-message i {
    font-size: 40px;
    margin-bottom: 10px;
    display: block;
}

.review-section {
    margin: 40px 0;
}

.review-section h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.8em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.review-section h2 i {
    color: #406766;
}

.review-card {
    background: white;
    border-left: 4px solid #ccc;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.review-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.review-card.correct {
    border-left-color: #48bb78;
    background: #f1f8f4;
}

.review-card.incorrect {
    border-left-color: #f56565;
    background: #fef5f5;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.question-number {
    background: #406766;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.review-status {
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95em;
}

.question-text {
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
    font-size: 1.05em;
    line-height: 1.6;
}

.answer-review {
    margin: 15px 0;
}

.review-option {
    padding: 12px;
    margin: 8px 0;
    border-radius: 6px;
    border: 2px solid #e0e0e0;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.review-option:hover {
    border-color: #406766;
    background: white;
}

.review-option.correct-answer {
    background: #e8f5e9;
    border-color: #48bb78;
}

.review-option.incorrect-answer {
    background: #ffebee;
    border-color: #f56565;
}

.option-letter {
    font-weight: bold;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 4px;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
    color: #333;
}

.option-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    background: #48bb78;
    color: white;
    flex-shrink: 0;
}

.option-badge.incorrect {
    background: #f56565;
}

.question-metadata {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 12px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 6px;
    font-size: 13px;
}

.metadata-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #666;
}

.metadata-item i {
    color: #406766;
}

.timestamp-link {
    cursor: pointer;
    color: #406766;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.timestamp-link:hover {
    background: #406766;
    color: white;
}

.timestamp-link:hover i {
    color: white;
}

/* ==================== SOURCE SECTION ==================== */
.source-section {
    background: rgba(237, 137, 54, 0.05);
    border-radius: clamp(0.5rem, 2vw, 0.75rem);
    padding: clamp(0.75rem, 3vw, 1rem);
    margin: clamp(0.75rem, 2.5vw, 1rem) 0;
    border-left: clamp(0.1875rem, 0.8vw, 0.25rem) solid var(--warning-color);
}

.source-section h6 {
    color: var(--warning-color);
    font-weight: 600;
    margin: 0 0 12px 0;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
}

.source-info-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.source-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
    max-width: 100%;
    min-width: 0;
    flex: 1;
    min-width: 200px;
}

.source-label .filename-truncate {
    min-width: 0;
}

.source-timestamp {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px 16px;
    border-radius: 20px;
    background: #406766;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.source-timestamp:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(64, 103, 102, 0.3);
    background: #406766;
    color: white;
}

.source-timestamp i {
    color: white;
}

/* Video Popup Modal */
.video-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.video-popup-overlay.active {
    display: block;
}

.video-popup-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.video-popup-container {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    margin: 5vh auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

.video-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: #406766;
    color: white;
}

.video-popup-header h3 {
    margin: 0;
    font-size: 18px;
}

.close-popup-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

.video-popup-content {
    padding: 0;
    background: black;
}

.video-popup-content video {
    width: 100%;
    height: auto;
    max-height: calc(90vh - 80px);
    display: block;
}

.quiz-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 40px 0;
    flex-wrap: wrap;
}

.quiz-actions .btn {
    padding: 12px 24px;
    font-size: 1em;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.quiz-actions .btn-primary {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.quiz-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(72, 187, 120, 0.3);
}

.quiz-actions .btn-secondary {
    background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
    color: white;
}

.quiz-actions .btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(113, 128, 150, 0.3);
}

.quiz-actions .btn-lg {
    padding: 14px 32px;
    font-size: 1.1em;
}

@media (max-width: 768px) {
    .results-card {
        padding: 20px;
    }

    .score-circle {
        width: 150px;
        height: 150px;
        font-size: 45px;
    }

    .results-summary {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .quiz-actions {
        flex-direction: column;
        align-items: center;
    }

    .quiz-actions .btn {
        width: 100%;
        max-width: 300px;
    }

    .video-popup-container {
        width: 95%;
        max-height: 85vh;
    }

    .question-metadata {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .review-card {
        padding: 15px;
    }
}
