/**
 * video.css — Video View (Final Delivery)
 * Layout: card (left) + panel (right: buttons + accordion tabs)
 * Player: Plyr 3.7.8 with white theme (matching freshmilk.studio)
 * Architecture: ZERO inline CSS. SSR. External only.
 */

/* ═══ LAYOUT ═══ */
.vid-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3.5rem;
    width: 100%;
    height: 100%;
    flex: 1;
    align-self: stretch;
    padding: 58px 3rem 8px;
}

/* ═══ LEFT: VIDEO CARD ═══ */
.vid-card-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.vid-card-col .vcard {
    cursor: default;
}

/* Card sizing — formula: calc((100vh - 160px)) for height budget */
.vid-card-col .vcard.card-P .thumb {
    width: calc((100vh - 160px) * 9 / 16);
    height: calc(100vh - 160px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
}

.vid-card-col .vcard.card-L .thumb {
    width: calc((100vh - 160px) * 16 / 9);
    height: calc(100vh - 160px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
}

/* Override welcome.css: allow Plyr controls to show */
.vid-card-col .vcard .thumb {
    overflow: visible;
}

.vid-card-col .vcard .thumb video {
    pointer-events: auto;
}

/* ═══ PLYR PLAYER (matching freshmilk.studio white theme) ═══ */
:root {
    --plyr-color-main: #fff;
    --plyr-video-control-color: #fff;
    --plyr-video-control-background-hover: rgba(255, 255, 255, 0.1);
}

/* Square corners + fill thumb — NO overflow:hidden (clips controls) */
.vid-card-col .plyr--video {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border-radius: 0;
}

.plyr__control--overlaid {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.plyr__control--overlaid:hover {
    background: #fff;
    color: #000;
}

/* ═══ VIDEO VIEW CARD STATE OVERRIDES ═══ */
/* state-done: enable Plyr controls interaction */
.vid-card-col .vcard.state-done .thumb {
    overflow: visible;
}

.vid-card-col .vcard.state-done .thumb video {
    pointer-events: auto;
}

.vid-card-col .vcard.state-done .tags {
    pointer-events: none;
    z-index: 7;
}

.vid-card-col .vcard.state-done .play-ov {
    display: none;
}

/* Preview card Plyr (campaigns scenes) */
.preview-option .plyr--video {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    overflow: hidden;
    z-index: 6;
}

.preview-option .vcard.state-done .play-ov {
    display: none;
}


/* ═══ RIGHT: PANEL ═══ */
.vid-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 280px;
    flex-shrink: 0;
    align-self: center;
}

/* ═══ BUTTONS (always visible) ═══ */
.vid-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vid-action-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 48px;
    padding: 0 1.5rem;
    border-radius: 14px;
    border: none;
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.vid-action-btn span,
.vid-action-btn svg {
    position: relative;
    z-index: 2;
}

.vid-action-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Descargar — pastel gradient */
.vid-action-btn.vid-download {
    color: #000;
    background: #fff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
}
.vid-action-btn.vid-download::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 10%, rgba(130, 190, 255, 0.7) 40%, rgba(255, 150, 190, 0.7) 60%, transparent 90%);
    background-size: 200% 200%;
    animation: previewPastelFlow 4s ease-in-out infinite;
    pointer-events: none;
}
.vid-action-btn.vid-download:hover {
    box-shadow: 0 4px 24px rgba(130, 190, 255, 0.3), 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Guardar Modelo — silver gradient */
.vid-action-btn.vid-save-model {
    height: 48px;
    padding: 0 1.5rem;
    border-radius: 14px;
    font-size: 10px;
    font-weight: 900;
    background: linear-gradient(135deg, #FFF 0%, #A0A0A0 100%);
    color: #000;
    box-shadow: none;
}
.vid-action-btn.vid-save-model:hover {
    transform: scale(1.03);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
}
.vid-action-btn.vid-save-model svg.saved {
    fill: #000;
}

/* Publicar en Wall — silver gradient */
.vid-action-btn.vid-publish {
    height: 48px;
    padding: 0 1.5rem;
    border-radius: 14px;
    font-size: 10px;
    font-weight: 900;
    background: linear-gradient(135deg, #FFF 0%, #A0A0A0 100%);
    color: #000;
    box-shadow: none;
}
.vid-action-btn.vid-publish:hover {
    transform: scale(1.03);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
}

/* Disabled state */
.vid-action-btn:disabled {
    opacity: 0.3;
    pointer-events: none;
}


/* ═══ ACCORDION TABS ═══ */
.vid-tab {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.vid-tab:hover {
    border-color: rgba(255, 255, 255, 0.22);
}

.vid-tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.55);
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    transition: color 0.2s;
}

.vid-tab-header:hover {
    color: rgba(255, 255, 255, 0.85);
}

.vid-tab-arrow {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.vid-tab.open .vid-tab-arrow {
    transform: rotate(180deg);
}

/* Tab body — hidden by default, max-height capped to prevent overflow */
.vid-tab-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 16px;
}

.vid-tab.open .vid-tab-body {
    max-height: 260px;
    padding: 0 16px 14px;
    overflow-y: auto;
}


/* ═══ MARKETING TAGS (inside accordion) ═══ */
.vid-tab-body .vid-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.35rem 0.6rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(192,192,192,0.15);
    border-radius: 8px;
    transition: border-color 0.2s;
    margin-bottom: 6px;
}

.vid-tab-body .vid-tag:last-child {
    margin-bottom: 0;
}

.vid-tab-body .vid-tag:hover {
    border-color: rgba(192,192,192,0.35);
}

.vid-tag-label {
    font-family: 'Inter', sans-serif;
    font-size: 7px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(192,192,192,0.4);
    flex-shrink: 0;
}

.vid-tag-text {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 500;
    color: rgba(255,255,255,0.65);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vid-tag-copy {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: rgba(192,192,192,0.45);
    transition: color 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.vid-tag-copy:hover {
    color: #fff;
    transform: scale(1.1);
}

.vid-tag-copy.copied {
    color: #6fcf97;
}

.vid-tag-copy svg {
    width: 14px;
    height: 14px;
}


/* ═══ VIDEO INFO (inside accordion) ═══ */
.vid-info-card {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.vid-info-thumb {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
}

.vid-info-thumb[src=""] {
    display: none;
}

.vid-info-name {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vid-info-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.vid-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid rgba(192,192,192,0.06);
}

.vid-info-row:last-child {
    border-bottom: none;
}

.vid-info-label {
    font-family: 'Inter', sans-serif;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(192,192,192,0.45);
    flex: 0 0 80px;
}

.vid-info-val {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 500;
    color: rgba(255,255,255,0.65);
    text-align: right;
    flex: 1;
}


/* ═══ FORMAT TOGGLE (dev only) ═══ */
.vid-format-toggle {
    position: absolute;
    bottom: 8px;
    left: 8px;
    z-index: 10;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(192,192,192,0.2);
    color: rgba(255,255,255,0.4);
    font-family: 'Inter', sans-serif;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.vid-format-toggle:hover {
    color: #fff;
    border-color: rgba(192,192,192,0.5);
}


/* ═══ SAVE MODEL MODAL ═══ */
.vid-save-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
}
.vid-save-modal.active { display: flex; }

.vid-save-content {
    position: relative;
    background: rgba(10,10,10,0.95);
    border: 1px solid rgba(192,192,192,0.4);
    border-radius: 1.25rem;
    padding: 2rem 1.75rem;
    max-width: 420px; width: 90%;
}

.vid-save-close {
    position: absolute;
    top: 1rem; right: 1rem;
    background: none; border: none;
    color: rgba(255,255,255,0.5);
    font-size: 18px; cursor: pointer;
    transition: color 0.2s;
}
.vid-save-close:hover { color: #fff; }

.vid-save-content h3 {
    font-family: 'Inter', sans-serif;
    font-size: 12px; font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #fff;
    margin: 0 0 1rem 0;
}

.vid-save-input {
    width: 100%;
    padding: 0.7rem 1rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(192,192,192,0.25);
    border-radius: 10px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 11px; font-weight: 500;
    letter-spacing: 0.1em;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    margin-bottom: 0.75rem;
}
.vid-save-input:focus { border-color: rgba(192,192,192,0.5); }
.vid-save-input::placeholder { color: rgba(255,255,255,0.3); }

.vid-save-existing { margin-bottom: 1rem; }

.vid-save-existing-title {
    font-family: 'Inter', sans-serif;
    font-size: 7px; font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(192,192,192,0.4);
    margin: 0 0 0.4rem 0;
}

.vid-save-existing-list {
    display: flex; flex-wrap: wrap; gap: 0.35rem;
}

.vid-save-existing-item {
    padding: 3px 8px; border-radius: 6px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(192,192,192,0.12);
    font-family: 'Inter', sans-serif;
    font-size: 8px; font-weight: 500;
    color: rgba(255,255,255,0.4);
    letter-spacing: 0.1em;
}

.vid-save-alert {
    display: none;
    padding: 0.5rem 0.75rem; border-radius: 8px;
    background: rgba(255, 180, 50, 0.1);
    border: 1px solid rgba(255, 180, 50, 0.25);
    font-family: 'Inter', sans-serif;
    font-size: 9px; font-weight: 600;
    color: rgba(255, 180, 50, 0.8);
    margin-bottom: 0.75rem;
}
.vid-save-alert.active { display: block; }

.vid-save-confirm {
    width: 100%; height: 48px;
    border-radius: 14px;
    font-size: 10px; letter-spacing: 0.2em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #FFF 0%, #A0A0A0 100%);
    color: #000; font-weight: 900;
    border: none; cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.3; pointer-events: none;
}
.vid-save-confirm.enabled { opacity: 1; pointer-events: auto; }
.vid-save-confirm.enabled:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 24px rgba(255,255,255,0.15);
}


/* ═══ TABLET (768px) ═══ */
@media (max-width: 768px) {
    .vid-layout {
        gap: 2rem;
        padding: 58px 1.5rem 8px;
    }
    .vid-card-col .vcard.card-P .thumb {
        width: calc((100vh - 180px) * 9 / 16);
        height: calc(100vh - 180px);
    }
    .vid-card-col .vcard.card-L .thumb {
        width: calc((100vh - 180px) * 16 / 9);
        height: calc(100vh - 180px);
    }
    .vid-panel {
        width: 220px;
    }
}

/* ═══ MOBILE (480px) ═══ */
@media (max-width: 480px) {
    .vid-layout {
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
        padding: 58px 6px 6px;
    }

    /* Card: library-sized — 16:9 full width, 9:16 centered smaller */
    .vid-card-col .vcard.card-P .thumb {
        width: calc((100vw - 12px) / 2);
        height: auto;
    }
    .vid-card-col .vcard.card-L .thumb {
        width: calc(100vw - 12px);
        height: auto;
    }

    /* Panel: full width */
    .vid-panel {
        width: 100%;
        gap: 8px;
    }

    /* Buttons: horizontal row, full height */
    .vid-buttons {
        flex-direction: row;
        gap: 6px;
    }

    .vid-buttons .vid-action-btn {
        flex: 1;
        height: 44px;
        font-size: 7px;
        padding: 0 0.4rem;
        letter-spacing: 0.08em;
        border-radius: 10px;
    }

    .vid-buttons .vid-action-btn.vid-save-model,
    .vid-buttons .vid-action-btn.vid-publish {
        height: 44px;
        padding: 0 0.4rem;
        font-size: 7px;
        border-radius: 10px;
    }

    /* Tabs on mobile: popover floating above */
    .vid-tab {
        position: relative;
    }

    .vid-tab-body {
        position: absolute;
        bottom: 100%;
        left: 0;
        right: 0;
        z-index: 100;
        background: rgba(10, 10, 10, 0.96);
        border: 1px solid rgba(255, 255, 255, 0.18);
        border-radius: 12px;
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
        max-height: 0;
        overflow: hidden;
        padding: 0 14px;
    }

    .vid-tab.open .vid-tab-body {
        max-height: 280px;
        padding: 12px 14px;
        overflow-y: auto;
    }
}
