/* ── Tab Fotos — grid 16:9 com lightbox, drag-and-drop e zoom ──────────────── */

/* ── Container principal ─────────────────────────────────────────────────── */
.tab-fotos-container {
    display: flex;
    gap: 16px;
    align-items: stretch;
    background-color: var(--bs-tertiary-bg, #f8f9fa);
    border-radius: 6px;
    padding: 12px;
    min-height: 660px;
}

/* ── Barra de seleção múltipla ───────────────────────────────────────────── */
.fotos-selecao-bar {
    background-color: var(--bs-info-bg-subtle, #cff4fc);
    border: 1px solid var(--bs-info-border-subtle, #9eeaf9);
    border-radius: 6px;
    color: var(--bs-body-color);
}
[data-admin-theme="dark"] .fotos-selecao-bar {
    background-color: #1b3a47;
    border-color: #2a5a6a;
    color: #d4d4d4;
}

/* ── Colunas laterais ─────────────────────────────────────────────────────── */
.fotos-coluna {
    width: 240px;
    flex-shrink: 0;
    background-color: var(--bs-secondary-bg, #e9ecef);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 6px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    min-height: 660px;
    transition: border-color 0.2s, background-color 0.15s;
}

@media (min-width: 1440px) {
    .fotos-coluna { width: 280px; }
}

@media (min-width: 1920px) {
    .fotos-coluna { width: 340px; }
}

.fotos-coluna.drop-target-active {
    border-color: var(--bs-link-color, #4ec9b0);
    background-color: rgba(78, 201, 176, 0.07);
}

.fotos-coluna-header {
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    padding-bottom: 8px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

/* ── Grid de thumbs 3 colunas ────────────────────────────────────────────── */
.fotos-thumbs-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    overflow-y: auto;
    align-content: start;
    max-height: 720px;
    padding: 4px;
    scrollbar-width: thin;
}

.col-span-full {
    grid-column: 1 / -1;
}

/* ── Thumb individual ─────────────────────────────────────────────────────── */
.foto-thumb {
    aspect-ratio: 3 / 2;
    min-height: 80px;
    position: relative;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    user-select: none;
}

@media (min-width: 1920px) {
    .foto-thumb { min-height: 100px; }
}

.foto-thumb:hover {
    border-color: var(--bs-link-color, #4ec9b0);
}

.foto-thumb.selected {
    border-color: var(--bs-link-color, #4ec9b0);
    box-shadow: 0 0 0 2px rgba(78, 201, 176, 0.3);
}

.foto-thumb.selecionada {
    outline: 3px solid var(--bs-link-color, #4ec9b0);
    outline-offset: -3px;
    box-shadow: 0 0 0 1px rgba(78, 201, 176, 0.6);
}

.foto-thumb.selecionada::after {
    content: "✓";
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--bs-link-color, #4ec9b0);
    color: #000;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    z-index: 4;
}

.foto-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

/* ── Badges sobre a thumb ─────────────────────────────────────────────────── */
.badge-primeira {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 0.55rem;
    padding: 2px 4px;
    z-index: 2;
    pointer-events: none;
}

.badge-capa {
    position: absolute;
    top: 2px;
    right: 18px;
    font-size: 0.55rem;
    padding: 2px 4px;
    z-index: 2;
    pointer-events: none;
}

.badge-destaque {
    position: absolute;
    top: 16px;
    left: 2px;
    font-size: 0.55rem;
    padding: 2px 4px;
    z-index: 2;
    pointer-events: none;
}

/* ── Nome sobreposto ──────────────────────────────────────────────────────── */
.foto-nome {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
    color: #fff;
    font-size: 0.58rem;
    padding: 10px 18px 2px 3px;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Checkbox de seleção ──────────────────────────────────────────────────── */
.foto-checkbox {
    position: absolute;
    bottom: 3px;
    left: 3px;
    z-index: 4;
    width: 13px;
    height: 13px;
    cursor: pointer;
    accent-color: #ffc107;
}

/* ── Botão remover (×) ────────────────────────────────────────────────────── */
.btn-remover {
    position: absolute;
    top: 1px;
    right: 1px;
    background: rgba(220, 53, 69, 0.85);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 15px;
    height: 15px;
    font-size: 8px;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remover:hover {
    background: rgba(185, 28, 28, 0.95);
}

/* ── Coluna central: preview ──────────────────────────────────────────────── */
.foto-preview-container {
    flex: 1;
    position: relative;
    background-color: #0d0d0d;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    min-height: 660px;
    overflow: hidden;
}

.foto-preview-topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: rgba(0,0,0,0.65);
    padding: 6px 12px;
    flex-shrink: 0;
    color: #fff;
}

.foto-zoom-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.zoom-label {
    font-size: 0.8rem;
    color: #e0e0e0;
    min-width: 42px;
    text-align: center;
}

.foto-preview-scroll {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    scrollbar-width: thin;
    scrollbar-color: #555 transparent;
}

.foto-preview-grande {
    cursor: zoom-in;
    display: block;
    border-radius: 3px;
    max-width: none; /* permite ultrapassar container quando zoom > 1 */
}

.foto-preview-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 0.9rem;
    padding: 24px;
}

/* ── LIGHTBOX ─────────────────────────────────────────────────────────────── */
.lightbox-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.96);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.lightbox-image {
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-nav {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    font-size: 22px;
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    z-index: 10001;
}

.lightbox-nav:hover { background: rgba(255,255,255,0.28); }
.lightbox-prev      { left: 16px; }
.lightbox-next      { right: 16px; }

.lightbox-footer {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    padding: 7px 18px;
    border-radius: 20px;
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 0.85rem;
    white-space: nowrap;
    z-index: 10001;
}

/* ── Navegação do viewer central ─────────────────────────────────────────── */
.viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    width: 42px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    z-index: 5;
    border-radius: 6px;
}

.viewer-nav:hover { background: rgba(0, 0, 0, 0.85); }
.viewer-nav-prev  { left: 12px; }
.viewer-nav-next  { right: 12px; }

/* ── Rubber-band selection box ───────────────────────────────────────────── */
.rubber-band-box {
    background: rgba(78, 201, 176, 0.15);
    border: 1px dashed var(--bs-link-color, #4ec9b0);
    pointer-events: none;
    z-index: 9999;
}

/* ── Mobile ──────────────────────────────────────────────────────────── */
@media (max-width: 767.98px) {
    .tab-fotos-container {
        flex-direction: column;
        min-height: 0;
        gap: 12px;
        padding: 8px;
    }

    /* hide the big centre preview — lightbox handles full-screen viewing */
    .foto-preview-container {
        display: none !important;
    }

    .fotos-coluna {
        width: 100%;
        flex-shrink: unset;
        min-height: 0;
    }

    .fotos-thumbs-grid {
        max-height: 55vh;
        grid-template-columns: repeat(3, 1fr);
    }

    /* lightbox nav buttons easier to tap on mobile */
    .lightbox-nav {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .lightbox-prev { left: 8px; }
    .lightbox-next { right: 8px; }

    .lightbox-footer {
        font-size: 0.78rem;
        padding: 5px 12px;
        gap: 10px;
        bottom: 10px;
    }
}
