/* ═══════════════════════════════════════════════════════════════
   css-detail-lightbox.css
   Modal de ficha (overlays full-bleed, gradientes, flechas, filmstrip, barras de color), lightbox, selector de imagen local.
   (Parte de styles.css — el orden de <link> respeta la cascada original)
   ═══════════════════════════════════════════════════════════════ */

    /* ── FICHA MODAL ── */
    #ficha-modal .modal-content {
    max-width: 720px;
    padding: 0;
    overflow: hidden;
    }

    .ficha-image-zone {
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--bg-element);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    }

    .ficha-image-zone > img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.35s cubic-bezier(0.16,1,0.3,1);
    animation: kenIn 0.75s cubic-bezier(0.16,1,0.3,1);
    }
    @keyframes kenIn {
    from { opacity: 0; transform: scale(1.07); }
    }

    .ficha-image-zone:hover > img { transform: scale(1.05); }
    .ficha-image-zone > img.lb-ready { cursor: zoom-in; }

    /* ── LIGHTBOX ── */
    #lightbox {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0,0,0,0.96);
    display: flex; align-items: center; justify-content: center;
    cursor: zoom-out;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: lbFadeIn 0.15s ease;
    }
    #lightbox img {
    max-width: 92vw; max-height: 88vh;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: 0 32px 80px rgba(0,0,0,0.85);
    cursor: default;
    user-select: none;
    animation: lbZoom 0.38s cubic-bezier(0.16,1,0.3,1);
    }
    @keyframes lbZoom {
    from { opacity: 0; transform: scale(0.93); }
    }
    .lb-close {
    position: absolute; top: 1rem; right: 1rem;
    width: 2.2rem; height: 2.2rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50%;
    color: rgba(255,255,255,0.75);
    font-size: 1.3rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, color 0.15s;
    }
    .lb-close:hover { background: rgba(255,255,255,0.2); color: #fff; border-color: rgba(255,255,255,0.3); }
    @keyframes lbFadeIn { from { opacity: 0; } to { opacity: 1; } }

    .ficha-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    color: var(--text-dim);
    background: linear-gradient(135deg, var(--bg-element) 0%, var(--bg-surface) 100%);
    }

    .ficha-no-image svg {
    width: 48px;
    height: 48px;
    opacity: 0.25;
    }

    .ficha-no-image span {
    font-size: 0.75rem;
    font-family: 'Space Mono', monospace;
    letter-spacing: 0.06em;
    opacity: 0.4;
    }

    .ficha-body {
    padding: 1.1rem 1.5rem 1.3rem;
    overflow-y: auto;
    max-height: calc(85vh - 330px - 62px);
    display: flex;
    flex-direction: column;
    gap: 0;
    }

    /* ── FICHA INFO ROW (meta + prices in same visual language) ── */

    /* A single info line — used for price row */

    /* Right side of title row: counter + flag inline */

    .ficha-info-sep {
    color: var(--border-bright);
    font-size: 0.75rem;
    font-weight: 300;
    }

    /* Price values — same size as info but colored */
    .ficha-price-val {
    font-family: 'Space Mono', monospace;
    font-size: 0.82rem;
    font-weight: 700;
    }
    .ficha-price-val.gold  { color: var(--accent-gold); }
    .ficha-price-val.green { color: var(--accent-moto); }
    .ficha-price-val.red   { color: var(--accent-red); }
    .ficha-price-val.dim   { color: var(--text-dim); font-weight: 400; }

    .ficha-price-arrow {
    font-size: 0.7rem;
    color: var(--text-dim);
    }

    .ficha-price-pct {
    font-family: 'Space Mono', monospace;
    font-size: 0.68rem;
    font-weight: 400;
    opacity: 0.65;
    }

    /* Divider between meta and price rows */

    /* ── FICHA NAV COUNTER ── */
    .ficha-nav-counter {
    font-family: 'Space Mono', monospace;
    font-size: 0.6rem;
    color: var(--text-dim);
    letter-spacing: 0.04em;
    white-space: nowrap;
    align-self: flex-start;
    padding-top: 0.15rem;
    }

    /* ── FICHA CLOSE X ── */
    .ficha-close-x {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    z-index: 10;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--close-x-bg);
    border: 1px solid var(--nav-btn-border);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    padding: 0;
    font-family: inherit;
    }
    .ficha-close-x:hover {
    background: var(--nav-btn-bg-hover);
    border-color: var(--nav-btn-border-hover);
    color: var(--text-primary);
    }

    /* ── FICHA NAV ARROWS ── */
    .ficha-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 2.1rem;
    height: 3.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.28);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.52);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: background var(--transition), color var(--transition), border-color var(--transition), opacity var(--transition);
    padding: 0;
    font-family: inherit;
    opacity: 0.82;
    }
    .ficha-nav-prev {
    left: 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    border-left: none;
    }
    .ficha-nav-next {
    right: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    border-right: none;
    }
    .ficha-nav-arrow:hover {
    background: rgba(0,0,0,0.52);
    color: rgba(255,255,255,0.88);
    border-color: rgba(255,255,255,0.22);
    opacity: 1;
    }
    /* hide arrows on no-image state so they don't look odd */
    .ficha-image-zone:not(:has(img)) .ficha-nav-arrow { opacity: 0.25; }

    /* ── FICHA REDESIGN: FULL-BLEED OVERLAYS ── */
    /* Modal más grande */
    #ficha-modal .modal-content { max-width: 860px !important; }

    /* Gradientes de legibilidad — cubren solo el área del texto, no toda la imagen */
    .ficha-grad-top {
    position: absolute; top: 0; left: 0; right: 0;
    height: 26%; pointer-events: none; z-index: 1;
    background: linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.22) 55%, transparent 100%);
    }
    .ficha-grad-bot {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 24%; pointer-events: none; z-index: 1;
    background: linear-gradient(to top, rgba(0,0,0,0.62) 0%, rgba(0,0,0,0.26) 55%, transparent 100%);
    }

    /* Paneles de overlay */
    .ficha-overlay-tl {
    position: absolute; top: 0.8rem; left: 0.85rem;
    z-index: 3; max-width: 64%;
    display: flex; flex-direction: column; gap: 0.28rem;
    pointer-events: none;
    }
    .ficha-overlay-bl {
    position: absolute; bottom: 0.85rem; left: 0.85rem;
    z-index: 3; display: flex; flex-direction: column; gap: 0.22rem;
    pointer-events: none;
    }
    .ficha-overlay-bc {
    position: absolute; bottom: 0.9rem; left: 50%;
    transform: translateX(-50%);
    z-index: 3; pointer-events: none;
    white-space: nowrap;
    }
    .ficha-overlay-br {
    position: absolute; bottom: 0.8rem; right: 0.85rem;
    z-index: 3; display: flex; gap: 0.38rem; align-items: center;
    }

    /* TL: badge de tipo */

    /* TL: fila principal (bandera + colores + título) */
    .fo-main { display:flex; align-items:center; gap:0.38rem; flex-wrap:wrap; line-height:1.2; }
    .fo-flag { font-size:1.25rem; line-height:1; flex-shrink:0; }
    .fo-title { font-size:1.18rem; font-weight:700; color:#fff; line-height:1.2; letter-spacing:-0.02em; }
    .fo-title .fo-model { font-weight:400; color:rgba(255,255,255,0.85); }
    .fo-title .fo-year  { font-weight:400; font-size:0.76em; color:rgba(255,255,255,0.48); margin-left:0.28rem; }
    .fo-title .fo-wish-badge { font-size:0.82em; line-height:1; margin-right:0.1rem; }

    /* TL: fila secundaria (maker · ref) */
    .fo-sub { display:flex; align-items:center; gap:0.3rem; flex-wrap:wrap; }
    .fo-sub-val { font-size:0.79rem; color:rgba(255,255,255,0.62); }
    .fo-sub-sep { font-size:0.7rem; color:rgba(255,255,255,0.3); }
    .fo-ref { font-family:'Space Mono',monospace; font-size:0.71rem; color:rgba(255,255,255,0.42); }

    /* BL: estante */
    .fo-estante { font-size:0.87rem; font-weight:600; color:rgba(255,255,255,0.88); }

    /* BL: precios (hereda los colores del sistema existente) */
    .fo-prices { display:flex; align-items:baseline; gap:0.32rem; flex-wrap:wrap; }
    .fo-prices .ficha-price-val { font-size:0.74rem; }
    .fo-prices .ficha-price-pct { font-size:0.62rem; }
    .fo-prices .ficha-price-arrow { font-size:0.66rem; }
    body.prices-hidden .fo-prices { display:none; }

    /* BC: contador */
    .ficha-overlay-bc .ficha-nav-counter {
    color: rgba(255,255,255,0.52);
    font-size: 0.62rem;
    text-shadow: 0 1px 4px rgba(0,0,0,0.7);
    }

    /* BR: botones icono */
    .ficha-icon-btn {
    width: 2.05rem; height: 2.05rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.95rem; line-height: 1;
    background: rgba(0,0,0,0.42);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 8px; cursor: pointer;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    transition: background 0.14s, border-color 0.14s, color 0.14s;
    padding: 0; color: rgba(255,255,255,0.72);
    font-family: inherit; position: relative;
    }
    .ficha-icon-btn:hover { background:rgba(0,0,0,0.62); border-color:rgba(255,255,255,0.28); color:#fff; }
    .ficha-icon-btn.fi-edit   { color:var(--accent-car); border-color:rgba(77,159,255,0.28); }
    .ficha-icon-btn.fi-edit:hover { background:rgba(77,159,255,0.18); border-color:rgba(77,159,255,0.48); }
    .ficha-icon-btn.fi-delete { color:var(--accent-red); border-color:rgba(255,77,106,0.28); }
    .ficha-icon-btn.fi-delete:hover { background:rgba(255,77,106,0.18); border-color:rgba(255,77,106,0.48); }
    .ficha-icon-btn.fi-nota   { color:var(--accent-gold); border-color:rgba(240,180,41,0.28); }
    .ficha-icon-btn.fi-nota:hover { background:rgba(240,180,41,0.16); border-color:rgba(240,180,41,0.48); }

    /* Tooltip de nota */
    .ficha-nota-tip {
    position: absolute; bottom: calc(100% + 0.55rem); right: 0;
    min-width: 180px; max-width: 260px;
    background: rgba(14,16,24,0.97);
    border: 1px solid rgba(240,180,41,0.22);
    border-radius: 8px; padding: 0.55rem 0.7rem;
    font-size: 0.75rem; font-family: 'Outfit', sans-serif; font-weight: 400;
    color: rgba(255,255,255,0.78); line-height: 1.55;
    white-space: pre-wrap; word-break: break-word;
    pointer-events: none; text-align: left;
    opacity: 0; transform: translateY(5px);
    transition: opacity 0.15s, transform 0.15s;
    z-index: 20;
    }
    .ficha-icon-btn.fi-nota:hover .ficha-nota-tip { opacity:1; transform:translateY(0); }

    /* Links de búsqueda para deseados en la ficha (overlay BR) */
    .ficha-wish-links {
    display:flex; align-items:center; gap:0.3rem; flex-wrap:wrap; justify-content:flex-end;
    }
    .ficha-wish-links .gtile-wslink {
    width:2.05rem; height:2.05rem;
    min-width:2.05rem; max-width:2.05rem;
    display:flex; align-items:center; justify-content:center;
    background:rgba(0,0,0,0.42); border:1px solid rgba(255,255,255,0.14);
    border-radius:8px; backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px);
    transition:background 0.14s, border-color 0.14s; flex-shrink:0;
    }
    .ficha-wish-links .gtile-wslink:hover { background:rgba(0,0,0,0.62); border-color:rgba(255,255,255,0.28); }
    .ficha-wish-links .gtile-wslink img { width:16px; height:16px; border-radius:3px; }

    /* Filmstrip: indicador visual para deseados */
    .fstrip-thumb.wish-item { outline-color:rgba(245,158,11,0.35); }
    .fstrip-thumb.wish-item.active { outline-color:#f59e0b; }

    /* ── FILMSTRIP ── */
    .ficha-strip {
    background: var(--bg-base);
    border-top: 1px solid var(--border-subtle);
    height: 74px;
    overflow-x: auto; overflow-y: hidden;
    flex-shrink: 0;
    scrollbar-width: none; -ms-overflow-style: none;
    }
    .ficha-strip::-webkit-scrollbar { display:none; }
    .ficha-strip-inner {
    display:flex; gap:2px;
    height:100%; align-items:center; width:max-content;
    }
    .fstrip-thumb {
    flex-shrink:0; width:88px; height:66px;
    border-radius:4px; overflow:hidden;
    cursor:pointer; position:relative;
    opacity:0.42;
    outline:2px solid transparent; outline-offset:-2px;
    background:var(--bg-element);
    transition: opacity 0.14s, outline-color 0.14s, transform 0.2s cubic-bezier(0.16,1,0.3,1);
    animation: thumbIn 0.45s cubic-bezier(0.16,1,0.3,1) backwards;
    animation-delay: calc(var(--si, 0) * 16ms);
    }
    @keyframes thumbIn {
    from { opacity:0; transform:translateY(14px); }
    }
    .fstrip-thumb:hover { transform: translateY(-2px); }
    .fstrip-thumb:hover { opacity:0.78; }
    .fstrip-thumb.active { opacity:1; outline-color:var(--accent-car); }
    .fstrip-thumb.active.moto { outline-color:var(--accent-moto); }
    .fstrip-thumb img {
    width:100%; height:100%; object-fit:cover;
    display:block; pointer-events:none;
    }
    .fstrip-ph {
    width:100%; height:100%;
    display:flex; align-items:center; justify-content:center;
    }
    .fstrip-ph svg { width:20px; height:20px; opacity:0.3; color:var(--text-dim); }

    /* ── FICHA NAV COUNTER (in title row) ── */
    .ficha-nav-counter {
    font-family: 'Space Mono', monospace;
    font-size: 0.6rem;
    color: var(--text-dim);
    letter-spacing: 0.04em;
    white-space: nowrap;
    align-self: center;
    }

    /* ── CLICKABLE LIST ITEMS ── */
    li { cursor: pointer; }

    /* ── IMAGE URL PREVIEW ── */
    /* ── LOCAL IMAGE PICKER ── */
    .img-local-picker {
        margin-top: 0.4rem;
        border: 1.5px dashed var(--border-color);
        border-radius: var(--radius-sm);
        overflow: hidden;
        cursor: pointer;
        transition: border-color var(--transition), background var(--transition);
    }
    .img-local-picker:hover { border-color: var(--border-bright); }
    .img-local-picker.drag-over {
        border-color: var(--accent);
        background: rgba(77,159,255,0.04);
    }
    .img-pick-preview {
        width: 100%;
        height: 110px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--bg-surface);
        position: relative;
        overflow: hidden;
    }
    .img-pick-preview img {
        width: 100%; height: 100%;
        object-fit: cover;
        display: none;
    }
    .img-pick-placeholder {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.3rem;
        color: var(--text-dim);
        font-size: 0.72rem;
        pointer-events: none;
        user-select: none;
    }
    .img-pick-placeholder svg {
        width: 22px; height: 22px;
        stroke: var(--text-dim); fill: none;
        stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round;
    }
    .img-pick-footer {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        padding: 0.3rem 0.5rem;
        background: var(--bg-element);
        border-top: 1px solid var(--border-color);
    }
    .img-pick-filename {
        flex: 1;
        font-size: 0.7rem;
        color: var(--text-dim);
        font-family: "Space Mono", monospace;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .img-pick-filename.has-file { color: var(--text-secondary); }
    .img-pick-clear {
        flex-shrink: 0;
        width: 1.3rem; height: 1.3rem;
        padding: 0;
        font-size: 0.8rem;
        display: flex; align-items: center; justify-content: center;
        opacity: 0.5;
        line-height: 1;
    }
    .img-pick-clear:hover { opacity: 1; }

