/* ============================================================
   Select Video Popup
   ============================================================ */

#selectVideoPopup {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    padding: clamp(12px, 3vw, 28px);
    box-sizing: border-box;
    user-select: none;
}

/* ── Main container ── */
.selectVideoPopup_selectionContainer {
    aspect-ratio: 16 / 9;
    width: 80%;
    background: var(--color-primary);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--color-accent);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04),
        0 24px 64px rgba(0, 0, 0, 0.5),
        0 4px 16px rgba(112, 63, 161, 0.12);
    display: grid;
    grid-template-columns: 36% 1fr;
    position: relative;
    animation: svp-enter 280ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes svp-enter {
    from { opacity: 0; transform: scale(0.93) translateY(18px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

/* ── Close button ── */
.closePopupBtn {
    all: unset;
    cursor: pointer;
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 10;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(128, 128, 128, 0.18);
    border: 1px solid rgba(128, 128, 128, 0.28);
    color: var(--color-text);
    font-size: 16px;
    line-height: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    opacity: 0.65;
    transition:
        opacity var(--ease-fast),
        transform var(--ease-fast),
        background var(--ease-fast);
}

.closePopupBtn:hover {
    opacity: 1;
    transform: scale(1.12);
    background: rgba(128, 128, 128, 0.32);
}

/* ============================================================
   Left — Branding / Visual Panel
   ============================================================ */

.selectionContainer_VideoContainer {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 26px 22px;
    box-sizing: border-box;
    color: #fff;
    text-align: left;
}

/* Cinematic gradient overlay */
.selectionContainer_VideoContainer::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        160deg,
        rgba(0, 0, 0, 0.05) 0%,
        rgba(0, 0, 0, 0.18) 35%,
        rgba(72, 22, 120, 0.32) 62%,
        rgba(8, 8, 12, 0.94) 100%
    );
    z-index: 1;
    pointer-events: none;
}

.selectionContainer_VideoContainer video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(20px) brightness(.8) saturate(1.3);
    transform: scale(1.08); /* hide blur fringe */
    z-index: 0;
}

/* Logo — top-left */
.selectionContainer_VideoContainer > img {
    position: absolute;
    top: 18px;
    left: 18px;
    width: 32px;
    height: 32px;
    z-index: 2;
    opacity: 0.85;
}

/* All text sits above gradient */
.selectionContainer_VideoContainer > span {
    position: relative;
    z-index: 2;
    display: block;
    max-width: unset;
}

/* Override global .size-3 (3rem) — too large inside this panel */
.selectionContainer_VideoContainer .size-3 {
    font-size: clamp(1.4rem, 2.4vw, 2rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.025em;
    margin-bottom: 8px;
}

.selectionContainer_VideoContainer .op0-8 {
    font-size: clamp(0.7rem, 1vw, 0.8rem);
    opacity: 0.58;
    line-height: 1.55;
}

/* ============================================================
   Right — Selection Panel
   ============================================================ */

.selectionContainer {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    padding: 20px 18px;
    box-sizing: border-box;
    overflow-y: auto;
}

/* ── Individual option card ── */
.selectionBox {
    flex: 1;
    padding: 13px 15px;
    box-sizing: border-box;
    background: var(--color-primary);
    border: 1px solid rgba(128, 128, 128, 0.14);
    border-left: 3px solid transparent;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    transition:
        border-color var(--ease-fast),
        background var(--ease-medium),
        transform var(--ease-fast),
        box-shadow var(--ease-fast);
}

/* Accent stripe — uniform */
.selectionBox { border-left-color: var(--color-accent); }

.selectionBox:hover {
    border-color: rgba(112, 63, 161, 0.28);
    border-left-color: var(--color-accent);
}

/* ── Header row: icon + title ── */
.selectionBox .rowBox {
    display: flex;
    align-items: center;
    flex-direction: row;
    gap: 8px;
}

.selectionBox .rowBox > button {
    all: unset;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity var(--ease-fast);
}
.selectionBox .rowBox > button:hover { opacity: 1; }

.selectionBox img.icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.78;
}

/* ── YouTube: input + confirm in one row ── */
.selectionBox .rowBoxyt {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.selectionBox .input {
    all: unset;
    flex: 1;
    min-width: 0;
    height: 34px;
    padding: 0 10px;
    box-sizing: border-box;
    background: var(--color-bg);
    border: 1.5px dashed rgba(128, 128, 128, 1);
    border-radius: 8px;
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    transition: border-color var(--ease-fast), box-shadow var(--ease-fast);
}

.selectionBox .input:focus {
    border-color: #e05252;
    box-shadow: 0 0 0 2px rgba(224, 82, 82, 0.18);
    outline: none;
}

.selectionBox .rowBoxyt > #ConfirmYoutubeLink {
    all: unset;
    cursor: pointer;
    height: 34px;
    padding: 0 14px;
    border-radius: 8px;
    background: var(--color-accent);
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    box-sizing: border-box;
    transition: opacity var(--ease-fast), transform var(--ease-fast);
}

.selectionBox .rowBoxyt > #ConfirmYoutubeLink:hover {
    opacity: 0.82;
    transform: translateY(-1px);
}

/* ── Upload drop zones ── */
.selectionBox .rowBoxLocal {
    flex: 1;
    display: flex;
}

#uploadLocalBtn,
#uploadNoteBtn {
    all: unset;
    cursor: pointer;
    width: 100%;
    min-height: 58px;
    height: 100%;
    border-radius: 9px;
    border: 1.5px dashed rgba(128, 128, 128, 1);
    background: rgba(188, 188, 188, 0.06);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    box-sizing: border-box;
    transition:
        border-color var(--ease-fast),
        background var(--ease-fast),
        transform var(--ease-fast);
}

#uploadLocalBtn:hover,
#uploadNoteBtn:hover {
    background: rgba(128, 128, 128, 0.12);
    transform: scale(101%);
}

#uploadLocalBtn span,
#uploadNoteBtn span {
    color: var(--color-text);
    line-height: 1.3;
    text-align: center;
}

/* ── Subtitle text ── */
.selectionBox > span.op0-5 {
    font-size: 0.72rem;
    line-height: 1.5;
}

/* ============================================================
   Responsive — tablet & below  (≤ 768px)
   ============================================================ */

@media (max-width: 768px) {
    #selectVideoPopup {
        align-items: flex-start;
        padding: 0;
    }

    .selectVideoPopup_selectionContainer {
        width: 100% !important;
        height: 100%;
        min-height: 100%;
        max-height: 100%;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none;
        grid-template-columns: 1fr !important;
        grid-template-rows: auto 1fr;
        overflow-y: auto;
        overflow-x: hidden;
        animation: svp-enter-mobile 260ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    @keyframes svp-enter-mobile {
        from { opacity: 0; transform: translateY(30px); }
        to   { opacity: 1; transform: translateY(0);    }
    }

    .selectionContainer_VideoContainer {
        min-height: 130px;
        max-height: 180px;
        padding: 18px 16px;
        justify-content: flex-end;
    }

    .selectionContainer_VideoContainer video {
        width: 100% !important;
        height: 100% !important;
    }

    .selectionContainer_VideoContainer .size-3 {
        font-size: 1.35rem;
    }

    .selectionContainer_VideoContainer .op0-8 {
        display: none; /* too cramped on mobile */
    }

    .selectionContainer {
        padding: 14px;
        gap: 10px;
        padding-bottom: 24px;
    }

    .selectionBox {
        transform: none !important;
    }

    .selectionBox .rowBoxyt {
        flex-direction: column;
        align-items: stretch;
    }

    .selectionBox .rowBoxyt > #ConfirmYoutubeLink {
        width: 100%;
        justify-content: center;
        display: flex;
        align-items: center;
    }

    .selectionBox .input {
        height: 44px;         /* prevent iOS auto-zoom */
        font-size: 16px;
    }

    #uploadLocalBtn,
    #uploadNoteBtn {
        min-height: 52px;
    }

    .closePopupBtn {
        top: 12px;
        right: 12px;
    }
}

/* ============================================================
   Responsive — very small  (≤ 400px)
   ============================================================ */

@media (max-width: 400px) {
    .selectionContainer_VideoContainer {
        min-height: 100px;
        max-height: 130px;
    }

    .selectionContainer {
        padding: 10px;
    }

    .selectionBox {
        padding: 11px 12px;
    }
}
