/**
 * EZsalt Design System - Video Tutorial Component
 * Material Design 3 Dialog for Loom video tutorials
 *
 * Features:
 * - Single video: Direct playback in dialog
 * - Multiple videos: List view with thumbnails
 * - Responsive: Full-screen on mobile
 */

/* ====================================================================
   VIDEO TUTORIAL FAB (Floating Action Button - Bottom Left)
   ==================================================================== */

/* Extended FAB with icon and text */
.ezs-video-fab {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 56px;
    padding: 0 20px;
    border: none;
    border-radius: 16px;
    background: var(--ezs-primary-500, #1998d5);
    color: #fff;
    cursor: pointer;
    box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.15),
                0px 1px 3px 0px rgba(0, 0, 0, 0.3);
    transition: background-color 200ms cubic-bezier(0.2, 0, 0, 1),
                box-shadow 200ms cubic-bezier(0.2, 0, 0, 1),
                transform 200ms cubic-bezier(0.2, 0, 0, 1);
}

.ezs-video-fab:hover {
    background: var(--ezs-primary-600, #1785bd);
    box-shadow: 0px 6px 10px 4px rgba(0, 0, 0, 0.15),
                0px 2px 3px 0px rgba(0, 0, 0, 0.3);
    transform: scale(1.02);
    cursor: grab;
}

.ezs-video-fab:active {
    background: var(--ezs-primary-700, #1576b5);
    transform: scale(0.98);
}

/* Dragging state */
.ezs-video-fab-dragging {
    cursor: grabbing !important;
    transform: scale(1.05);
    box-shadow: 0px 8px 16px 6px rgba(0, 0, 0, 0.2),
                0px 4px 6px 0px rgba(0, 0, 0, 0.3);
    transition: none; /* Disable transitions while dragging for smooth movement */
}

.ezs-video-fab-dragging:active {
    transform: scale(1.05);
}

.ezs-video-fab .material-icons {
    font-size: 24px;
    color: #fff;
}

.ezs-video-fab-label {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    letter-spacing: 0.1px;
}

/* Mobile: Smaller FAB, icon only */
@media (max-width: 640px) {
    .ezs-video-fab {
        bottom: 16px;
        left: 16px;
        width: 48px;
        height: 48px;
        padding: 0;
        border-radius: 12px;
    }

    .ezs-video-fab .material-icons {
        font-size: 24px;
    }

    /* Hide label on mobile - icon only */
    .ezs-video-fab-label {
        display: none;
    }
}

/* ====================================================================
   DIALOG BACKDROP (Shared)
   ==================================================================== */

.ezs-video-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 300ms cubic-bezier(0.2, 0, 0, 1),
                visibility 300ms;
}

.ezs-video-backdrop.open {
    opacity: 1;
    visibility: visible;
}

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

.ezs-video-dialog {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0px 8px 12px 6px rgba(0, 0, 0, 0.15),
                0px 4px 4px 0px rgba(0, 0, 0, 0.3);
    transform: scale(0.95);
    opacity: 0;
    transition: transform 300ms cubic-bezier(0.2, 0, 0, 1),
                opacity 300ms cubic-bezier(0.2, 0, 0, 1);
}

.ezs-video-backdrop.open .ezs-video-dialog {
    transform: scale(1);
    opacity: 1;
}

/* Dialog Header */
.ezs-video-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 16px 24px;
    border-bottom: 1px solid #E0E0E0;
}

.ezs-video-dialog-title {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    color: #212121;
    line-height: 24px;
}

.ezs-video-dialog-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    transition: background-color 200ms cubic-bezier(0.2, 0, 0, 1);
}

.ezs-video-dialog-close:hover {
    background-color: rgba(0, 0, 0, 0.08);
}

.ezs-video-dialog-close .material-icons {
    font-size: 24px;
    color: #757575;
}

/* Video Container - 16:9 Aspect Ratio */
.ezs-video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
}

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

/* ====================================================================
   VIDEO LIST DIALOG
   ==================================================================== */

.ezs-video-list-dialog {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0px 8px 12px 6px rgba(0, 0, 0, 0.15),
                0px 4px 4px 0px rgba(0, 0, 0, 0.3);
    transform: scale(0.95);
    opacity: 0;
    transition: transform 300ms cubic-bezier(0.2, 0, 0, 1),
                opacity 300ms cubic-bezier(0.2, 0, 0, 1);
}

.ezs-video-backdrop.open .ezs-video-list-dialog {
    transform: scale(1);
    opacity: 1;
}

/* List Header */
.ezs-video-list-header {
    display: flex;
    align-items: center;
    padding: 16px 16px 16px 24px;
    border-bottom: 1px solid #E0E0E0;
    flex-shrink: 0;
}

.ezs-video-list-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    margin-right: 8px;
    margin-left: -8px;
    transition: background-color 200ms cubic-bezier(0.2, 0, 0, 1);
}

.ezs-video-list-back:hover {
    background-color: rgba(0, 0, 0, 0.08);
}

.ezs-video-list-back .material-icons {
    font-size: 24px;
    color: #757575;
}

.ezs-video-list-title {
    flex: 1;
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    color: #212121;
    line-height: 24px;
}

.ezs-video-list-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    transition: background-color 200ms cubic-bezier(0.2, 0, 0, 1);
}

.ezs-video-list-close:hover {
    background-color: rgba(0, 0, 0, 0.08);
}

.ezs-video-list-close .material-icons {
    font-size: 24px;
    color: #757575;
}

/* Video List Content */
.ezs-video-list-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* Video List Item */
.ezs-video-list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    cursor: pointer;
    transition: background-color 200ms cubic-bezier(0.2, 0, 0, 1);
    text-decoration: none;
    color: inherit;
}

.ezs-video-list-item:hover {
    background-color: #F5F5F5;
}

.ezs-video-list-item:active {
    background-color: #EEEEEE;
}

/* Thumbnail Container - EZsalt logo (16:9 ratio) */
.ezs-video-thumbnail {
    position: relative;
    width: 120px;
    min-width: 120px;
    height: 68px;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(135deg, #1998d5 0%, #1576b5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ezs-video-thumbnail-logo {
    width: 60px;
    height: auto;
    object-fit: contain;
}

/* Play button on the right */
.ezs-video-play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    color: var(--ezs-primary-500, #1998d5);
    transition: transform 200ms, color 200ms;
}

.ezs-video-play-btn .material-icons {
    font-size: 40px;
}

.ezs-video-list-item:hover .ezs-video-play-btn {
    color: var(--ezs-primary-600, #1785bd);
    transform: scale(1.1);
}

/* Video Info */
.ezs-video-info {
    flex: 1;
    min-width: 0;
}

.ezs-video-info-title {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 500;
    color: #212121;
    line-height: 20px;
}

.ezs-video-info-description {
    margin: 0;
    font-size: 12px;
    color: #757575;
    line-height: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ====================================================================
   RESPONSIVE - MOBILE
   ==================================================================== */

@media (max-width: 640px) {
    .ezs-video-dialog {
        width: 100%;
        max-width: none;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }

    .ezs-video-container {
        height: calc(100vh - 57px); /* Full height minus header */
        padding-bottom: 0;
    }

    .ezs-video-list-dialog {
        width: 100%;
        max-width: none;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }

    .ezs-video-thumbnail {
        width: 100px;
        min-width: 100px;
        height: 56px;
        border-radius: 6px;
    }

    .ezs-video-thumbnail-logo {
        width: 50px;
    }

    .ezs-video-play-btn {
        width: 40px;
        height: 40px;
    }

    .ezs-video-play-btn .material-icons {
        font-size: 32px;
    }

    .ezs-video-list-item {
        padding: 12px 16px;
        gap: 12px;
    }

    .ezs-video-list-header {
        padding: 16px;
    }

    .ezs-video-dialog-header {
        padding: 16px;
    }
}

/* ====================================================================
   ANIMATIONS
   ==================================================================== */

@keyframes ezs-video-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes ezs-video-scale-in {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}
