/* ============================================================
   Video Library - Educational Video Tutorials Panel
   Purple/blue styling using --color-primary (#667eea)
   ============================================================ */

/* ---- Video Library Panel ---- */
.video-library-panel {
    position: fixed;
    top: 0;
    right: -520px;
    width: 500px;
    height: 100vh;
    background: var(--color-bg-primary, #1e293b);
    border-left: 1px solid var(--color-border, #475569);
    box-shadow: -4px 0 24px rgba(0,0,0,0.4);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    overflow: hidden;
}

.video-library-panel.panel-open {
    right: 0;
}

.video-library-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(102, 126, 234, 0.12);
    border-bottom: 1px solid rgba(102, 126, 234, 0.25);
    flex-shrink: 0;
}

.video-library-panel-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-primary, #667eea);
}

.video-library-close {
    background: none;
    border: none;
    color: var(--color-text-muted, #94a3b8);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}

.video-library-close:hover {
    color: var(--color-primary, #667eea);
}

.video-library-panel-body {
    flex: 1 1 0%; /* Explicit flex-basis of 0 */
    min-height: 0; /* Allow flex child to shrink below content size */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 20px;
    display: block; /* Changed from flex to block */
}

/* ---- Video Series Sections ---- */
.video-series {
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(102, 126, 234, 0.05);
    margin-bottom: 20px;
}

.video-series:last-child {
    margin-bottom: 0;
}

.video-series-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    background: rgba(102, 126, 234, 0.08);
    transition: background 0.15s;
    user-select: none;
}

.video-series-header:hover {
    background: rgba(102, 126, 234, 0.15);
}

.video-series-header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.video-series-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text-primary, #f1f5f9);
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-series-count {
    font-size: 0.7rem;
    background: rgba(102, 126, 234, 0.3);
    color: var(--color-primary-light, #c7d2fe);
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
}

.video-series-description {
    font-size: 0.75rem;
    color: var(--color-text-muted, #94a3b8);
    line-height: 1.4;
}

.video-series-chevron {
    color: var(--color-text-muted, #94a3b8);
    font-size: 1.2rem;
    transition: transform 0.2s;
}

.video-series.expanded .video-series-chevron {
    transform: rotate(180deg);
}

.video-series-videos {
    display: none;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid rgba(102, 126, 234, 0.15);
}

.video-series.expanded .video-series-videos {
    display: flex;
}

/* ---- Video Cards ---- */
.video-card {
    background: var(--color-bg-primary, #1e293b);
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
}

.video-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.video-card.coming-soon {
    opacity: 0.6;
    cursor: not-allowed;
}

.video-card.coming-soon:hover {
    transform: none;
    box-shadow: none;
}

.video-thumbnail-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background: #000;
}

.video-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(102, 126, 234, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s;
    pointer-events: none;
}

.video-card:hover .video-play-overlay {
    background: rgba(102, 126, 234, 1);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-play-icon {
    width: 0;
    height: 0;
    border-left: 18px solid #fff;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    margin-left: 4px;
}

.video-coming-soon-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(251, 191, 36, 0.95);
    color: #1e293b;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.video-card-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.video-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.video-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-primary, #f1f5f9);
    line-height: 1.3;
    flex: 1;
}

.video-card-duration {
    font-size: 0.7rem;
    color: var(--color-text-muted, #94a3b8);
    background: rgba(102, 126, 234, 0.15);
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.video-card-description {
    font-size: 0.75rem;
    color: var(--color-text-muted, #94a3b8);
    line-height: 1.4;
}

/* ---- Video Player (Inline) ---- */
.video-player-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background: #000;
}

.video-player-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ---- Help Modal Integration ---- */
.help-video-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}

.help-video-section h3 {
    margin: 0 0 8px;
    color: var(--color-primary);
}

.help-video-section p {
    margin: 0 0 16px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.help-video-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.help-video-btn:hover {
    background: var(--color-primary-hover, #5568d3);
}

.help-video-btn svg {
    flex-shrink: 0;
}

/* ---- First-Time User Modal ---- */
.first-time-modal {
    background: rgba(0, 0, 0, 0.85);
}

.first-time-modal-content {
    max-width: 800px;
    padding: 32px;
    background: var(--color-bg-primary, #1e293b);
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.first-time-modal-content h2 {
    margin: 0 0 12px;
    font-size: 1.5rem;
    color: var(--color-text-primary, #f1f5f9);
}

.first-time-modal-content p {
    margin: 0 0 20px;
    color: var(--color-text-muted, #94a3b8);
    line-height: 1.5;
}

.first-time-video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 20px;
    background: #000;
}

.first-time-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.first-time-modal-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.first-time-dismiss-btn {
    flex: 1;
    padding: 12px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.first-time-dismiss-btn:hover {
    background: var(--color-primary-hover, #5568d3);
}

.first-time-dont-show-btn {
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--color-text-muted, #94a3b8);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.first-time-dont-show-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.first-time-hint {
    font-size: 0.85rem;
    color: var(--color-text-muted, #94a3b8);
    text-align: center;
    margin: 0;
}

.first-time-video-link {
    color: var(--color-primary, #667eea);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}

.first-time-video-link:hover {
    color: var(--color-primary-hover, #5568d3);
    text-decoration: underline;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .video-library-panel {
        width: 100vw;
        right: -100vw;
    }

    .video-library-panel-body {
        -webkit-overflow-scrolling: touch;
    }

    .video-library-close {
        min-width: 44px;
        min-height: 44px;
    }

    .video-series-header {
        padding: 14px;
    }

    .video-card-content {
        padding: 14px;
    }

    .first-time-modal-content {
        width: 95vw;
        padding: 20px;
    }

    .first-time-modal-actions {
        flex-direction: column;
    }

    .first-time-dismiss-btn,
    .first-time-dont-show-btn {
        width: 100%;
        min-height: 48px;
    }
}
