/* ══════════ RESET & BASE ══════════ */
:root {
    --bg: #07080f;
    --surface: #0e1018;
    --card: #13151f;
    --card2: #1a1d2a;
    --border: rgba(255,255,255,.07);
    --border2: rgba(255,255,255,.13);
    --accent: #00c8ff;
    --accent2: #ff5f7e;
    --accent3: #a78bfa;
    --text: #e6e8f0;
    --muted: #5c6375;
    --muted2: #8e96aa;
    --danger: #ff4060;
    --ok: #00e5a0;
    --r: 14px;
    --rs: 9px;
    --rss: 6px;
    /* fonts (fallback) */
    --font-title: "Syne", sans-serif;
    --font-body: "DM Sans", sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: var(--font-body);
    color: var(--text);
    overflow-x: hidden;
    background: var(--bg);
    background-image: radial-gradient(ellipse 90% 55% at 50% -8%,rgba(0,200,255,.08) 0%,transparent 65%), radial-gradient(ellipse 55% 40% at 92% 88%,rgba(255,95,126,.07) 0%,transparent 55%), radial-gradient(ellipse 35% 25% at 5% 75%,rgba(167,139,250,.05) 0%,transparent 50%);
}

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.09);
    border-radius: 9px;
}

input[type=file] {
    display: none;
}

/* bloquea scroll del fondo cuando hay modal */
body.modal-open {
    overflow: hidden;
}

/* ══════════ TOPBAR ══════════ */
#topbar {
    position: sticky;
    top: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .82rem 2rem;
    background: rgba(7,8,15,.9);
    backdrop-filter: blur(22px);
    border-bottom: 1px solid var(--border);
}

.logo {
    font-family: var(--font-title);
    font-weight: 800;
    font-size: 1.18rem;
    background: linear-gradient(100deg,var(--accent),var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -.02em;
    cursor: pointer;
    user-select: none;
}

#breadcrumb {
    display: flex;
    align-items: center;
    gap: .38rem;
    font-size: .81rem;
    color: var(--muted2);
}

.bc-link {
    cursor: pointer;
    transition: color .18s;
}

    .bc-link:hover {
        color: var(--accent);
    }

.bc-sep {
    color: var(--muted);
    user-select: none;
}

.bc-cur {
    color: var(--text);
    font-weight: 500;
}

#topbar-r {
    display: flex;
    gap: .55rem;
}

/* ══════════ BUTTONS ══════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .38rem;
    padding: .48rem 1.05rem;
    border: none;
    border-radius: var(--rs);
    font-family: var(--font-body);
    font-size: .82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .17s;
    white-space: nowrap;
    line-height: 1;
}

.btn-primary {
    background: linear-gradient(135deg,var(--accent),#0096c7);
    color: #05070e;
    box-shadow: 0 3px 14px rgba(0,200,255,.2);
}

    .btn-primary:hover {
        box-shadow: 0 5px 22px rgba(0,200,255,.38);
        transform: translateY(-1px);
    }

.btn-ghost {
    background: rgba(255,255,255,.055);
    color: var(--text);
    border: 1px solid var(--border2);
}

    .btn-ghost:hover {
        background: rgba(255,255,255,.1);
    }

.btn-danger {
    background: rgba(255,64,96,.1);
    color: var(--danger);
    border: 1px solid rgba(255,64,96,.22);
}

    .btn-danger:hover {
        background: rgba(255,64,96,.2);
    }

.btn-sm {
    padding: .32rem .72rem;
    font-size: .75rem;
}

.btn-icon {
    padding: .4rem;
    border-radius: var(--rss);
}

/* ══════════ VIEWS ══════════ */
.view {
    display: none;
    animation: fadeUp .28s ease both;
}

    .view.active {
        display: block;
    }

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes popIn {
    from {
        transform: scale(.88);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ══════════════════════════════
   HOME VIEW
══════════════════════════════ */
#view-home {
    padding: 2.4rem 2rem 4rem;
    max-width: 1280px;
    margin: 0 auto;
}

.home-hdr {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.home-title {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: -.03em;
    line-height: 1.1;
}

    .home-title .hl {
        background: linear-gradient(100deg,var(--accent),var(--accent2));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

.home-sub {
    color: var(--muted2);
    font-size: .8rem;
    margin-top: .22rem;
}

/* ── ALBUMS GRID ── */
.albums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(230px,1fr));
    gap: 1.2rem;
}

/* New album card */
.card-new {
    border: 2px dashed rgba(255,255,255,.09);
    border-radius: var(--r);
    min-height: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    cursor: pointer;
    color: var(--muted2);
    transition: border-color .2s,background .2s,color .2s;
}

    .card-new:hover {
        border-color: rgba(0,200,255,.4);
        background: rgba(0,200,255,.04);
        color: var(--accent);
    }

    .card-new svg {
        opacity: .45;
        transition: opacity .2s,transform .2s;
    }

    .card-new:hover svg {
        opacity: 1;
        transform: scale(1.1);
    }

.card-new-lbl {
    font-size: .84rem;
    font-weight: 500;
}

/* Album card */
.album-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: transform .22s,box-shadow .22s,border-color .22s;
}

    .album-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 14px 40px rgba(0,0,0,.55),0 0 36px rgba(0,200,255,.08);
        border-color: rgba(0,200,255,.2);
    }

/* ── POLAROID STACK PREVIEW ── */
.stack-area {
    position: relative;
    width: 100%;
    height: 190px;
    background: linear-gradient(160deg,#131624,#0c0e19);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .stack-area.locked .stack-polaroid img {
        filter: blur(10px) brightness(.7);
    }

    .stack-area.locked::after {
        content: '🔒';
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 2rem;
        z-index: 20;
        background: rgba(0,0,0,.3);
        backdrop-filter: blur(2px);
    }

.stack-wrap {
    position: relative;
    width: 120px;
    height: 140px;
}

.stack-polaroid {
    position: absolute;
    background: #fff;
    padding: 6px 6px 22px;
    box-shadow: 0 4px 16px rgba(0,0,0,.5);
    transform-origin: center bottom;
    transition: transform .3s ease;
}

    .stack-polaroid img {
        width: 80px;
        height: 80px;
        object-fit: cover;
        display: block;
    }

.stack-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    color: var(--muted);
    height: 100%;
}

    .stack-empty svg {
        opacity: .22;
    }

    .stack-empty span {
        font-size: .7rem;
    }

/* Hover: fan out polaroids */
.album-card:hover .stack-polaroid:nth-child(1) {
    transform: rotate(-18deg) translateX(-38px) translateY(4px) !important;
}

.album-card:hover .stack-polaroid:nth-child(2) {
    transform: rotate(-8deg) translateX(-16px) translateY(-2px) !important;
}

.album-card:hover .stack-polaroid:nth-child(3) {
    transform: rotate(2deg) translateX(6px) translateY(-4px) !important;
}

.album-card:hover .stack-polaroid:nth-child(4) {
    transform: rotate(12deg) translateX(28px) translateY(-2px) !important;
}

.album-card:hover .stack-polaroid:nth-child(5) {
    transform: rotate(22deg) translateX(50px) translateY(4px) !important;
}

.album-card-body {
    padding: .85rem 1rem;
}

.album-card-name {
    font-family: var(--font-title);
    font-weight: 600;
    font-size: .92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.album-card-meta {
    font-size: .71rem;
    color: var(--muted2);
    margin-top: .2rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.lock-badge {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    font-size: .65rem;
    background: rgba(167,139,250,.12);
    color: var(--accent3);
    border: 1px solid rgba(167,139,250,.22);
    border-radius: 20px;
    padding: .1rem .45rem;
}

.album-card-actions {
    position: absolute;
    top: .55rem;
    right: .55rem;
    display: flex;
    gap: .32rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity .17s;
}

.album-card:hover .album-card-actions {
    opacity: 1;
    pointer-events: auto;
}

/* ══════════════════════════════
   ALBUM VIEW
══════════════════════════════ */
#view-album {
    padding: 2rem 2rem 4rem;
    max-width: 1280px;
    margin: 0 auto;
}

.av-hdr {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: .5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.av-title {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 1.65rem;
    letter-spacing: -.03em;
}

.av-desc {
    color: var(--muted2);
    font-size: .79rem;
    margin-top: .18rem;
}

.av-ctrl {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .6rem 1rem;
    margin: .8rem 0 1.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--rs);
    flex-wrap: wrap;
    gap: .55rem;
}

.toolbar-l {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.toolbar-r {
    display: flex;
    align-items: center;
    gap: .45rem;
}

.badge {
    font-size: .71rem;
    color: var(--muted2);
    background: rgba(255,255,255,.05);
    padding: .2rem .58rem;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.inp,
.search-inp {
    background: rgba(255,255,255,.05);
    border: 1px solid var(--border2);
    color: var(--text);
    border-radius: var(--rs);
    font-family: var(--font-body);
    font-size: .78rem;
    outline: none;
    transition: border-color .2s;
}

.inp {
    padding: .36rem .78rem;
}

    .inp option {
        background: #13151f;
    }

.search-inp {
    padding: .36rem .82rem;
    width: 165px;
}

    .search-inp::placeholder {
        color: var(--muted);
    }

    .inp:focus, .search-inp:focus {
        border-color: var(--accent);
    }

/* ══ POLAROID GRID ══ */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 1.4rem;
    margin-bottom: 1.6rem;
}

@media (max-width:900px) {
    .photo-grid {
        grid-template-columns: repeat(3,1fr);
    }
}

@media (max-width:580px) {
    .photo-grid {
        grid-template-columns: repeat(2,1fr);
    }
}

.polaroid-cell {
    position: relative;
    cursor: pointer;
    background: #fff;
    padding: 8px 8px 30px;
    box-shadow: 0 6px 20px rgba(0,0,0,.45),0 1px 3px rgba(0,0,0,.25);
    transform: rotate(var(--rot));
    transition: transform .25s cubic-bezier(.34,1.4,.64,1),box-shadow .25s;
    will-change: transform;
}

    .polaroid-cell:hover {
        transform: rotate(0deg) scale(1.05) translateY(-6px) !important;
        box-shadow: 0 18px 40px rgba(0,0,0,.55),0 0 30px rgba(0,200,255,.12);
        z-index: 10;
    }

    .polaroid-cell img {
        width: 100%;
        aspect-ratio: 1;
        object-fit: cover;
        display: block;
    }

.polaroid-caption {
    text-align: center;
    font-size: .63rem;
    color: #444;
    margin-top: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-title);
    font-style: italic;
}

.polaroid-del {
    position: absolute;
    top: -7px;
    right: -7px;
    background: #ff4060;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: .65rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .17s,transform .17s;
    box-shadow: 0 2px 8px rgba(0,0,0,.4);
}

.polaroid-cell:hover .polaroid-del,
.film-cell:hover .polaroid-del {
    opacity: 1;
    transform: scale(1);
}

.polaroid-del:hover {
    transform: scale(1.15) !important;
}

/* ── Boton de comentar (aparece en hover, arriba a la izquierda) ── */
.polaroid-comment-btn {
    position: absolute;
    top: -7px;
    left: -7px;
    background: var(--accent);
    color: #05070e;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .17s, transform .17s;
    box-shadow: 0 2px 10px rgba(0,200,255,.55);
    z-index: 5;
}

.polaroid-cell:hover .polaroid-comment-btn,
.film-cell:hover .polaroid-comment-btn {
    opacity: 1;
}

.polaroid-comment-btn:hover {
    transform: scale(1.15) !important;
    box-shadow: 0 3px 16px rgba(0,200,255,.75);
}

/* ── Badge de comentario (visible siempre cuando tiene nota) ── */
.polaroid-comment-badge {
    position: absolute;
    bottom: 5px;
    left: 6px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #0090b8;
    font-size: .55rem;
    font-family: var(--font-title);
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    padding: 1px 3px;
    border-radius: 4px;
    transition: color .15s, background .15s;
    z-index: 4;
    line-height: 1;
}

.polaroid-comment-badge:hover {
    color: #007aa0;
    background: rgba(0,144,184,.08);
}

/* ══ PAGINATION ══ */
.pagination {
    display: flex;
    justify-content: center;
    gap: .38rem;
    margin-top: .2rem;
}

.pgb {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--muted2);
    width: 32px;
    height: 32px;
    border-radius: var(--rs);
    font-family: var(--font-body);
    font-size: .77rem;
    cursor: pointer;
    transition: all .17s;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .pgb:hover {
        border-color: var(--border2);
        color: var(--text);
    }

    .pgb.active {
        background: var(--accent);
        color: #05070e;
        border-color: var(--accent);
        font-weight: 600;
    }

    .pgb:disabled {
        opacity: .25;
        cursor: default;
    }

/* Puntos suspensivos en paginacion (no interactivo) */
.pgb-dots {
    opacity: .45;
    cursor: default;
    pointer-events: none;
    border-color: transparent;
    background: transparent;
    letter-spacing: .05em;
}

/* Paginacion dentro del modal de compartir */
.share-pag {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin-top: .6rem;
    padding-top: .6rem;
    border-top: 1px solid var(--border);
}

.share-pag-info {
    font-size: .74rem;
    color: var(--muted2);
    min-width: 90px;
    text-align: center;
    white-space: nowrap;
}

.empty-ph {
    grid-column: 1 / -1;
    text-align: center;
    padding: 5rem 1rem;
    color: var(--muted);
}

    .empty-ph svg {
        opacity: .18;
        display: block;
        margin: 0 auto 1rem;
    }

    .empty-ph p {
        font-size: .83rem;
        font-style: italic;
    }

/* ══════════ LIGHTBOX ══════════ */
#lb {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(4,5,10,.95);
    backdrop-filter: blur(16px);
    flex-direction: column;
    overflow: hidden;
}

    #lb.open {
        display: flex;
        animation: fadeIn .18s ease;
    }

/* Botón cerrar: siempre top-right, no se mueve con el zoom */
#lb-close {
    position: absolute;
    top: .75rem;
    right: .75rem;
    z-index: 10;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    color: var(--text);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .18s;
    line-height: 1;
}

    #lb-close:hover {
        background: rgba(255,255,255,.2);
        color: #fff;
    }

/* Flechas: absolutas dentro de #lb, siempre centradas verticalmente */
.lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,.06);
    border: 1px solid var(--border2);
    color: var(--text);
    width: 42px;
    height: 66px;
    border-radius: var(--rs);
    cursor: pointer;
    font-size: 1.15rem;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .18s, color .18s;
}

    .lb-nav:hover {
        background: rgba(0,200,255,.14);
        color: var(--accent);
    }

#lb-prev { left: .6rem; }
#lb-next { right: .6rem; }

/* Zona de imagen: ocupa todo el espacio central */
#lb-img-zone {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 3rem 3.5rem 0; /* espacio para cerrar arriba y flechas a los lados */
    cursor: default;
}

#lb-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 24px 64px rgba(0,0,0,.7);
    animation: popIn .24s cubic-bezier(.34,1.4,.64,1);
    cursor: zoom-in;
    transform-origin: center center;
    will-change: transform;
    user-select: none;
    -webkit-user-drag: none;
}

/* Barra inferior: siempre visible, no se mueve con el zoom */
.lb-bottombar {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .45rem;
    padding: .6rem 1rem .85rem;
    z-index: 10;
}

.lb-meta {
    color: var(--muted2);
    font-size: .75rem;
    text-align: center;
}

.lb-acts {
    display: flex;
    gap: .5rem;
}

.lb-comment {
    display: flex;
    align-items: center;
    gap: .55rem;
    background: rgba(0,200,255,.08);
    border: 1px solid rgba(0,200,255,.18);
    border-radius: var(--rs);
    padding: .55rem .85rem;
    max-width: 88vw;
    color: var(--text);
    font-size: .82rem;
    line-height: 1.45;
}

.lb-comment svg {
    flex-shrink: 0;
    opacity: .7;
    color: var(--accent);
}

#lb-comment-text {
    flex: 1;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ══════════ MODALS (base) ══════════ */
.modal {
    background: #15182a;
    border: 1px solid var(--border2);
    border-radius: var(--r);
    padding: 1.75rem;
    width: 100%;
    max-width: 430px;
    box-shadow: 0 24px 64px rgba(0,0,0,.65);
    animation: popIn .22s cubic-bezier(.34,1.2,.64,1);
}

    .modal h3 {
        font-family: var(--font-title);
        font-size: 1.12rem;
        margin-bottom: .28rem;
    }

    .modal .msub {
        font-size: .79rem;
        color: var(--muted2);
        margin-bottom: 1.15rem;
    }

.field {
    margin-bottom: .9rem;
}

    .field label {
        display: block;
        font-size: .74rem;
        color: var(--muted2);
        margin-bottom: .32rem;
        font-weight: 500;
    }

.m-inp {
    width: 100%;
    background: rgba(255,255,255,.05);
    border: 1px solid var(--border2);
    color: var(--text);
    padding: .56rem .88rem;
    border-radius: var(--rs);
    font-family: var(--font-body);
    font-size: .86rem;
    outline: none;
    transition: border-color .2s,background .2s;
}

    .m-inp:focus {
        border-color: var(--accent);
        background: rgba(0,200,255,.04);
    }

.modal-acts {
    display: flex;
    justify-content: flex-end;
    gap: .52rem;
    margin-top: 1.35rem;
}

/* Overlay genérico (unificado) */
.ov {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    padding: 22px;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(10px);
    z-index: 9999;
}

    .ov.open {
        display: grid;
        animation: fadeIn .17s ease;
    }

/* Botón X reutilizable para modales */
.modal-x {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.10);
    background: rgba(255,255,255,.06);
    color: rgba(255,255,255,.9);
    display: grid;
    place-items: center;
    cursor: pointer;
}

    .modal-x:hover {
        background: rgba(255,255,255,.10);
    }

/* ══════════ CREATE / RENAME MODAL overlay ══════════ */
#modal-ov {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 400;
    background: rgba(0,0,0,.65);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

    #modal-ov.open {
        display: flex;
        animation: fadeIn .17s ease;
    }

/* Password toggle */
#pw-toggle-row {
    margin-top: 1.25rem;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .7rem .88rem;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--border);
    border-radius: var(--rs);
    cursor: pointer;
    user-select: none;
}

    .toggle-row span {
        font-size: .83rem;
        display: flex;
        align-items: center;
        gap: .5rem;
        color: var(--muted2);
    }

        .toggle-row span svg {
            opacity: .6;
        }

.switch {
    position: relative;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

    .switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

.slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.12);
    border-radius: 20px;
    transition: .2s;
    cursor: pointer;
}

    .slider::before {
        content: '';
        position: absolute;
        width: 14px;
        height: 14px;
        left: 3px;
        top: 3px;
        background: #fff;
        border-radius: 50%;
        transition: .2s;
    }

input:checked + .slider {
    background: var(--accent3);
}

    input:checked + .slider::before {
        transform: translateX(16px);
    }

.pw-field {
    margin-top: .75rem;
    animation: fadeUp .2s ease;
}

/* ══════════ LOCK MODAL ══════════ */
#lock-ov {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 450;
    background: rgba(0,0,0,.75);
    backdrop-filter: blur(12px);
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

    #lock-ov.open {
        display: flex;
        animation: fadeIn .17s ease;
    }

.lock-modal {
    background: #15182a;
    border: 1px solid rgba(167,139,250,.25);
    border-radius: var(--r);
    padding: 1.75rem;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 24px 64px rgba(0,0,0,.7),0 0 40px rgba(167,139,250,.08);
    animation: popIn .22s cubic-bezier(.34,1.2,.64,1);
    text-align: center;
}

.lock-icon {
    font-size: 2.4rem;
    margin-bottom: .6rem;
}

.lock-modal h3 {
    font-family: var(--font-title);
    font-size: 1.1rem;
    margin-bottom: .25rem;
}

.lock-modal p {
    font-size: .79rem;
    color: var(--muted2);
    margin-bottom: 1.2rem;
}

.lock-error {
    font-size: .76rem;
    color: var(--danger);
    margin-top: .55rem;
    min-height: 1.1rem;
}

/* ══════════ TOAST ══════════ */
#toast {
    position: fixed;
    bottom: 1.4rem;
    left: 50%;
    transform: translateX(-50%) translateY(14px);
    background: #1a1d2c;
    border: 1px solid var(--border2);
    color: var(--text);
    font-size: .79rem;
    padding: .48rem 1.05rem;
    border-radius: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s,transform .22s;
    z-index: 10050;
}

    #toast.show {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

/* ───────────────────────── OVERLAYS (AUTH / SHARE) ───────────────────────── */

.ov {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    padding: 22px;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(10px);
    z-index: 9999;
}

    .ov.open {
        display: grid;
    }

/* Bloqueo de scroll cuando hay modal abierto */
body.modal-open {
    overflow: hidden;
}

/* Botón X (reutilizable) */
.modal-x {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.06);
    color: rgba(255,255,255,.9);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background .15s, transform .15s;
}

    .modal-x:hover {
        background: rgba(255,255,255,.10);
        transform: translateY(-1px);
    }

/* ───────── AUTH CARD (glass) ───────── */
.auth-card {
    width: min(520px, 96vw);
    border-radius: 22px;
    padding: 22px;
    background: rgba(20, 24, 40, .78);
    border: 1px solid rgba(255,255,255,.10);
    box-shadow: 0 18px 60px rgba(0,0,0,.45);
    color: rgba(255,255,255,.92);
}

.auth-logo {
    font-weight: 700;
    letter-spacing: .2px;
    font-size: 22px;
    margin-bottom: 6px;
}

.auth-sub {
    opacity: .8;
    font-size: 13px;
    margin-bottom: 14px;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    padding: 8px;
    border-radius: 16px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    margin-bottom: 14px;
}

.auth-tab {
    flex: 1;
    border: 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: transparent;
    color: rgba(255,255,255,.82);
    cursor: pointer;
    font-weight: 600;
}

    .auth-tab.active {
        background: rgba(255,255,255,.12);
        color: rgba(255,255,255,.95);
    }

.auth-body .field {
    display: grid;
    gap: 6px;
    margin: 10px 0;
}

.auth-body label {
    font-size: 12px;
    opacity: .78;
}

.auth-body input {
    width: 100%;
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.10);
    color: rgba(255,255,255,.95);
    outline: none;
}

    .auth-body input:focus {
        border-color: rgba(120,180,255,.55);
        box-shadow: 0 0 0 3px rgba(60,130,255,.18);
    }

.auth-error {
    min-height: 18px;
    margin-top: 6px;
    font-size: 12px;
    color: rgba(255,110,110,.95);
}

.auth-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}

.auth-foot {
    margin-top: 10px;
    text-align: center;
}

.linklike {
    background: transparent;
    border: 0;
    color: rgba(150,200,255,.95);
    cursor: pointer;
    font-size: 12px;
}

    .linklike:hover {
        text-decoration: underline;
    }

/* ───────── SHARE MODAL (como tu 2da imagen: glass + blur) ───────── */
.share-card {
    position: relative;
    width: min(620px, 96vw);
    max-height: calc(100vh - 44px);
    overflow: auto; /* scroll adentro si hace falta */

    border-radius: 22px;
    padding: 22px 22px 18px;
    /* glass look */
    background: rgba(20, 24, 40, .72);
    border: 1px solid rgba(255,255,255,.10);
    box-shadow: 0 18px 60px rgba(0,0,0,.45);
    backdrop-filter: blur(18px);
}

    /* que los inputs/select ocupen el ancho completo dentro del share */
    .share-card .m-inp,
    .share-card .inp {
        width: 100%;
        border-radius: 12px;
    }

#share-list {
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

/* Título/lista como en el diseño */
.share-list {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

.share-list-title {
    font-size: 12px;
    opacity: .7;
    margin: 6px 0 6px;
}

/* items */
.share-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .65rem .75rem;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px;
    background: rgba(255,255,255,.03);
}

.share-who {
    min-width: 0;
}

.share-name {
    font-weight: 700;
    font-family: "Syne", sans-serif;
}

.share-meta {
    opacity: .75;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 420px;
}

/* Permisos en el modal de compartir */
.share-perms {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    margin-top: .35rem;
}

.share-perm-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    font-size: .85rem;
    color: var(--text);
    padding: .3rem .4rem;
    border-radius: 8px;
    transition: background .15s;
}

.share-perm-row:hover {
    background: rgba(255,255,255,.05);
}

.share-perm-row input[type="checkbox"] {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
    cursor: pointer;
    flex-shrink: 0;
}

.share-perm-row svg {
    opacity: .6;
    flex-shrink: 0;
}

.share-perms-hint {
    font-size: .75rem;
    color: var(--muted);
    margin-top: .35rem;
}

/* Tag de permisos en la lista de shares */
.share-perms-display {
    margin-top: .3rem;
}

.perm-tag {
    display: inline-block;
    font-size: .7rem;
    background: rgba(0,200,255,.1);
    border: 1px solid rgba(0,200,255,.22);
    border-radius: 999px;
    padding: .15rem .55rem;
    color: var(--accent);
}

.perm-tag.perm-readonly {
    background: rgba(255,255,255,.05);
    border-color: var(--border);
    color: var(--muted);
}

/* badges (si los usás en la lista o cards) */
.share-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    font-size: 11px;
    border-radius: 8px;
    background: rgba(255,255,255,.06);
    color: rgba(255,255,255,.72);
    border: 1px solid rgba(255,255,255,.08);
}

    .share-badge.shared {
        background: rgba(56,189,248,.12);
        color: #38bdf8;
        border-color: rgba(56,189,248,.18);
    }

    .share-badge.owner {
        background: rgba(34,197,94,.12);
        color: #22c55e;
        border-color: rgba(34,197,94,.18);
    }

/* ───────────────────────── Loading overlay PRO ───────────────────────── */

.loading-ov {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(6px);
    z-index: 10000;
}

    .loading-ov.open {
        display: grid;
    }

.loading-box {
    background: rgba(20,24,40,.85);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 18px;
    padding: 22px 26px;
    text-align: center;
    color: #fff;
    width: min(520px, 96vw);
    box-shadow: 0 20px 60px rgba(0,0,0,.45);
}

.spinner {
    width: 38px;
    height: 38px;
    margin: 0 auto 10px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,.2);
    border-top-color: #7db3ff;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 6px;
}

.loading-sub {
    font-size: 12px;
    opacity: .85;
    margin-bottom: 10px;
}

.progress-wrap {
    height: 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.10);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(125,179,255,1), rgba(170,120,255,1));
    transition: width .15s ease;
}

.loading-actions {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

/* ══════════ COMMENT MODAL ══════════ */
.comment-card {
    max-width: 420px;
    position: relative;
}

.comment-modal-head {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.1rem;
}

.comment-modal-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(0,200,255,.1);
    border: 1px solid rgba(0,200,255,.2);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.comment-modal-head h3 {
    font-family: var(--font-title);
    font-size: 1.05rem;
    margin-bottom: .1rem;
}

.comment-textarea {
    resize: vertical;
    min-height: 96px;
    line-height: 1.55;
}

.comment-char-count {
    text-align: right;
    font-size: .69rem;
    color: var(--muted);
    margin-top: .28rem;
}


/* ══ FILM STRIP (video card) ══ */
.film-cell {
    position: relative;
    cursor: pointer;
    background: #111;
    border-radius: 4px;
    box-shadow: 0 6px 20px rgba(0,0,0,.65), 0 1px 3px rgba(0,0,0,.35);
    transition: transform .25s cubic-bezier(.34,1.4,.64,1), box-shadow .25s;
    will-change: transform;
    /* overflow: hidden eliminado para que los botones de accion no queden cortados */
}

.film-cell:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 18px 40px rgba(0,0,0,.75), 0 0 28px rgba(0,200,255,.1);
    z-index: 10;
}

/* Fila con sprockets laterales + frame central */
.film-strip-row {
    display: flex;
    flex-direction: row;
    background: #111;
    overflow: hidden;
    border-radius: 4px 4px 0 0; /* esquinas superiores del card */
}

/* Columna de sprockets (izquierda / derecha) */
.film-sprocket-side {
    flex-shrink: 0;
    width: 13px;
    background: #111;
    background-image: repeating-linear-gradient(
        to bottom,
        #111  0px,
        #111  4px,
        #fff  4px,
        #fff  11px,
        #111  11px,
        #111  15px
    );
    background-size: 13px 15px;
}

/* Marco del video */
.film-frame {
    flex: 1;
    min-width: 0;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #000;
}

/* Caption del video */
.film-caption {
    text-align: center;
    font-size: .62rem;
    color: #999;
    padding: 4px 6px 7px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-title);
    font-style: italic;
    border-radius: 0 0 4px 4px; /* esquinas inferiores del card */
    background: #111;
}

/* Reusar botones de delete/comment en film-cell */
.film-cell .polaroid-del {
    background: #ff4060;
}

.film-cell .polaroid-comment-btn {
    background: var(--accent);
}

/* Video en lightbox */
#lb-vid {
    max-width: 100%;
    max-height: 100%;
    border-radius: 3px;
    outline: none;
    background: #000;
}