/**
 * Poços Já Galeria v1.7.3
 * - Desktop: Viewer inline no post
 * - Mobile: Fullscreen estilo Instagram com dots
 * - Fundo cinza claro, título maior, legenda maior
 */

:root {
    --pj-azul: #003482;
    --pj-preto: #111111;
    --pj-cinza-escuro: #333333;
    --pj-cinza-medio: #777777;
    --pj-cinza-claro: #E5E5E5;
    --pj-cinza-fundo: #F0F0F0;
    --pj-branco: #FFFFFF;
    --pj-font: 'Open Sans', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    --pj-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --pj-transition: 0.2s ease;
}

/* ==========================================================================
   CONTAINER PRINCIPAL
   ========================================================================== */

.pocosja-galeria {
    margin: 1.5rem 0;
    font-family: var(--pj-font);
    max-width: 100%;
}

/* ==========================================================================
   CARD (Apenas Mobile)
   ========================================================================== */

.pocosja-galeria-card {
    display: none;
    background: var(--pj-branco);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: var(--pj-shadow);
}

.pocosja-galeria-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--pj-cinza-claro);
}

.pocosja-galeria-card__titulo {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--pj-preto);
    line-height: 1.3;
    flex: 1;
}

.pocosja-galeria-card__compartilhar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--pj-cinza-medio);
    cursor: pointer;
    border-radius: 50%;
}

.pocosja-galeria-card__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 4px;
}

.pocosja-galeria-card__foto {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: var(--pj-cinza-fundo);
}

.pocosja-galeria-card__foto img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pocosja-galeria-card__foto--principal { aspect-ratio: 16 / 10; }

.pocosja-galeria-card__secundarias {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}

.pocosja-galeria-card__foto--secundaria { aspect-ratio: 4 / 3; }

.pocosja-galeria-card__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
}

.pocosja-galeria-card__mais {
    font-size: 16px;
    font-weight: 600;
    color: var(--pj-branco);
}

/* ==========================================================================
   VIEWER INLINE (Desktop)
   ========================================================================== */

.pocosja-viewer-inline {
    display: block;
    background: var(--pj-branco);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: var(--pj-shadow);
}

.pocosja-viewer-inline__container {
    display: flex;
    flex-direction: column;
}

.pocosja-viewer-inline__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--pj-cinza-fundo);
    border-bottom: 1px solid var(--pj-cinza-claro);
    min-height: 44px;
}

.pocosja-viewer-inline__header-left,
.pocosja-viewer-inline__header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pocosja-viewer-inline__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--pj-cinza-escuro);
    cursor: pointer;
    border-radius: 4px;
    transition: background var(--pj-transition);
}

.pocosja-viewer-inline__btn:hover { background: var(--pj-cinza-claro); }

.pocosja-viewer-inline__contador {
    font-size: 13px;
    color: var(--pj-cinza-escuro);
}

.pocosja-viewer-inline__titulo {
    font-size: 14px;
    font-weight: 600;
    color: var(--pj-preto);
    text-align: center;
    flex: 1;
    padding: 0 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pocosja-viewer-inline__main {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pj-branco);
    min-height: 350px;
}

.pocosja-viewer-inline__imagem-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 50px;
    width: 100%;
}

.pocosja-viewer-inline__imagem {
    max-width: 100%;
    max-height: 450px;
    object-fit: contain;
    user-select: none;
}

.pocosja-viewer-inline__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 60px;
    padding: 0;
    border: none;
    background: rgba(0,0,0,0.03);
    color: var(--pj-cinza-medio);
    cursor: pointer;
    transition: background var(--pj-transition), color var(--pj-transition);
    z-index: 10;
}

.pocosja-viewer-inline__nav--anterior { left: 0; border-radius: 0 4px 4px 0; }
.pocosja-viewer-inline__nav--proxima { right: 0; border-radius: 4px 0 0 4px; }
.pocosja-viewer-inline__nav:hover { background: rgba(0,0,0,0.08); color: var(--pj-preto); }

.pocosja-viewer-inline__footer {
    padding: 12px 16px;
    background: var(--pj-branco);
    border-top: 1px solid var(--pj-cinza-claro);
    min-height: 50px;
}

.pocosja-viewer-inline__legenda {
    margin: 0 0 2px 0;
    font-size: 14px;
    font-weight: 400;
    font-style: italic;
    color: var(--pj-cinza-escuro);
    line-height: 1.4;
}

.pocosja-viewer-inline__credito {
    font-size: 13px;
    font-style: italic;
    color: var(--pj-cinza-medio);
}

/* ==========================================================================
   VIEWER FULLSCREEN
   ========================================================================== */

.pocosja-viewer-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    background: var(--pj-cinza-fundo);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.pocosja-viewer-fullscreen[hidden] { display: none; }

.pocosja-viewer-fullscreen.pocosja-viewer-fullscreen--ativo {
    opacity: 1;
    visibility: visible;
}

.pocosja-viewer-fullscreen__container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header Azul - Base */
.pocosja-viewer-fullscreen__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--pj-azul);
    color: var(--pj-branco);
    min-height: 64px;
    flex-shrink: 0;
}

/* Desktop Header - visível apenas no desktop */
.pocosja-viewer-fullscreen__header--desktop {
    display: flex;
}

/* Mobile Header - oculto por padrão */
.pocosja-viewer-fullscreen__header--mobile {
    display: none;
}

.pocosja-viewer-fullscreen__header-left,
.pocosja-viewer-fullscreen__header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.pocosja-viewer-fullscreen__header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.pocosja-viewer-fullscreen__logo {
    height: 40px;
    width: auto;
    display: block;
}

.pocosja-viewer-fullscreen__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: none;
    background: rgba(255,255,255,0.1);
    color: var(--pj-branco);
    cursor: pointer;
    border-radius: 6px;
    transition: background var(--pj-transition);
}

.pocosja-viewer-fullscreen__btn:hover { background: rgba(255,255,255,0.2); }

.pocosja-viewer-fullscreen__contador {
    font-size: 16px;
    font-weight: 600;
    color: var(--pj-branco);
}

/* Título */
.pocosja-viewer-fullscreen__titulo-bar {
    padding: 20px 24px;
    background: var(--pj-cinza-fundo);
}

.pocosja-viewer-fullscreen__titulo {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--pj-preto);
    text-align: center;
}

/* Área Principal */
.pocosja-viewer-fullscreen__main {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    background: var(--pj-cinza-fundo);
    min-height: 0;
    overflow: hidden;
}

.pocosja-viewer-fullscreen__imagem-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 80px;
    width: 100%;
    height: 100%;
}

.pocosja-viewer-fullscreen__imagem {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
}

/* Contador flutuante estilo Instagram */
.pocosja-viewer-fullscreen__contador-flutuante {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--pj-branco);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 30;
}

.pocosja-viewer-fullscreen__contador-flutuante[hidden] { display: none; }

.pocosja-viewer-fullscreen__contador-flutuante--visivel {
    opacity: 1;
}

/* Navegação Desktop (setas nas laterais) */
.pocosja-viewer-fullscreen__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 100px;
    padding: 0;
    border: none;
    background: rgba(0,52,130,0.8);
    color: var(--pj-branco);
    cursor: pointer;
    transition: background var(--pj-transition);
    z-index: 10;
}

.pocosja-viewer-fullscreen__nav--anterior { left: 0; border-radius: 0 8px 8px 0; }
.pocosja-viewer-fullscreen__nav--proxima { right: 0; border-radius: 8px 0 0 8px; }
.pocosja-viewer-fullscreen__nav:hover { background: var(--pj-azul); }

/* Dots de navegação - estilo Instagram */
.pocosja-viewer-fullscreen__dots {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 16px;
    background: var(--pj-cinza-fundo);
}

.pocosja-viewer-fullscreen__dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--pj-cinza-claro);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.pocosja-viewer-fullscreen__dot--ativo {
    background: var(--pj-azul);
    transform: scale(1.2);
}

.pocosja-viewer-fullscreen__dot:hover {
    background: var(--pj-cinza-medio);
}

.pocosja-viewer-fullscreen__dots-mais {
    font-size: 12px;
    color: var(--pj-cinza-medio);
    margin-left: 4px;
}

/* Footer */
.pocosja-viewer-fullscreen__footer {
    padding: 20px 24px;
    background: var(--pj-cinza-fundo);
    text-align: center;
}

.pocosja-viewer-fullscreen__legenda {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 400;
    font-style: italic;
    color: var(--pj-cinza-escuro);
}

.pocosja-viewer-fullscreen__credito {
    font-size: 14px;
    font-style: italic;
    color: var(--pj-cinza-escuro);
}

/* ==========================================================================
   MINIATURAS
   ========================================================================== */

.pocosja-miniaturas {
    position: fixed;
    inset: 0;
    z-index: 9999999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0,0,0,0.8);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.pocosja-miniaturas[hidden] { display: none; }

.pocosja-miniaturas.pocosja-miniaturas--ativo {
    opacity: 1;
    visibility: visible;
}

.pocosja-miniaturas__container {
    width: 100%;
    max-height: 50vh;
    background: var(--pj-branco);
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
}

.pocosja-miniaturas__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--pj-cinza-claro);
}

.pocosja-miniaturas__titulo {
    font-size: 16px;
    font-weight: 600;
    color: var(--pj-preto);
}

.pocosja-miniaturas__fechar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--pj-cinza-escuro);
    cursor: pointer;
    border-radius: 50%;
}

.pocosja-miniaturas__wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
}

.pocosja-miniaturas__nav { display: none; }

.pocosja-miniaturas__lista {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    flex: 1;
}

.pocosja-miniaturas__lista::-webkit-scrollbar { display: none; }

.pocosja-miniaturas__item {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    padding: 0;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    background: var(--pj-cinza-fundo);
    transition: border-color var(--pj-transition);
}

.pocosja-miniaturas__item--ativo { border-color: var(--pj-azul); }

.pocosja-miniaturas__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ==========================================================================
   MOSAICO (Apenas Mobile)
   ========================================================================== */

.pocosja-mosaico {
    position: fixed;
    inset: 0;
    z-index: 9999999;
    display: none;
    flex-direction: column;
    background: var(--pj-branco);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.pocosja-mosaico[hidden] { display: none !important; }

.pocosja-mosaico.pocosja-mosaico--ativo {
    opacity: 1;
    visibility: visible;
}

.pocosja-mosaico__container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.pocosja-mosaico__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--pj-cinza-claro);
    flex-shrink: 0;
}

.pocosja-mosaico__titulo {
    font-size: 18px;
    font-weight: 600;
    color: var(--pj-preto);
}

.pocosja-mosaico__fechar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--pj-cinza-escuro);
    cursor: pointer;
}

.pocosja-mosaico__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    padding: 2px;
    overflow-y: auto;
    flex: 1;
}

.pocosja-mosaico__item {
    position: relative;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: none;
    border-radius: 0;
    overflow: hidden;
    cursor: pointer;
    background: var(--pj-cinza-fundo);
    width: 100%;
}

.pocosja-mosaico__item--ativo::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 3px solid var(--pj-azul);
    pointer-events: none;
}

.pocosja-mosaico__item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ==========================================================================
   MOBILE
   ========================================================================== */

@media (max-width: 767px) {
    /* Mobile: mostra card, esconde viewer inline */
    .pocosja-galeria-card { display: block; }
    .pocosja-viewer-inline { display: none !important; }
    
    /* Mosaico visível no mobile */
    .pocosja-mosaico { display: flex; }

    /* Headers: Desktop oculto, Mobile visível */
    .pocosja-viewer-fullscreen__header--desktop { display: none; }
    .pocosja-viewer-fullscreen__header--mobile { display: flex; }

    /* Header Mobile 1.5x maior */
    .pocosja-viewer-fullscreen__header--mobile {
        padding: 14px 12px;
        min-height: 84px;
    }

    .pocosja-viewer-fullscreen__header--mobile .pocosja-viewer-fullscreen__header-left {
        gap: 0;
    }

    .pocosja-viewer-fullscreen__header--mobile .pocosja-viewer-fullscreen__header-right {
        gap: 8px;
    }

    /* Logo maior à esquerda */
    .pocosja-viewer-fullscreen__header--mobile .pocosja-viewer-fullscreen__logo {
        height: 44px;
		margin-left: 10px;
    }

    /* Contador ao centro - maior */
    .pocosja-viewer-fullscreen__header--mobile .pocosja-viewer-fullscreen__contador {
        font-size: 18px;
        font-weight: 700;
    }

    /* Botões maiores */
    .pocosja-viewer-fullscreen__header--mobile .pocosja-viewer-fullscreen__btn {
        width: 48px;
        height: 48px;
    }

    /* Esconde setas desktop, mostra dots */
    .pocosja-viewer-fullscreen__nav { display: none; }
    .pocosja-viewer-fullscreen__dots { display: flex; }

    /* Área da imagem */
    .pocosja-viewer-fullscreen__imagem-wrapper {
        padding: 16px;
    }

    /* Título maior e centralizado */
    .pocosja-viewer-fullscreen__titulo-bar {
        padding: 24px 20px;
    }

    .pocosja-viewer-fullscreen__titulo {
        font-size: 26px;
        line-height: 1.3;
		font-weight: 500;
    }

    /* Footer - legenda maior, mais acima */
    .pocosja-viewer-fullscreen__footer {
        padding: 16px 20px 24px;
        text-align: left;
    }

    .pocosja-viewer-fullscreen__legenda {
        font-size: 18px;
        line-height: 1.4;
    }

    .pocosja-viewer-fullscreen__credito {
        font-size: 18px;
    }
	
	.pocosja-viewer-fullscreen__header--mobile .pocosja-viewer-fullscreen__header-center {
    display: none;
	}
}

/* ==========================================================================
   DESKTOP
   ========================================================================== */

@media (min-width: 768px) {
    .pocosja-galeria-card { display: none !important; }
    .pocosja-viewer-inline { display: block; }
    .pocosja-mosaico { display: none !important; }
    .pocosja-viewer-fullscreen__dots { display: none; }

    /* Headers: Desktop visível, Mobile oculto */
    .pocosja-viewer-fullscreen__header--desktop { display: flex; }
    .pocosja-viewer-fullscreen__header--mobile { display: none !important; }

    .pocosja-miniaturas__nav {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        padding: 0;
        border: none;
        background: var(--pj-cinza-fundo);
        color: var(--pj-cinza-escuro);
        cursor: pointer;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .pocosja-miniaturas__nav:hover { background: var(--pj-cinza-claro); }
    .pocosja-miniaturas__item { width: 80px; height: 80px; }
}

/* ==========================================================================
   ESTADOS GLOBAIS
   ========================================================================== */

body.pocosja-galeria-aberta { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
