/* Floating Video Widget — Frontend */
#fvw-widget {
    position: fixed;
    z-index: 99999;
    bottom: 24px;
    left: 24px;
    width: 320px;
    background: #1a1a2e;
    border-radius: 18px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.45);
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#fvw-widget.fvw-position-right {
    left: auto;
    right: 24px;
}
#fvw-widget.fvw-hidden {
    transform: translateY(120px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s ease, opacity 0.35s ease;
}
#fvw-widget.fvw-minimized {
    width: 220px;
}

/* Header bar */
#fvw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(135deg, #9333EA, #4F46E5);
    cursor: move;
    user-select: none;
}
#fvw-title {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}
#fvw-controls {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.fvw-btn {
    width: 26px; height: 26px;
    border-radius: 7px;
    background: rgba(255,255,255,0.18);
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
    line-height: 1;
    padding: 0;
}
.fvw-btn:hover { background: rgba(255,255,255,0.32); }

/* Video container */
#fvw-video-wrap {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background: #000;
    overflow: hidden;
    transition: max-height 0.35s ease, padding-top 0.35s ease;
}
#fvw-widget.fvw-minimized #fvw-video-wrap {
    padding-top: 0;
    max-height: 0;
}
#fvw-video-wrap iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
    display: block;
}

/* Thumbnail / play overlay (shown before iframe loads) */
#fvw-thumb {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
#fvw-thumb .fvw-play-btn {
    width: 54px; height: 54px;
    background: rgba(147,51,234,0.9);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s, background 0.2s;
}
#fvw-thumb:hover .fvw-play-btn {
    transform: scale(1.1);
    background: rgba(147,51,234,1);
}
#fvw-thumb .fvw-play-btn svg {
    width: 22px; height: 22px;
    fill: #fff;
    margin-left: 3px;
}
#fvw-thumb.fvw-hidden-thumb { display: none; }

/* Footer */
#fvw-footer {
    padding: 8px 14px;
    background: #12122a;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
#fvw-yt-link {
    font-size: 11px;
    color: #a78bfa;
    text-decoration: none;
    display: flex; align-items: center; gap: 4px;
}
#fvw-yt-link:hover { color: #c4b5fd; }
#fvw-yt-link svg { width: 13px; height: 13px; fill: currentColor; }
#fvw-mute-btn {
    font-size: 16px;
    background: none;
    border: none;
    cursor: pointer;
    color: #a78bfa;
    padding: 0;
    line-height: 1;
}

/* Entry animation */
@keyframes fvw-slidein {
    from { transform: translateY(80px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
#fvw-widget.fvw-visible {
    animation: fvw-slidein 0.5s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    #fvw-widget {
        width: calc(100vw - 24px);
        left: 12px;
        bottom: 12px;
        border-radius: 14px;
    }
    #fvw-widget.fvw-position-right {
        right: 12px;
        left: 12px;
    }
    #fvw-widget.fvw-minimized {
        width: 180px;
    }
}

@media (max-width: 360px) {
    #fvw-widget {
        width: calc(100vw - 16px);
        left: 8px;
        bottom: 8px;
    }
}

/* ── Popup Overlay ── */
#fvw-popup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
#fvw-popup.fvw-popup-open {
    display: flex;
    animation: fvw-fadein 0.3s ease forwards;
}
@keyframes fvw-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#fvw-popup-inner {
    position: relative;
    width: 90vw;
    max-width: 900px;
    background: #0f0c29;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,0.7);
    animation: fvw-popup-scale 0.35s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
@keyframes fvw-popup-scale {
    from { transform: scale(0.85); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

#fvw-popup-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 10;
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
}
#fvw-popup-close:hover { background: rgba(255,255,255,0.3); }

#fvw-popup-video {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
}
#fvw-popup-video iframe {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    border: none;
}

/* Expand button in widget header */
#fvw-expand-btn { font-size: 13px; }

/* Mobile popup adjustments */
@media (max-width: 480px) {
    #fvw-popup-inner {
        width: 100vw;
        border-radius: 16px 16px 0 0;
        position: absolute;
        bottom: 0;
    }
    #fvw-popup {
        align-items: flex-end;
    }
}
