/* ==========================================
   SECURITY CSS - Prevent Selection & Right-Click
   ========================================== */

* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    user-drag: none;
}

input, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

img {
    pointer-events: none;
    -webkit-user-drag: none;
}

/* ==========================================
   SCANINSIGHTS BRAND COLORS
   ========================================== */

:root {
    /* ScanInsights Brand Colors */
    --primary-color: #00a651;        /* ScanInsights Green */
    --primary-dark: #008a44;         /* Darker Green */
    --primary-light: #00c962;        /* Lighter Green */
    --accent-color: #5fc5d9;         /* Light Blue accent */
    --accent-dark: #4ba8ba;          /* Darker Blue */
    
    /* UI Colors */
    --background: #f5f8f7;
    --surface: #ffffff;
    --error: #d32f2f;
    --success: #00a651;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --border: #e0e0e0;
    --shadow: rgba(0, 166, 81, 0.1);
    --shadow-dark: rgba(0, 0, 0, 0.15);
}

/* ==========================================
   BASE STYLES
   ========================================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.hidden {
    display: none !important;
}

/* ==========================================
   AUTH SCREENS (LOGIN/SIGNUP/RESET)
   ========================================== */

.auth-box {
    background: var(--surface);
    padding: 50px 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px var(--shadow-dark);
    width: 100%;
    max-width: 480px;
    border-top: 5px solid var(--primary-color);
}

.auth-form {
    margin-top: 20px;
}

.auth-form h2 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 700;
}

.info-text {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.5;
}

.password-hint {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 6px;
    line-height: 1.4;
}

.auth-links {
    margin-top: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.auth-links a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.logo {
    text-align: center;
    margin-bottom: 40px;
}

.brand-logo {
    max-width: 280px;
    height: auto;
    margin-bottom: 24px;
    pointer-events: none;
}

.logo h1 {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 600;
}

.logo p {
    color: var(--text-secondary);
    font-size: 15px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: var(--surface);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 166, 81, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 166, 81, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 166, 81, 0.4);
}

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

.btn-secondary {
    padding: 10px 24px;
    background: var(--text-secondary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--text-primary);
    transform: translateY(-1px);
}

.btn-back {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.error-message {
    color: var(--error);
    font-size: 14px;
    margin-top: 16px;
    padding: 14px;
    background: rgba(211, 47, 47, 0.1);
    border-radius: 8px;
    border-left: 4px solid var(--error);
    display: none;
}

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

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

#videoLibrary.container {
    display: block;
    padding: 0;
    min-height: 100vh;
}

.navbar {
    background: var(--surface);
    border-bottom: 3px solid var(--primary-color);
    padding: 16px 24px;
    box-shadow: 0 2px 10px var(--shadow);
}

.nav-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-logo {
    max-width: 180px;
    height: auto;
    pointer-events: none;
}

.nav-content h2 {
    color: var(--primary-color);
    font-size: 24px;
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-email {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

/* ==========================================
   WATERMARK
   ========================================== */

.watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: 48px;
    color: rgba(0, 166, 81, 0.08);
    font-weight: bold;
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 20px;
    user-select: none;
}

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

.video-section {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 24px;
}

.video-container {
    background: var(--surface);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px var(--shadow-dark);
    border: 2px solid var(--primary-color);
}

.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    min-height: 600px;
}

#videoPlayer {
    width: 100%;
    max-width: 100%;
    height: 600px;
    display: block;
    min-height: 600px;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 10;
    pointer-events: none;
}

.video-info {
    margin-top: 30px;
}

.video-info h3 {
    font-size: 26px;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 700;
}

.video-info p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.7;
    font-size: 16px;
}

/* ==========================================
   VIDEO LIST SECTION
   ========================================== */

.video-list-section {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 24px;
}

.section-header {
    margin-bottom: 32px;
}

.section-header h3 {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 16px;
    font-weight: 700;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 8px;
    font-weight: 500;
}

/* ==========================================
   SEARCH BAR
   ========================================== */

.search-container {
    margin: 24px 0;
    max-width: 800px;
}

.search-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 166, 81, 0.15);
}

/* ==========================================
   VIDEO LIST (REPLACING GRID)
   ========================================== */

.video-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.video-list-item {
    background: var(--surface);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.video-list-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 16px var(--shadow-dark);
    border-color: var(--primary-color);
}

.video-list-thumbnail {
    width: 80px;
    height: 80px;
    min-width: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
    position: relative;
    overflow: hidden;
}

.video-list-thumbnail::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.15) 0%, transparent 50%);
}

.video-list-info {
    flex: 1;
    min-width: 0;
}

.video-list-info h4 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 700;
    line-height: 1.4;
}

.video-list-info p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-list-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.video-duration-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.video-list-action {
    display: flex;
    align-items: center;
}

.btn-watch {
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 166, 81, 0.3);
}

.btn-watch:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 166, 81, 0.4);
}

/* OLD GRID STYLES - REMOVED */

/* ==========================================
   WARNING NOTICE
   ========================================== */

.warning-notice {
    max-width: 1400px;
    margin: 40px auto 20px;
    padding: 24px 28px;
    background: linear-gradient(135deg, rgba(211, 47, 47, 0.08), rgba(211, 47, 47, 0.12));
    border: 2px solid var(--error);
    border-radius: 12px;
    color: var(--error);
    font-size: 14px;
    line-height: 1.7;
}

.warning-notice strong {
    display: block;
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: 700;
}

/* ==========================================
   FOOTER
   ========================================== */

.footer {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    border-top: 1px solid var(--border);
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    text-decoration: underline;
}

.security-badge {
    margin-top: 8px;
    font-size: 12px;
    color: var(--primary-color);
    font-weight: 600;
}

/* ==========================================
   LOADING OVERLAY
   ========================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    color: white;
    margin-top: 20px;
    font-size: 16px;
    font-weight: 500;
}

/* ==========================================
   SECURITY NOTICE
   ========================================== */

.security-notice {
    position: fixed;
    top: 24px;
    right: 24px;
    background: var(--error);
    color: white;
    padding: 16px 24px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    animation: slideIn 0.3s ease;
    font-weight: 600;
}

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

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

@media (max-width: 768px) {
    .nav-content {
        flex-direction: column;
        gap: 16px;
    }
    
    .nav-left {
        flex-direction: column;
        gap: 12px;
    }
    
    .nav-logo {
        max-width: 150px;
    }
    
    .video-list-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px;
    }
    
    .video-list-thumbnail {
        width: 100%;
        height: 120px;
    }
    
    .video-list-action {
        width: 100%;
    }
    
    .btn-watch {
        width: 100%;
    }
    
    .auth-box {
        padding: 30px 24px;
    }
    
    .brand-logo {
        max-width: 220px;
    }
    
    .watermark {
        font-size: 20px;
        letter-spacing: 8px;
    }
    
    .section-header h3 {
        font-size: 26px;
    }
    
    .search-input {
        font-size: 14px;
    }
}

/* ==========================================
   PRINT PREVENTION
   ========================================== */

@media print {
    body {
        display: none !important;
    }
}

/* ==========================================
   ADDITIONAL SECURITY
   ========================================== */

body {
    -webkit-touch-callout: none;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

/* ==========================================
   DARK MODE STYLES
   ========================================== */

body.dark-mode {
    --background: #1a1a1a;
    --surface: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --border: #404040;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-dark: rgba(0, 0, 0, 0.5);
}

body.dark-mode .navbar {
    background: #2d2d2d;
    border-bottom-color: var(--primary-color);
}

body.dark-mode .video-card,
body.dark-mode .video-list-item,
body.dark-mode .auth-box {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-mode .form-group input,
body.dark-mode .search-input,
body.dark-mode #noteInput,
body.dark-mode #videoDeepLink {
    background: #1a1a1a;
    color: var(--text-primary);
    border-color: #404040;
}

body.dark-mode .video-list-item:hover {
    background: #353535;
}

/* ==========================================
   ENHANCED UI COMPONENTS
   ========================================== */

.btn-icon {
    padding: 8px 12px;
    background: transparent;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.completion-badge {
    padding: 6px 14px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-right: 12px;
}

.video-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 16px;
}

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

.btn-action {
    padding: 10px 20px;
    background: var(--surface);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

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

.btn-action.completed,
.btn-action.favorited {
    background: var(--primary-color);
    color: white;
}

/* ==========================================
   PLAYBACK CONTROLS
   ========================================== */

.playback-controls {
    margin: 20px 0;
    padding: 16px;
    background: var(--surface);
    border-radius: 12px;
    border: 2px solid var(--border);
}

.playback-controls label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.speed-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.speed-option {
    padding: 8px 16px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

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

.speed-option.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* ==========================================
   NOTES SECTION
   ========================================== */

.notes-section {
    margin: 30px 0;
    padding: 20px;
    background: var(--surface);
    border-radius: 12px;
    border: 2px solid var(--border);
}

.notes-section h4 {
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.note-input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

#noteInput {
    width: 100%;
    min-height: 250px;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.3s ease;
}

#noteInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 166, 81, 0.1);
}

#addNoteBtn {
    align-self: flex-start;
    padding: 10px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

#addNoteBtn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 166, 81, 0.3);
}

.notes-list {
    max-height: 400px;
    overflow-y: auto;
}

.note-item {
    padding: 16px;
    background: var(--background);
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
}

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

.note-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.note-delete {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.note-delete:hover {
    opacity: 1;
    transform: scale(1.2);
}

.note-text {
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
}

.no-notes {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    font-style: italic;
}

/* ==========================================
   SHARE SECTION
   ========================================== */

.share-section {
    margin: 24px 0;
    padding: 20px;
    background: linear-gradient(135deg, rgba(0, 166, 81, 0.05), rgba(0, 166, 81, 0.02));
    border-radius: 12px;
    border: 2px solid var(--primary-color);
}

.share-header {
    margin-bottom: 16px;
}

.share-section h4 {
    margin: 0 0 6px 0;
    color: var(--primary-color);
    font-size: 16px;
    font-weight: 600;
}

.share-section .hint {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
}

.link-display-group {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.link-input-enhanced {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    background: var(--background);
    color: var(--text-primary);
    transition: all 0.2s;
    min-width: 0;
}

.link-input-enhanced:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

.btn-copy-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-copy-link:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 166, 81, 0.3);
}

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

.copy-icon {
    font-size: 16px;
}

/* Legacy support */
.link-input-group {
    display: flex;
    gap: 12px;
}

#videoDeepLink {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    background: var(--background);
    color: var(--text-primary);
}

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

.filter-buttons {
    display: flex;
    gap: 12px;
    margin: 16px 0;
}

.filter-btn {
    padding: 10px 20px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

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

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

/* ==========================================
   VIDEO LIST ENHANCEMENTS
   ========================================== */

.video-list-item.completed {
    border-left: 4px solid var(--primary-color);
}

.completion-badge-small {
    display: inline-block;
    padding: 2px 8px;
    background: var(--primary-color);
    color: white;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

.favorite-badge {
    display: inline-block;
    font-size: 16px;
    margin-left: 8px;
}

.video-module {
    font-size: 12px;
    color: var(--accent-color);
    font-weight: 600;
    margin-bottom: 8px;
}

/* ==========================================
   SHORTCUTS HELP
   ========================================== */

.shortcuts-help {
    margin: 20px 0;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.shortcuts-help strong {
    color: var(--text-primary);
}

.shortcuts-help span {
    padding: 4px 10px;
    background: var(--background);
    border-radius: 6px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    color: var(--text-secondary);
}

/* ==========================================
   HINTS AND HELPERS
   ========================================== */

.hint {
    color: var(--text-secondary);
    font-size: 12px;
    font-style: italic;
    display: block;
    margin-top: 6px;
}

.feature-badge {
    font-size: 11px;
    color: var(--primary-color);
    font-weight: 500;
    margin-top: 4px;
}

/* ==========================================
   RESPONSIVE ENHANCEMENTS
   ========================================== */

@media (max-width: 768px) {
    .video-wrapper {
        min-height: 250px;
        max-width: 100%;
        overflow: hidden;
    }
    
    #videoPlayer {
        height: 250px;
        min-height: 250px;
        max-width: 100%;
        width: 100% !important;
    }
    
    .video-container {
        padding: 15px;
        overflow: hidden;
    }
    
    .video-section {
        padding: 0 10px;
        overflow-x: hidden;
    }
    
    #noteInput {
        min-height: 180px;
        font-size: 16px;
    }
    
    #addNoteBtn {
        width: 100%;
        min-width: unset;
    }
    
    .video-header {
        flex-direction: column;
    }
    
    .video-actions {
        width: 100%;
    }
    
    .btn-action {
        flex: 1;
        min-width: 120px;
    }
    
    .speed-buttons {
        justify-content: center;
    }
    
    .note-input-group {
        flex-direction: column;
    }
    
    .link-input-group {
        flex-direction: column;
    }
    
    .shortcuts-help {
        justify-content: center;
    }
    
    .filter-buttons {
        justify-content: center;
    }
    
    .user-info {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .completion-badge {
        margin-bottom: 8px;
    }
}

/* ==========================================
   DARK MODE TRANSITIONS
   ========================================== */

body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

.navbar,
.video-list-item,
.video-card,
.auth-box,
.form-group input,
.search-input,
.note-item,
.playback-controls,
.notes-section,
.share-section {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* ==========================================
   PRINT PREVENTION
   ========================================== */

@media print {
    body {
        display: none !important;
    }
}

/* ==========================================
   ACCESSIBILITY IMPROVEMENTS
   ========================================== */

.btn-primary:focus,
.btn-secondary:focus,
.btn-action:focus,
.btn-watch:focus,
.speed-option:focus,
.filter-btn:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast for better readability */
@media (prefers-contrast: high) {
    .video-list-item {
        border: 3px solid var(--text-primary);
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================
   ROLE TOGGLE STYLES
   ========================================== */

.role-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    background: rgba(0, 166, 81, 0.1);
    padding: 6px;
    border-radius: 12px;
}

.role-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.role-btn:hover {
    background: rgba(0, 166, 81, 0.1);
}

.role-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 166, 81, 0.3);
}

.instructor-only {
    display: none;
}

.instructor-only.visible {
    display: block;
}

/* ==========================================
   NAVIGATION TABS
   ========================================== */

.nav-tabs {
    display: flex;
    gap: 8px;
    margin-left: 30px;
}

.nav-tab {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-tab:hover {
    background: rgba(0, 0, 0, 0.4);
}

.nav-tab.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    text-shadow: none;
}

/* Academy Link - Special Style */
.nav-tab.academy-link {
    background: linear-gradient(135deg, #00a651, #00c962);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.nav-tab.academy-link:hover {
    background: linear-gradient(135deg, #008a44, #00a651);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 166, 81, 0.4);
}

.role-badge {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 10px;
}

.instructor-only-ui {
    display: none;
}

.instructor-only-ui.visible {
    display: inline-flex !important;
}

/* ==========================================
   ADMIN DASHBOARD STYLES
   ========================================== */

.admin-section {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.admin-section.hidden {
    display: none;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow);
}

.admin-header h3 {
    font-size: 24px;
    color: var(--text-primary);
    margin: 0;
}

.admin-actions {
    display: flex;
    gap: 12px;
}

/* Admin Stats Grid */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 2px 8px var(--shadow);
    border-left: 4px solid var(--primary-color);
}

.stat-number {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Admin Filters */
.admin-filters {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.admin-filters .filter-group {
    flex: 1;
    min-width: 200px;
}

.admin-filters label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.admin-filters select,
.admin-filters input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--surface);
    color: var(--text-primary);
    transition: border-color 0.3s;
}

.admin-filters select:focus,
.admin-filters input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Admin Notes Container */
.admin-notes-container {
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow);
}

.admin-notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.admin-notes-header h4 {
    margin: 0;
    font-size: 16px;
}

.admin-notes-list {
    max-height: 600px;
    overflow-y: auto;
}

.admin-note-item {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.admin-note-item:hover {
    background: rgba(0, 166, 81, 0.03);
}

.admin-note-item:last-child {
    border-bottom: none;
}

.admin-note-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-note-user {
    display: flex;
    flex-direction: column;
}

.admin-note-user .name {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 15px;
}

.admin-note-user .email {
    font-size: 12px;
    color: var(--text-secondary);
}

.admin-note-info {
    text-align: right;
}

.admin-note-info .video {
    font-size: 14px;
    color: var(--accent-color);
    font-weight: 500;
}

.admin-note-info .date {
    font-size: 12px;
    color: var(--text-secondary);
}

.admin-note-text {
    background: rgba(0, 166, 81, 0.05);
    padding: 16px;
    border-radius: 8px;
    line-height: 1.6;
    color: var(--text-primary);
    border-left: 3px solid var(--primary-color);
}

/* Admin Loading State */
.admin-loading {
    text-align: center;
    padding: 60px;
    color: var(--text-secondary);
}

.admin-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Admin Empty State */
.admin-empty {
    text-align: center;
    padding: 60px;
    color: var(--text-secondary);
}

.admin-empty .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* ==========================================
   DARK MODE ADMIN STYLES
   ========================================== */

body.dark-mode .admin-header {
    background: #2d2d2d;
}

body.dark-mode .stat-card {
    background: #2d2d2d;
}

body.dark-mode .admin-filters select,
body.dark-mode .admin-filters input {
    background: #2d2d2d;
    border-color: #444;
    color: #fff;
}

body.dark-mode .admin-notes-container {
    background: #2d2d2d;
}

body.dark-mode .admin-note-item {
    border-bottom-color: #444;
}

body.dark-mode .admin-note-item:hover {
    background: rgba(0, 166, 81, 0.1);
}

body.dark-mode .admin-note-text {
    background: rgba(0, 166, 81, 0.1);
    color: #eee;
}

body.dark-mode .role-toggle {
    background: rgba(0, 166, 81, 0.2);
}

body.dark-mode .role-btn {
    color: #aaa;
}

body.dark-mode .role-btn:hover {
    background: rgba(0, 166, 81, 0.2);
}

body.dark-mode .nav-tab {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .nav-tab:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ==========================================
   RESPONSIVE ADMIN STYLES
   ========================================== */

@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-filters {
        flex-direction: column;
    }

    .admin-filters .filter-group {
        min-width: 100%;
    }

    .admin-note-meta {
        flex-direction: column;
    }

    .admin-note-info {
        text-align: left;
    }

    .nav-tabs {
        margin-left: 0;
        margin-top: 10px;
    }

    .nav-content {
        flex-wrap: wrap;
    }

    .role-toggle {
        flex-direction: column;
    }
}

/* ==========================================
   TOAST NOTIFICATION STYLES
   ========================================== */

.toast-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 14px 28px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 166, 81, 0.4);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-notification.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-icon {
    background: rgba(255, 255, 255, 0.2);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* ==========================================
   LOGO LINK STYLES
   ========================================== */

.logo-link {
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.2s;
}

.logo-link:hover {
    opacity: 0.8;
}

/* ==========================================
   TRAINER STYLES (renamed from instructor)
   ========================================== */

.trainer-only {
    display: none;
}

.trainer-only.visible {
    display: block;
}

.trainer-only-ui {
    display: none;
}

.trainer-only-ui.visible {
    display: inline-flex !important;
}

/* ==========================================
   SCREENSHOT/RECORDING PREVENTION
   ========================================== */

/* Make video area black when screen sharing/recording detected */
@media screen and (display-mode: standalone) {
    .video-wrapper iframe {
        filter: brightness(0);
    }
}

/* Prevent screenshots on some devices */
.video-wrapper {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Add extra overlay protection */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

/* When print/screenshot detected (experimental) */
@media print {
    .video-wrapper,
    .video-wrapper iframe,
    #videoPlayer {
        display: none !important;
        visibility: hidden !important;
    }
    
    .video-wrapper::after {
        content: "Video content protected - Cannot be printed";
        display: block;
        padding: 100px;
        text-align: center;
        background: #000;
        color: #fff;
    }
}

/* ==========================================
   BACK BUTTON AT TOP STYLES
   ========================================== */

.btn-back {
    display: inline-block;
    margin-bottom: 20px;
    padding: 10px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

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

body.dark-mode .btn-back {
    background: #333;
    border-color: #444;
    color: #fff;
}

body.dark-mode .btn-back:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* ==========================================
   UPDATED FOOTER STYLES
   ========================================== */

.footer {
    text-align: center;
    padding: 20px;
    margin-top: 30px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

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

.footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

body.dark-mode .footer {
    border-top-color: #444;
    color: #888;
}

/* ==========================================
   TAG SELECTOR STYLES
   ========================================== */

.note-tag-selector {
    margin-bottom: 15px;
}

.note-tag-selector label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.tag-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag-btn {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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

.tag-btn[data-tag="question"].active {
    background: #e74c3c;
    border-color: #e74c3c;
}

.tag-btn[data-tag="confused"].active {
    background: #f39c12;
    border-color: #f39c12;
}

.tag-btn[data-tag="important"].active {
    background: #9b59b6;
    border-color: #9b59b6;
}

/* ==========================================
   NOTE TAG BADGE STYLES
   ========================================== */

.note-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

.note-tag.observation {
    background: rgba(0, 166, 81, 0.15);
    color: var(--primary-color);
}

.note-tag.question {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
}

.note-tag.confused {
    background: rgba(243, 156, 18, 0.15);
    color: #f39c12;
}

.note-tag.important {
    background: rgba(155, 89, 182, 0.15);
    color: #9b59b6;
}

/* ==========================================
   NOTIFICATION BADGE STYLES
   ========================================== */

.notification-badge {
    background: #e74c3c;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    animation: pulse 2s infinite;
    margin-right: 10px;
}

.notification-badge.hidden {
    display: none;
}

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

.badge-count {
    display: inline-block;
    background: #e74c3c;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
    line-height: 1;
}

.badge-count.hidden {
    display: none;
}

/* ==========================================
   REPLY STYLES
   ========================================== */

.note-replies {
    margin-top: 12px;
    padding-left: 20px;
    border-left: 3px solid var(--primary-color);
}

.reply-item {
    background: rgba(0, 166, 81, 0.05);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.reply-item.trainer-reply {
    background: rgba(52, 152, 219, 0.1);
    border-left: 3px solid #3498db;
}

.reply-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
}

.reply-author {
    font-weight: 600;
    color: var(--primary-color);
}

.reply-author.trainer {
    color: #3498db;
}

.reply-author.trainer::before {
    content: "👨‍🏫 ";
}

.reply-date {
    color: var(--text-secondary);
}

.reply-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
}

.reply-input-group {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.reply-input-group input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.reply-input-group button {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.reply-input-group button:hover {
    background: var(--primary-dark);
}

/* ==========================================
   ADMIN NOTE ITEM ENHANCED
   ========================================== */

.admin-note-item {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.admin-note-item.unread {
    background: rgba(52, 152, 219, 0.05);
    border-left: 4px solid #3498db;
}

.admin-note-item.needs-answer {
    background: rgba(231, 76, 60, 0.05);
    border-left: 4px solid #e74c3c;
}

.admin-note-item:hover {
    background: rgba(0, 166, 81, 0.03);
}

.admin-note-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.admin-note-actions button {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-note-actions button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.admin-note-actions button.btn-answered {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.admin-note-actions button.btn-reply {
    background: #3498db;
    border-color: #3498db;
    color: white;
}

/* Status indicators */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

.status-badge.answered {
    background: rgba(0, 166, 81, 0.15);
    color: var(--primary-color);
}

.status-badge.unanswered {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
}

.status-badge.unread {
    background: rgba(52, 152, 219, 0.15);
    color: #3498db;
}

/* Highlight stats card */
.stat-card.highlight {
    border-left-color: #e74c3c;
}

.stat-card.highlight .stat-number {
    color: #e74c3c;
}

/* ==========================================
   STUDENT NOTE VIEW WITH REPLIES
   ========================================== */

.note-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
}

.note-item.has-reply {
    border-left: 3px solid #3498db;
}

.note-item.has-unread {
    background: rgba(52, 152, 219, 0.05);
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.note-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.note-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.note-content {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}

.trainer-reply-section {
    margin-top: 12px;
    padding: 12px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 8px;
    border-left: 3px solid #3498db;
}

.trainer-reply-header {
    font-size: 12px;
    color: #3498db;
    font-weight: 600;
    margin-bottom: 6px;
}

.trainer-reply-content {
    font-size: 14px;
    line-height: 1.5;
}

.new-reply-indicator {
    background: #e74c3c;
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

/* ==========================================
   DARK MODE ENHANCEMENTS
   ========================================== */

body.dark-mode .tag-btn {
    background: #333;
    border-color: #444;
    color: #aaa;
}

body.dark-mode .tag-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

body.dark-mode .note-item {
    background: #2d2d2d;
    border-color: #444;
}

body.dark-mode .reply-item {
    background: rgba(0, 166, 81, 0.1);
}

body.dark-mode .reply-item.trainer-reply {
    background: rgba(52, 152, 219, 0.15);
}

body.dark-mode .reply-input-group input {
    background: #333;
    border-color: #444;
    color: #fff;
}

body.dark-mode .trainer-reply-section {
    background: rgba(52, 152, 219, 0.15);
}

/* ==========================================
   RESPONSIVE ADJUSTMENTS
   ========================================== */

@media (max-width: 768px) {
    .tag-buttons {
        justify-content: flex-start;
    }
    
    .tag-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .admin-filters {
        flex-direction: column;
    }
    
    .reply-input-group {
        flex-direction: column;
    }
    
    .admin-note-actions {
        flex-direction: column;
    }
    
    .admin-note-actions button {
        width: 100%;
        text-align: center;
    }
}

/* ==========================================
   STUDENT REPLY IN CONVERSATION
   ========================================== */

.note-replies-section {
    margin-top: 12px;
    border-left: 3px solid var(--primary-color);
    padding-left: 15px;
}

.trainer-reply-section.from-trainer {
    background: rgba(52, 152, 219, 0.1);
    border-left: 3px solid #3498db;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.trainer-reply-section.from-student {
    background: rgba(0, 166, 81, 0.1);
    border-left: 3px solid var(--primary-color);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.student-reply-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.student-reply-section .reply-input-group {
    display: flex;
    gap: 8px;
}

.student-reply-section .student-reply-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
}

.student-reply-section .btn-reply-small {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.student-reply-section .btn-reply-small:hover {
    background: var(--primary-dark);
}

/* Dark mode */
body.dark-mode .student-reply-section .student-reply-input {
    background: #333;
    border-color: #444;
    color: #fff;
}

body.dark-mode .trainer-reply-section.from-trainer {
    background: rgba(52, 152, 219, 0.15);
}

body.dark-mode .trainer-reply-section.from-student {
    background: rgba(0, 166, 81, 0.15);
}

/* Mobile */
@media (max-width: 768px) {
    .student-reply-section .reply-input-group {
        flex-direction: column;
    }
    
    .student-reply-section .btn-reply-small {
        width: 100%;
    }
}

/* ==========================================
   ENHANCED SCREENSHOT PROTECTION
   ========================================== */

/* Blur video when window loses focus (for screen recording detection) */
.video-blur-protection {
    filter: blur(30px) !important;
    transition: filter 0.1s ease;
}

/* Blur overlay for focus loss */
.blur-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: white;
    font-size: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.blur-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.blur-overlay .icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.blur-overlay .message {
    font-size: 18px;
    color: #ccc;
    margin-top: 10px;
}

/* ==========================================
   ADMIN STUDENT SECTIONS
   ========================================== */

.student-section {
    margin-bottom: 30px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.student-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.student-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.student-name {
    font-size: 18px;
    font-weight: 600;
}

.student-email {
    font-size: 14px;
    opacity: 0.9;
}

.student-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.stat-item {
    font-size: 14px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
}

.student-notes {
    padding: 0;
}

.student-notes .admin-note-item {
    border-bottom: 1px solid var(--border);
    border-left: none;
    border-right: none;
    border-top: none;
    border-radius: 0;
}

.student-notes .admin-note-item:last-child {
    border-bottom: none;
}

/* Dark mode */
body.dark-mode .student-section {
    border-color: #444;
}

body.dark-mode .student-header {
    background: linear-gradient(135deg, #006B3F, #005030);
}

/* Mobile */
@media (max-width: 768px) {
    .student-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .student-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ==========================================
   DELETE NOTE BUTTON
   ========================================== */

.btn-delete-note {
    padding: 8px 16px;
    background: #e74c3c;
    border: 1px solid #c0392b;
    border-radius: 6px;
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete-note:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

/* ==========================================
   SHARE SECTION RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .link-display-group {
        flex-direction: column;
    }
    
    .btn-copy-link {
        justify-content: center;
        width: 100%;
    }
    
    .link-input-enhanced {
        font-size: 12px;
        padding: 12px;
    }
    
    .share-section {
        padding: 16px;
    }
}

/* ==========================================
   PERFORMANCE OPTIMIZATIONS
   ========================================== */

/* Use GPU acceleration for animations */
.video-card,
.note-item,
.admin-note-item,
.toast-notification {
    will-change: transform;
    transform: translateZ(0);
}

/* Optimize image rendering */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

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

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================
   COMPREHENSIVE MOBILE OPTIMIZATION
   iPhone 14 and similar devices (390px - 430px)
   ========================================== */

/* Small phones */
@media (max-width: 430px) {
    /* Navigation */
    .nav-content {
        padding: 10px 15px;
    }
    
    .nav-logo {
        max-width: 120px;
    }
    
    .nav-tabs {
        margin-left: 0;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .nav-tab {
        padding: 8px 12px;
        font-size: 12px;
        flex: 0 1 auto;
    }
    
    /* Academy/Courses link mobile */
    .nav-tab.academy-link {
        padding: 8px 14px;
        font-size: 12px;
    }
    
    .user-info {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .user-name, .user-email {
        font-size: 11px;
    }
    
    .completion-badge {
        font-size: 11px;
        padding: 4px 10px;
    }
    
    #logoutBtn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    /* Video Player Section */
    .video-player-section {
        padding: 15px;
    }
    
    .video-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    #videoTitle {
        font-size: 18px;
        line-height: 1.3;
    }
    
    #videoDescription {
        font-size: 13px;
    }
    
    /* Video Actions - CRITICAL FIX */
    .video-actions {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }
    
    .btn-action {
        width: 100%;
        padding: 12px 15px;
        font-size: 13px;
        text-align: center;
        white-space: normal;
        line-height: 1.3;
    }
    
    /* Fullscreen button */
    .btn-fullscreen {
        width: 100%;
        padding: 12px 15px;
        font-size: 13px;
    }
    
    /* Notes Section */
    .notes-section {
        padding: 15px;
    }
    
    .notes-section h3 {
        font-size: 16px;
    }
    
    .note-tag-selector h4 {
        font-size: 14px;
    }
    
    .tag-buttons {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .tag-btn {
        padding: 8px 10px;
        font-size: 11px;
        flex: 1 1 45%;
        text-align: center;
    }
    
    .note-input-group {
        flex-direction: column;
        gap: 10px;
    }
    
    #noteInput {
        font-size: 14px;
        padding: 12px;
    }
    
    #addNoteBtn {
        width: 100%;
        padding: 12px;
    }
    
    /* Notes Display */
    .note-item {
        padding: 12px;
    }
    
    .note-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .note-text {
        font-size: 13px;
    }
    
    .note-date {
        font-size: 11px;
    }
    
    /* Reply sections */
    .trainer-reply-section,
    .student-reply-section {
        padding: 10px;
        margin-top: 8px;
    }
    
    .reply-input {
        font-size: 13px;
        padding: 10px;
    }
    
    .btn-reply-small {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    /* Share Section */
    .share-section {
        padding: 12px;
    }
    
    .share-section h4 {
        font-size: 14px;
    }
    
    .link-display-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .link-input-enhanced {
        font-size: 12px;
        padding: 10px;
    }
    
    .btn-copy-link {
        width: 100%;
        justify-content: center;
        padding: 12px;
    }
    
    /* Keyboard shortcuts - hide on mobile */
    .shortcuts-help {
        display: none;
    }
    
    /* Video List */
    .video-list-item {
        padding: 12px;
    }
    
    .video-list-info h4 {
        font-size: 14px;
    }
    
    .video-list-info p {
        font-size: 12px;
    }
    
    .video-meta span {
        font-size: 11px;
    }
    
    .btn-watch {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    /* Filter buttons */
    .filter-buttons {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .filter-btn {
        padding: 8px 12px;
        font-size: 12px;
        flex: 1 1 30%;
        text-align: center;
    }
    
    /* Search */
    .search-container {
        padding: 0 15px;
    }
    
    .search-input {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    /* Admin Dashboard */
    .admin-filters {
        flex-direction: column;
        gap: 10px;
    }
    
    .admin-filters select {
        width: 100%;
    }
    
    .admin-stats {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-card .number {
        font-size: 24px;
    }
    
    .stat-card .label {
        font-size: 11px;
    }
    
    /* Admin Note Items */
    .admin-note-item {
        padding: 12px;
    }
    
    .admin-note-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .reply-input-group {
        flex-direction: column;
        width: 100%;
    }
    
    .reply-input-group input {
        width: 100%;
    }
    
    .reply-input-group .btn-reply {
        width: 100%;
    }
    
    .btn-answered,
    .btn-delete-note {
        width: 100%;
        padding: 10px;
        font-size: 13px;
    }
    
    /* Student sections in admin */
    .student-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 15px;
    }
    
    .student-stats {
        flex-direction: column;
        gap: 6px;
        width: 100%;
    }
    
    .stat-item {
        padding: 6px 10px;
        font-size: 12px;
        text-align: center;
    }
    
    /* Auth/Login */
    .auth-box {
        padding: 25px 20px;
        margin: 15px;
    }
    
    .brand-logo {
        max-width: 180px;
    }
    
    .auth-box h2 {
        font-size: 22px;
    }
    
    .auth-input {
        padding: 12px;
        font-size: 14px;
    }
    
    .btn-primary {
        padding: 12px;
        font-size: 14px;
    }
    
    /* Watermark */
    .watermark {
        font-size: 14px;
        letter-spacing: 4px;
    }
    
    /* Toast notifications */
    .toast-notification {
        left: 15px;
        right: 15px;
        bottom: 20px;
        font-size: 13px;
        padding: 12px 15px;
    }
}

/* Extra small phones (iPhone SE, etc) */
@media (max-width: 375px) {
    .nav-logo {
        max-width: 100px;
    }
    
    .nav-tabs {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .nav-tab {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .nav-tab.academy-link {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .btn-action {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .tag-btn {
        padding: 6px 8px;
        font-size: 10px;
    }
    
    #videoTitle {
        font-size: 16px;
    }
    
    .admin-stats {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   FULLSCREEN VIDEO BUTTON STYLES
   ========================================== */

.btn-fullscreen {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--surface);
    border: 2px solid #3498db;
    color: #3498db;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-fullscreen:hover {
    background: #3498db;
    color: white;
    transform: translateY(-2px);
}

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

/* Fullscreen mode iframe */
.video-wrapper.fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    background: black !important;
    border-radius: 0 !important;
}

.video-wrapper.fullscreen-mode iframe {
    width: 100% !important;
    height: 100% !important;
}

/* Exit fullscreen button */
.exit-fullscreen-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100000;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: none;
}

.video-wrapper.fullscreen-mode + .exit-fullscreen-btn,
.exit-fullscreen-btn.visible {
    display: block;
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .btn-action,
    .btn-fullscreen,
    .btn-watch,
    .btn-primary,
    .btn-secondary,
    .tag-btn,
    .filter-btn {
        min-height: 44px; /* Apple recommended touch target */
    }
    
    .nav-tab {
        min-height: 40px;
    }
}
