/* ── Theme Variables ─────────────────────────────────────────────────── */
:root {
    /* Page & Surface Backgrounds */
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-muted: #f1f5f9;
    --bg-input: #ffffff;
    --bg-hover: #f1f5f9;

    /* Brand */
    --brand-primary: #264A34;
    --brand-primary-dark: #1e3a28;

    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-subtle: #475569;
    --text-link: #264A34;

    /* Borders */
    --border-color: #e2e8f0;
    --border-light: #cbd5e1;
    --border-input: #e2e8f0;

    /* Status: Success */
    --color-success: #10b981;
    --bg-success: #dcfce7;
    --bg-success-light: #f0fdf4;
    --bg-success-alt: #bbf7d0;
    --text-success: #166534;

    /* Status: Error */
    --color-error: #ef4444;
    --bg-error: #fecaca;
    --text-error-dark: #991b1b;

    /* Status: Warning */
    --bg-warning: #fef3c7;
    --text-warning: #92400e;

    /* Status: Info */
    --color-info: #6366f1;
    --bg-info: #c7d2fe;
    --bg-info-light: #dbeafe;
    --text-info: #1e40af;

    /* Shadows & Overlays */
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-color-light: rgba(0, 0, 0, 0.06);
    --shadow-color-medium: rgba(0, 0, 0, 0.08);
    --shadow-color-heavy: rgba(0, 0, 0, 0.12);
    --bg-overlay: rgba(0, 0, 0, 0.5);
    --bg-overlay-dark: rgba(0, 0, 0, 0.8);
    --bg-overlay-play: rgba(0, 0, 0, 0.7);

    /* Tags */
    --tag-bg: #dcfce7;
    --tag-text: #166534;

    /* Misc */
    --bg-tooltip: #1e293b;
    --color-selection-bg: rgba(38, 74, 52, 0.1);
}

html.dark {
    /* Page & Surface Backgrounds */
    --bg-page: #030712;
    --bg-card: #111827;
    --bg-muted: #1f2937;
    --bg-input: #1f2937;
    --bg-hover: #374151;

    /* Brand */
    --brand-primary: #1E3A8A;
    --brand-primary-dark: #1e40af;

    /* Text */
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-subtle: #d1d5db;
    --text-link: #60a5fa;

    /* Borders */
    --border-color: #374151;
    --border-light: #4b5563;
    --border-input: #4b5563;

    /* Status: Success */
    --color-success: #047857;
    --bg-success: rgba(4, 120, 87, 0.15);
    --bg-success-light: rgba(4, 120, 87, 0.1);
    --bg-success-alt: rgba(4, 120, 87, 0.2);
    --text-success: #6ee7b7;

    /* Status: Error */
    --color-error: #DC3545;
    --bg-error: rgba(220, 53, 69, 0.15);
    --text-error-dark: #fca5a5;

    /* Status: Warning */
    --bg-warning: rgba(255, 193, 7, 0.15);
    --text-warning: #fbbf24;

    /* Status: Info */
    --color-info: #17A2B8;
    --bg-info: rgba(23, 162, 184, 0.15);
    --bg-info-light: rgba(23, 162, 184, 0.1);
    --text-info: #60a5fa;

    /* Shadows & Overlays */
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-color-light: rgba(0, 0, 0, 0.2);
    --shadow-color-medium: rgba(0, 0, 0, 0.25);
    --shadow-color-heavy: rgba(0, 0, 0, 0.4);
    --bg-overlay: rgba(3, 7, 18, 0.5);
    --bg-overlay-dark: rgba(3, 7, 18, 0.8);
    --bg-overlay-play: rgba(0, 0, 0, 0.7);

    /* Tags */
    --tag-bg: rgba(30, 58, 138, 0.2);
    --tag-text: #93c5fd;

    /* Misc */
    --bg-tooltip: #f3f4f6;
    --color-selection-bg: rgba(30, 58, 138, 0.4);
}
/* ── End Theme Variables ────────────────────────────────────────────── */

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

/* Dark mode toggle button */
.dark-mode-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-size: 16px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dark-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-page);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1700px;
    margin: 0 auto;
    padding: 24px;
    padding-top: 70px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-dark) 100%);
    border-radius: 20px;
    padding: 20px 24px;
    margin-bottom: 32px;
    box-shadow: 0 4px 6px -1px var(--shadow-color), 0 2px 4px -1px var(--shadow-color-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    position: fixed;
    top: 24px;
    left: 0;
    right: 0;
    max-width: 1700px;
    margin-left: auto;
    margin-right: auto;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

.logo h1 {
    color: white;
    font-size: 18px;
    font-weight: 600;
}

.nav-links {
    display: flex;
    gap: 16px;
    align-items: center;
}

.nav-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
    justify-content: flex-end;
    position: relative;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    font-size: 12px;
}

.notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--color-error);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Page Sections */
.page-header {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: 0 1px 3px var(--shadow-color);
    border: 1px solid var(--border-color);
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 16px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 1px 3px var(--shadow-color), 0 1px 2px var(--shadow-color-light);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 6px -1px var(--shadow-color), 0 2px 4px -1px var(--shadow-color-light);
    transform: translateY(-1px);
}

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

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-icon {
    width: 36px;
    height: 36px;
    background: var(--brand-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

/* Grid Layouts */
.grid {
    display: grid;
    gap: 24px;
    margin-bottom: 32px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: var(--brand-primary-dark);
}

.btn-secondary {
    background: var(--bg-muted);
    color: var(--text-subtle);
}

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

/* Upload Area */
.upload-section {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: 0 1px 3px var(--shadow-color);
    border: 1px solid var(--border-color);
}

.upload-area {
    border: 2px dashed var(--border-light);
    border-radius: 12px;
    padding: 48px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-area:hover {
    border-color: var(--brand-primary);
    background: var(--bg-page);
}

.upload-area.dragover {
    border-color: var(--brand-primary);
    background: var(--bg-success-light);
}

.upload-icon {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Video Cards */
.video-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow-color-medium);
    border: 1px solid var(--bg-muted);
    transition: all 0.3s ease;
    cursor: pointer;
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px var(--shadow-color-heavy);
}

.video-thumbnail {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #c7d2fe 0%, #a5b4fc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: var(--bg-overlay-play);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.video-duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.video-info {
    padding: 16px;
}

.video-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.video-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
}

.status-completed {
    background: var(--bg-success);
    color: var(--text-success);
}

.status-processing {
    background: var(--bg-warning);
    color: var(--text-warning);
}

.status-uploading {
    background: var(--bg-info-light);
    color: var(--text-info);
}

.status-failed {
    background: var(--bg-error);
    color: var(--text-error-dark);
}

.video-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.video-tag {
    background: var(--bg-muted);
    color: var(--text-subtle);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay-dark);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

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

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

.modal-body {
    padding: 24px;
}

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

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-muted);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 64px 32px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.empty-icon {
    font-size: 64px;
    color: var(--border-light);
    margin-bottom: 16px;
}

/* Mobile menu button - hidden on desktop */
.header-top-row {
    display: contents;
}

.mobile-menu-btn {
    display: none;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 0;
        padding: 12px 16px;
        border-radius: 12px;
        top: 8px;
    }

    .header-top-row {
        display: flex;
        width: 100%;
        justify-content: space-between;
        align-items: center;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .nav-links {
        width: 100%;
        flex-direction: column;
        gap: 4px;
        padding-top: 0;
        margin-top: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        transition: max-height 0.35s ease, opacity 0.25s ease, padding-top 0.35s ease, margin-top 0.35s ease;
    }

    .header.menu-open .nav-links {
        max-height: 300px;
        opacity: 1;
        padding-top: 12px;
        margin-top: 12px;
    }

    .nav-link {
        width: 100%;
        text-align: center;
        padding: 10px 12px;
        font-size: 15px;
        transform: translateY(-8px);
        opacity: 0;
        transition: transform 0.25s ease, opacity 0.25s ease;
    }

    .header.menu-open .nav-link {
        transform: translateY(0);
        opacity: 1;
    }

    .header.menu-open .nav-link:nth-child(1) { transition-delay: 0.05s; }
    .header.menu-open .nav-link:nth-child(2) { transition-delay: 0.1s; }
    .header.menu-open .nav-link:nth-child(3) { transition-delay: 0.15s; }
    .header.menu-open .nav-link:nth-child(4) { transition-delay: 0.2s; }
    .header.menu-open .nav-link:nth-child(5) { transition-delay: 0.25s; }

    .user-info {
        width: 100%;
        justify-content: center;
        min-width: 0;
        padding-top: 0;
        margin-top: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        transition: max-height 0.35s ease, opacity 0.25s ease, padding-top 0.35s ease, margin-top 0.35s ease;
    }

    .header.menu-open .user-info {
        max-height: 80px;
        opacity: 1;
        padding-top: 12px;
        margin-top: 4px;
    }

    .container {
        padding-top: 60px;
    }
    
    .grid {
        grid-template-columns: 1fr;
    }
}

/* Equipment Detail Page Styles */

/* Equipment Hero Section */
.equipment-hero {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: 0 1px 3px var(--shadow-color), 0 1px 2px var(--shadow-color-light);
    border: 1px solid var(--border-color);
}

.hero-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 32px;
    align-items: start;
}

.equipment-image {
    width: 100%;
    height: 250px;
    background: linear-gradient(135deg, #c7d2fe 0%, #a5b4fc 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4338ca;
    font-size: 64px;
    position: relative;
}

.ar-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--brand-primary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.equipment-details h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.equipment-model {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 16px;
}

.equipment-badges {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge.complexity {
    background: var(--bg-warning);
    color: var(--text-warning);
}

.badge.category {
    background: var(--bg-success);
    color: var(--text-success);
}

.badge.location {
    background: var(--bg-success);
    color: var(--text-success);
}

.equipment-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat {
    text-align: center;
}

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

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

.action-buttons {
    display: flex;
    gap: 12px;
}

.back-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s ease;
}

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

/* Content Tabs */
.content-tabs {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 1px 3px var(--shadow-color), 0 1px 2px var(--shadow-color-light);
    border: 1px solid var(--border-color);
    margin-bottom: 32px;
}

.tab-nav {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 16px 24px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn.active {
    color: var(--brand-primary);
    border-bottom: 2px solid var(--brand-primary);
}

.tab-content {
    padding: 32px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

/* Manual Section */
.manual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.manual-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--bg-muted);
    box-shadow: 0 2px 8px var(--shadow-color-medium);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.manual-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px var(--shadow-color-heavy);
}

.manual-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #dc2626;
    font-size: 24px;
    margin: 0 auto 16px;
}

.manual-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.manual-size {
    font-size: 13px;
    color: var(--text-secondary);
}

/* 3D Model Section */
.model-viewer {
    background: var(--bg-tooltip);
    border-radius: 12px;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    margin-bottom: 24px;
    position: relative;
}

.model-controls {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
}

.control-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Safety Checklist */
.checklist {
    list-style: none;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--bg-muted);
}

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

.checklist-icon {
    width: 24px;
    height: 24px;
    background: var(--color-error);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    margin-top: 2px;
}

.checklist-content h4 {
    color: var(--text-primary);
    margin-bottom: 4px;
}

.checklist-content p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Quiz Section */
.quiz-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--bg-muted);
    box-shadow: 0 2px 8px var(--shadow-color-medium);
    text-align: center;
}

.quiz-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #bbf7d0 0%, #86efac 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #059669;
    font-size: 32px;
    margin: 0 auto 20px;
}

.quiz-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.quiz-description {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.quiz-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 24px;
}

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

.quiz-stat-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--brand-primary);
}

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

/* AI Chat Section */
.ai-chat-container {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--bg-muted);
    box-shadow: 0 2px 8px var(--shadow-color-medium);
    height: 600px;
    display: flex;
    flex-direction: column;
}

.ai-chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--bg-muted);
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-primary);
    font-size: 18px;
}

.ai-info h3 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.ai-status {
    color: var(--color-success);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.ai-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.message-avatar.ai {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: var(--brand-primary);
}

.message-avatar.user {
    background: linear-gradient(135deg, #bbf7d0 0%, #86efac 100%);
    color: var(--brand-primary);
}

.message-content {
    background: var(--bg-page);
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 70%;
    font-size: 14px;
    line-height: 1.5;
}

.ai-message.user .message-content {
    background: var(--brand-primary);
    color: white;
}

.ai-chat-input {
    padding: 20px;
    border-top: 1px solid var(--bg-muted);
    display: flex;
    gap: 12px;
    align-items: center;
}

.ai-input-field {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    outline: none;
    font-size: 14px;
    resize: none;
    min-height: 20px;
    max-height: 100px;
}

.ai-input-field:focus {
    border-color: var(--brand-primary);
}

.ai-send-btn {
    width: 40px;
    height: 40px;
    background: var(--color-info);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.ai-send-btn:hover {
    background: #4f46e5;
}

.ai-send-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.ai-suggestion {
    background: var(--bg-muted);
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

.ai-suggestion:hover {
    background: var(--border-color);
    color: var(--text-subtle);
}

/* Play Button Overlay */
.play-btn {
    position: absolute;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #334155;
    font-size: 20px;
}

/* Additional Mobile Responsive Styles */
@media (max-width: 768px) {
    .hero-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }

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

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

    .tab-btn {
        flex: none;
        min-width: 120px;
    }

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

/* Dashboard Specific Styles */

/* Search Section */
.search-section {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: 0 1px 3px var(--shadow-color), 0 1px 2px var(--shadow-color-light);
    border: 1px solid var(--border-color);
}

.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 16px 140px 16px 20px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 16px;
    outline: none;
    transition: all 0.2s ease;
    background: var(--bg-page);
}

.search-input:focus {
    border-color: var(--brand-primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px var(--color-selection-bg);
}

.search-buttons {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 6px;
}

.search-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: var(--brand-primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 14px;
}

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

.quick-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.quick-action {
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-subtle);
}

.quick-action:hover {
    background: var(--bg-card);
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px var(--shadow-color);
}

/* Main Dashboard Grid */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-bottom: 32px;
}

/* Progress Section */
.progress-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 0;
    border-bottom: 1px solid var(--bg-muted);
}

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

.progress-info {
    display: block !important;
    flex: 1;
    max-width: 70%;
}

.progress-info h4 {
    color: var(--text-primary);
    margin: 0 0 6px 0 !important;
    padding: 0 !important;
    font-weight: 500;
    font-size: 15px;
    display: block !important;
    width: 100%;
    line-height: 1.4;
}

.progress-info p {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    width: 100%;
    line-height: 1.4;
}

.progress-bar {
    width: 80px;
    height: 6px;
    background: var(--bg-muted);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-success);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Equipment Grid */
.equipment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.equipment-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 1px 3px var(--shadow-color), 0 1px 2px var(--shadow-color-light);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex !important;
    flex-direction: column !important;
}

.equipment-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px var(--shadow-color), 0 2px 4px -1px var(--shadow-color-light);
}

.equipment-image {
    width: 100%;
    height: 140px;
    background: var(--bg-page);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-info);
    font-size: 40px;
    flex-shrink: 0;
}

.equipment-image.hvac {
    background: linear-gradient(135deg, #c7d2fe 0%, #a5b4fc 100%);
    color: #4338ca;
}

.equipment-image.electrical {
    background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
    color: #f59e0b;
}

.equipment-image.fire {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    color: #ef4444;
}

.equipment-image.automation {
    background: linear-gradient(135deg, #bbf7d0 0%, #a7f3d0 100%);
    color: #10b981;
}

.equipment-image.trane {
    background: linear-gradient(135deg, #bbf7d0 0%, #a7f3d0 100%);
    color: #10b981;
}

.equipment-info {
    display: flex !important;
    flex-direction: column !important;
    width: 100%;
    gap: 8px;
    flex: 1;
}

.equipment-info h3 {
    color: var(--text-primary);
    margin-bottom: 0;
    font-size: 16px;
    font-weight: 600;
    display: block;
    width: 100%;
    line-height: 1.4;
}

.equipment-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    width: 100%;
    flex-wrap: nowrap;
}

.complexity-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.complexity-beginner {
    background: var(--bg-success);
    color: var(--text-success);
}

.complexity-intermediate {
    background: var(--bg-warning);
    color: var(--text-warning);
}

.complexity-advanced {
    background: var(--bg-error);
    color: var(--text-error-dark);
}

.equipment-stats {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 0;
}

.equipment-stats .tooltip {
    display: inline-block;
}

.equipment-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Status indicators */
.status-high {
    color: var(--color-error);
    background: #fef2f2;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.status-medium {
    color: #f59e0b;
    background: #fffbeb;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.status-low {
    color: var(--color-success);
    background: var(--bg-success-light);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

/* Tooltip Styles */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 140px;
    background-color: var(--bg-tooltip);
    color: white;
    text-align: center;
    border-radius: 8px;
    padding: 8px 12px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    margin-left: -70px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 4px 6px -1px var(--shadow-color);
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--bg-tooltip) transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.5s ease forwards;
}

.card:nth-child(2) {
    animation-delay: 0.1s;
}

.equipment-card {
    /* Removed staggered animation for instant loading */
    /* animation: fadeInUp 0.5s ease forwards; */
}

/* Mobile Responsive for Dashboard */
@media (max-width: 768px) {
    .main-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

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

    .quick-actions {
        gap: 12px;
    }

    .quick-action {
        padding: 10px 16px;
        font-size: 13px;
    }

    .search-section {
        padding: 24px;
    }

    .search-input {
        padding-right: 110px;
    }

    .search-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
        border-radius: 6px;
    }

    .search-buttons {
        gap: 4px;
        right: 6px;
    }
}

@media (max-width: 480px) {
    .search-input {
        padding-right: 95px;
        font-size: 14px;
    }

    .search-btn {
        width: 24px;
        height: 24px;
        font-size: 11px;
        border-radius: 5px;
    }

    .search-buttons {
        gap: 3px;
        right: 5px;
    }
}

/* Equipment Library Specific Styles */

/* Page Header with Filters */
.page-header {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: 0 1px 3px var(--shadow-color), 0 1px 2px var(--shadow-color-light);
    border: 1px solid var(--border-color);
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 24px;
}

/* Filters */
.filters {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-select {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease;
}

.filter-select:focus {
    border-color: var(--brand-primary);
}

.search-box {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* Stats Bar - Updated */
.stats-bar {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px 32px;
    margin-bottom: 32px;
    box-shadow: 0 1px 3px var(--shadow-color), 0 1px 2px var(--shadow-color-light);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat {
    text-align: center;
}

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

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

/* Equipment Grid - Flexbox Layout for Equipment Library Page */
#equipmentGrid {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-top: 32px;
    justify-content: flex-start;
}

.equipment-card.hidden {
    display: none !important;
}

/* Equipment Card Sizing - Only for Equipment Library Page */
#equipmentGrid .equipment-card {
    flex: 0 0 320px;
    width: 320px;
    min-width: 320px;
    max-width: 320px;
    height: auto;
    min-height: 400px;
}

/* Equipment Image Variants */
.equipment-image.plumbing {
    background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%);
    color: #2563eb;
}

.equipment-image.security {
    background: linear-gradient(135deg, #e9d5ff 0%, #d8b4fe 100%);
    color: #7c3aed;
}

/* Equipment Badge */
.equipment-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

/* Equipment Model */
.equipment-model {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
}

/* Location Type */
.location-type {
    color: var(--brand-primary);
    font-size: 12px;
    font-weight: 500;
}

/* View Details Button */
.view-details-btn {
    background: var(--brand-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.view-details-btn:hover {
    background: var(--brand-primary-dark);
}

/* Clear Filters Button */
.clear-filters-btn {
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.clear-filters-btn:hover {
    background: var(--border-color);
    color: var(--text-subtle);
}

/* Mobile Responsive for Equipment Library */
@media (max-width: 768px) {
    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: none;
    }

    .equipment-grid {
        justify-content: center;
    }

    .equipment-card {
        flex: 0 0 100%;
        width: 100%;
        min-width: 100%;
        max-width: 100%;
    }

    .stats-bar {
        flex-direction: column;
        gap: 16px;
    }
}

/* My Learning Page Styles */

/* Progress Overview */
.progress-overview {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: 0 1px 3px var(--shadow-color), 0 1px 2px var(--shadow-color-light);
    border: 1px solid var(--border-color);
}

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

.overview-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.overall-progress {
    display: flex;
    align-items: center;
    gap: 16px;
}

.progress-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: conic-gradient(var(--color-success) 0deg 252deg, var(--border-color) 252deg 360deg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.progress-circle::before {
    content: '';
    width: 60px;
    height: 60px;
    background: var(--bg-card);
    border-radius: 50%;
    position: absolute;
}

.progress-text {
    position: relative;
    z-index: 1;
    font-weight: 700;
    color: var(--color-success);
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.stat-card {
    background: var(--bg-page);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

/* Learning Paths */
.learning-paths {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-bottom: 32px;
}

.path-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 1px 3px var(--shadow-color), 0 1px 2px var(--shadow-color-light);
    border: 1px solid var(--border-color);
}

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

.path-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    margin-bottom: 16px;
}

.path-icon.hvac {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.path-icon.electrical {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
}

.path-icon.fire {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.path-icon.automation {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.path-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.path-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.path-progress {
    margin-bottom: 20px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
}

.modules-list {
    list-style: none;
}

.module-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--bg-muted);
}

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

.module-status {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.module-status.completed {
    background: var(--color-success);
    color: white;
}

.module-status.current {
    background: var(--color-success);
    color: white;
}

.module-status.locked {
    background: var(--border-color);
    color: var(--text-muted);
}

.module-info {
    flex: 1;
}

.module-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

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

.module-action {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.module-action.continue {
    background: var(--color-success);
    color: white;
}

.module-action.start {
    background: var(--color-success);
    color: white;
}

.module-action.completed {
    background: var(--bg-muted);
    color: var(--text-secondary);
}

.module-action.locked {
    background: var(--bg-muted);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Certifications */
.certifications {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 1px 3px var(--shadow-color), 0 1px 2px var(--shadow-color-light);
    border: 1px solid var(--border-color);
}

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

.cert-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

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

.cert-card {
    background: var(--bg-page);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.cert-badge {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.cert-badge.earned {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.cert-badge.progress {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.cert-badge.locked {
    background: var(--border-color);
    color: var(--text-muted);
}

.cert-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.cert-status {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.cert-status.earned {
    background: var(--bg-success);
    color: var(--text-success);
}

.cert-status.progress {
    background: #ddd6fe;
    color: #5b21b6;
}

.cert-status.locked {
    background: var(--bg-muted);
    color: var(--text-secondary);
}

/* Mobile Responsive for Learning Page */
@media (max-width: 768px) {
    .learning-paths {
        grid-template-columns: 1fr;
    }

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

    .overview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}


/* Video Player Page */
.video-player-page {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
    max-width: 1700px;
    margin: 0 auto;
}

.video-player-main {
    min-width: 0;
}

.video-player-wrapper {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
    aspect-ratio: 16/9;
}

.video-player-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.video-info-section {
    background: var(--bg-card);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.video-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.video-stats {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-muted);
    border: none;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--border-color);
}

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

.action-btn.liked:hover {
    background: var(--brand-primary-dark);
}

.video-details-card {
    background: var(--bg-page);
    padding: 16px;
    border-radius: 8px;
}

.video-metadata {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.metadata-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.metadata-row strong {
    min-width: 140px;
    color: var(--text-secondary);
    font-weight: 500;
}

.inline-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    display: inline-block;
    padding: 4px 10px;
    background: var(--brand-primary);
    color: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.procedure-item {
    padding: 12px;
    background: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    gap: 12px;
}

.procedure-item:hover {
    background: var(--bg-muted);
    transform: translateX(4px);
}

.procedure-time {
    font-weight: 600;
    color: var(--brand-primary);
    min-width: 60px;
}

.procedure-content {
    flex: 1;
}

.procedure-category {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 4px;
}

.procedure-description {
    color: var(--text-primary);
    font-size: 14px;
}

/* Comments Section */
.comments-section {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 12px;
}

.comments-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-comment {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.user-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.comment-input-wrapper {
    flex: 1;
}

.comment-input-wrapper textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    transition: all 0.2s;
}

.comment-input-wrapper textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
}

.comment-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.comment {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-info);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.comment-author {
    font-weight: 600;
    font-size: 14px;
}

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

.comment-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 8px;
}

.comment-delete {
    background: none;
    border: none;
    color: var(--color-error);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.comment-delete:hover {
    background: #fee2e2;
}

/* Video Player Sidebar */
.video-player-sidebar {
    background: var(--bg-card);
    padding: 16px;
    border-radius: 12px;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.related-video-card {
    display: flex;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.related-video-card:hover {
    background: var(--bg-page);
}

.related-video-thumbnail {
    width: 168px;
    height: 94px;
    background: var(--bg-muted);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.related-video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-video-thumbnail i {
    font-size: 24px;
    color: var(--text-muted);
}

.related-video-duration {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

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

.related-video-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.related-video-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.related-video-tag {
    display: inline-block;
    padding: 2px 6px;
    background: var(--bg-muted);
    border-radius: 4px;
    font-size: 11px;
}

/* Responsive */
@media (max-width: 1200px) {
    .video-player-page {
        grid-template-columns: 1fr;
    }
    
    .video-player-sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    .video-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .related-video-thumbnail {
        width: 120px;
        height: 68px;
    }
}


/* Skeleton Loaders for faster perceived performance */
.video-skeleton {
    width: 100%;
    height: 100%;
    background: var(--border-color);
    position: relative;
    overflow: hidden;
}

.skeleton-pulse {
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--border-color) 0%,
        var(--bg-muted) 50%,
        var(--border-color) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

.info-skeleton {
    padding: 16px 0;
}

.skeleton-title {
    height: 28px;
    background: var(--border-color);
    border-radius: 4px;
    margin-bottom: 12px;
    width: 70%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    background: linear-gradient(90deg, var(--border-color) 0%, var(--bg-muted) 50%, var(--border-color) 100%);
    background-size: 200% 100%;
}

.skeleton-meta {
    height: 20px;
    background: var(--border-color);
    border-radius: 4px;
    width: 40%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    background: linear-gradient(90deg, var(--border-color) 0%, var(--bg-muted) 50%, var(--border-color) 100%);
    background-size: 200% 100%;
}

.skeleton-related {
    height: 94px;
    background: var(--border-color);
    border-radius: 8px;
    margin-bottom: 12px;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    background: linear-gradient(90deg, var(--border-color) 0%, var(--bg-muted) 50%, var(--border-color) 100%);
    background-size: 200% 100%;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}


/* Video Card Skeleton Loaders */
.video-card-skeleton {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow-color-medium);
    border: 1px solid var(--bg-muted);
}

.skeleton-thumbnail {
    width: 100%;
    height: 180px;
    background: linear-gradient(90deg, var(--border-color) 0%, var(--bg-muted) 50%, var(--border-color) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

.skeleton-info {
    padding: 16px;
}

.skeleton-title {
    height: 20px;
    background: linear-gradient(90deg, var(--border-color) 0%, var(--bg-muted) 50%, var(--border-color) 100%);
    background-size: 200% 100%;
    border-radius: 4px;
    margin-bottom: 12px;
    width: 80%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

.skeleton-meta {
    height: 16px;
    background: linear-gradient(90deg, var(--border-color) 0%, var(--bg-muted) 50%, var(--border-color) 100%);
    background-size: 200% 100%;
    border-radius: 4px;
    margin-bottom: 12px;
    width: 40%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

.skeleton-tags {
    height: 24px;
    background: linear-gradient(90deg, var(--border-color) 0%, var(--bg-muted) 50%, var(--border-color) 100%);
    background-size: 200% 100%;
    border-radius: 4px;
    width: 60%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* Facet Panel */
.facet-panel {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px var(--shadow-color);
    border: 1px solid var(--border-color);
}

.facet-section {
    margin-bottom: 16px;
}

.facet-section:last-child {
    margin-bottom: 0;
}

.facet-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.facet-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.facet-chip {
    display: inline-block;
    padding: 6px 12px;
    background: var(--bg-muted);
    color: var(--text-subtle);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.facet-chip:hover {
    background: var(--border-color);
    border-color: var(--border-light);
}

.facet-chip-active {
    background: var(--brand-primary);
    color: white;
    border-color: var(--brand-primary);
}

.facet-chip-active:hover {
    background: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
}

/* Videos Page - YouTube-style Sidebar Layout */
.videos-layout {
    display: flex;
    gap: 0;
    min-height: calc(100vh - 120px);
}

.videos-sidebar {
    width: 220px;
    min-width: 220px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    border-radius: 12px 0 0 12px;
    padding: 16px 0;
    position: sticky;
    top: 90px;
    align-self: flex-start;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.04);
}

.videos-sidebar::-webkit-scrollbar {
    width: 4px;
}

.videos-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

.videos-main {
    flex: 1;
    min-width: 0;
    padding-left: 24px;
}

.sidebar-section {
    margin-bottom: 20px;
}

.sidebar-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 0 16px 8px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-subtle);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.sidebar-nav-item:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.sidebar-nav-item.active {
    background: var(--bg-success-light);
    color: var(--brand-primary);
    border-left-color: var(--brand-primary);
    font-weight: 600;
}

.sidebar-nav-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-nav-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-count {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    flex-shrink: 0;
}

/* Responsive: collapse sidebar on small screens */
@media (max-width: 900px) {
    .videos-layout {
        flex-direction: column;
    }

    .videos-sidebar {
        width: 100%;
        min-width: 100%;
        position: static;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        border-radius: 12px 12px 0 0;
        padding: 12px 0;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
        padding: 0 12px;
    }

    .sidebar-nav-item {
        padding: 8px 12px;
        border-left: none;
        border-radius: 20px;
        font-size: 12px;
    }

    .sidebar-nav-item.active {
        border-left-color: transparent;
        background: var(--brand-primary);
        color: white;
    }

    .videos-main {
        padding-left: 0;
    }
}

.sidebar-loading {
    padding: 12px 16px;
}

.sidebar-loading-text {
    font-size: 12px;
    color: var(--text-muted);
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px var(--shadow-color);
    z-index: 50;
    max-height: 300px;
    overflow-y: auto;
}

.autocomplete-item {
    padding: 10px 16px 10px 44px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s;
}

.autocomplete-item:hover,
.autocomplete-item-active {
    background: var(--bg-muted);
}


/* ===== Polished Search Panel ===== */
.search-panel {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px var(--shadow-color-medium), 0 1px 2px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.search-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
}

.search-icon-left {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    z-index: 1;
    font-size: 14px;
    pointer-events: none;
}

.search-field {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-page);
    outline: none;
    transition: all 0.2s ease;
}

.search-field:focus {
    border-color: var(--brand-primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px var(--color-selection-bg);
}

.search-field::placeholder {
    color: var(--text-muted);
}

.filter-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 16px;
}

.filter-row:last-of-type {
    margin-bottom: 0;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-field-grow {
    flex: 1;
    min-width: 160px;
}

.filter-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-input {
    padding: 8px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-card);
    outline: none;
    transition: border-color 0.2s ease;
}

.filter-input:focus {
    border-color: var(--brand-primary);
}

.filter-select {
    padding: 8px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-card);
    outline: none;
    min-width: 140px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.filter-select:focus {
    border-color: var(--brand-primary);
}

.btn-outline {
    background: var(--bg-card);
    color: var(--text-subtle);
    border: 1.5px solid var(--border-color);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-outline:hover {
    background: var(--bg-muted);
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.btn-sm {
    padding: 8px 12px;
    font-size: 12px;
}

.active-filters {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.active-filters-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.filter-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--brand-primary);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.15s ease;
}

.filter-tag:hover {
    background: var(--brand-primary-dark);
}

.filter-tag-remove {
    cursor: pointer;
    opacity: 0.7;
    font-size: 10px;
    transition: opacity 0.15s ease;
}

.filter-tag-remove:hover {
    opacity: 1;
}

/* ===== Polished Video Cards ===== */
.video-thumbnail {
    position: relative;
}

.thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #4338ca;
    font-size: 48px;
}

.video-meta-row {
    display: flex;
    gap: 14px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.video-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.video-meta-item i {
    font-size: 11px;
}

.video-comment-preview {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--bg-muted);
    font-size: 12px;
    line-height: 1.5;
}

.comment-preview-label {
    color: var(--text-muted);
    margin-right: 4px;
}

.comment-preview-label i {
    margin-right: 2px;
}

.comment-preview-text {
    color: var(--text-subtle);
}

.video-tools-line {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.video-tools-line i {
    font-size: 11px;
    color: var(--text-muted);
}

.matched-procedure-link {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--bg-muted);
    font-size: 12px;
    font-weight: 500;
    color: #4338ca;
    text-decoration: none;
    transition: color 0.15s ease;
}

.matched-procedure-link:hover {
    color: #3730a3;
}

.matched-procedure-link i {
    font-size: 10px;
}

/* ===== Results Header ===== */
.results-header {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-success-light);
    border: 1px solid var(--bg-success-alt);
    border-radius: 10px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-success);
    display: flex;
    align-items: center;
    gap: 8px;
}

.results-header-icon {
    color: var(--color-success);
    font-size: 16px;
}

/* ===== Video Card Hover Polish ===== */
.video-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.video-card:hover .play-overlay {
    opacity: 1;
}

.play-overlay {
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* ===== Loading State Polish ===== */
.loading {
    animation: fadeIn 0.3s ease;
}

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

/* Date preset buttons wrapper */
.date-presets {
    display: flex;
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Mobile: larger search field on videos page */
@media (max-width: 900px) {
    .search-field {
        padding: 14px 16px 14px 44px;
        font-size: 16px;
    }

    .search-row {
        flex-wrap: wrap;
    }

    .search-input-wrapper {
        flex: 0 0 100%;
        width: 100%;
    }

    .search-row .btn {
        flex: 1 1 0;
    }

    .search-panel {
        padding: 16px;
    }

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

    .filter-field,
    .filter-field-grow {
        width: 100%;
    }

    .date-presets {
        flex-direction: row;
    }

    .date-presets .btn {
        width: auto;
        flex: 0 0 auto;
    }
}

/* Coming Soon — disabled buttons/links */
.coming-soon {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none;
    position: relative;
}

.coming-soon-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-warning);
    background: var(--bg-warning);
    padding: 2px 6px;
    border-radius: 8px;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
