/* ================================================================
   LAYOUT.CSS — VISUAL MODERNO (Cor Suave Azul‑Cinzento)
   Aplicação: Desktop + Mobile
   ---------------------------------------------------------------
   Paleta base:
   - Primário suave: #4C7DA6
   - Primário claro: #6FA3C5
   - Cinzas neutros: #f5f7fa, #e3e8ef, #c0c7d4
   - Texto: #1f2d3d
================================================================ */

/* ==== RESET ==================================================== */
.hidden {
    display: none !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Arial, sans-serif;
    background: #f5f7fa;
    color: #1f2d3d;
    line-height: 1.4;
}

/* ==== NAVBAR =================================================== */

.navbar {
    width: 100%;
    height: 58px;
    background: #4C7DA6;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 20;
}

.navbar .left,
.navbar .right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar .logo img {
    height: 40px;
    object-fit: contain;
}

/* ==== HAMBURGER (APENAS ICONE) ================================ */
.hamburger {
    font-size: 24px;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
}

/* ==== SEARCH =================================================== */
.search {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    padding: 3px 6px;
}

.search input {
    border: none;
    outline: none;
    background: transparent;
    color: white;
    width: 160px;
}

.search button {
    background: transparent;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
}

/* ==== BOTÕES PRINCIPAIS ======================================= */
.toggle-btn,
.unlock-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.18);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn:hover,
.unlock-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* ==== FILTER-BAR (dropdowns) ================================== */

/* Filter Bar — corrigido */
/* Filter Bar — CORREÇÃO FINAL */
.filter-bar {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap !important;
    /* <<< ESTA LINHA É ABSOLUTAMENTE CRÍTICA */
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #c6d3e1;
    background: #e9f1f7;
    position: sticky;
    top: 58px;
    /* altura da navbar */
    z-index: 19;
}

.filter-bar.hidden {
    display: none;
}

.filter-label {
    font-weight: 600;
    color: #2f4154;
}

.dd {
    position: relative;
}

.dropBtn {
    background: #4C7DA6;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
}

.dropBtn:hover {
    background: #6FA3C5;
}

.dropdown {
    position: absolute;
    top: 38px;
    width: 180px;
    background: white;
    border: 1px solid #cbd5e1;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    z-index: 50;
}


.dropdown.hidden {
    display: none;
}

.dropdown .item {
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.dropdown .item:hover {
    background: #e3e8ef;
}

.dropdown {
    position: absolute;
    top: 38px;
    left: 0;
    width: 180px;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 0;
    display: none;
    /* por defeito */
    z-index: 999;
}

.dropdown:not(.hidden) {
    display: block;
}

/* ==== FILTERS CHIPS PANEL ===================================== */

.filters-sticky {
    width: 100%;
    background: #f7f9fc;
    padding: 8px 12px;
    border-bottom: 1px solid #d0d4dc;
}

.filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filters.hidden {
    display: none;
}

.filter-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-title {
    font-weight: 600;
    color: #2f4154;
}

.chip-btn {
    padding: 6px 10px;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 16px;
    cursor: pointer;
    transition: 0.2s;
}

.chip-btn:hover {
    background: #cdd6df;
}

.chip-btn.active {
    background: #4C7DA6;
    color: white;
    border-color: #4C7DA6;
}

/* ==== BANNER =================================================== */

/* ============================================
   CORREÇÃO: Banner deve mostrar imagem completa
   ============================================ */
#banner {
    width: 100%;
    padding: 0;
    margin: 0;
    overflow: visible !important;
    /* deixa a imagem crescer */
}

#banner img {
    width: 100%;
    /* ajustar na largura */
    height: auto !important;
    /* manter proporção vertical */
    object-fit: contain !important;
    /* nunca cortar */
    display: block;
    /* remove espaços esquisitos */
}

#banner figcaption {
    margin-top: 6px;
    font-size: 14px;
    color: #4b5563;
}

/* ==== MASONRY / GALERIA ======================================== */

.masonry {
    width: 100%;
    display: flex;
    gap: 16px;
    padding: 12px;
}

.column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.thumb {
    width: 100%;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.thumb:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.18);
}

/* ==== LOAD MORE ================================================= */

.load-btn {
    display: block;
    margin: 14px auto;
    padding: 8px 18px;
    background: #4C7DA6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
}

.load-btn:hover {
    background: #6FA3C5;
}

/* ==== ZOOM ====================================================== */

#zoomModal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

#zoomModal.hidden {
    display: none;
}

#zoomImg {
    max-width: 88%;
    max-height: 88%;
    border-radius: 6px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.nav {
    position: absolute;
    top: 50%;
    color: white;
    font-size: 48px;
    cursor: pointer;
    padding: 8px;
}

.prev {
    left: 20px;
}

.next {
    right: 20px;
}

.close {
    position: absolute;
    top: 20px;
    right: 24px;
    font-size: 36px;
    cursor: pointer;
    color: white;
}

/* ==== LOGIN MODAL =============================================== */

#loginModal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 250;
}

#loginModal.hidden {
    display: none;
}

#loginModal .modal-box {
    background: white;
    padding: 24px;
    width: 320px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#loginModal input {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
}

#loginError {
    color: #b91c1c;
    font-size: 14px;
}

/* ==== FOOTER ==================================================== */

.footer {
    width: 100%;
    padding: 12px;
    background: #e9eff5;
    color: #334155;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.dd {
    position: relative;
    flex-shrink: 0;
    /* garante que não colapsam */
}

.dropdown {
    position: absolute;
    left: 0;
    width: 180px;
}

/* HAMBURGER — esconder em PC */
.hamburger {
    display: none;
}

@media (max-width: 700px) {

    /* HAMBURGER — mostrar só no mobile */
    .hamburger {
        display: block;
        font-size: 26px;
        background: none;
        border: none;
        color: white;
        cursor: pointer;
    }
}

/* PC (>= 701px) */
.hamburger {
    display: none !important;
}

.navbar .right {
    display: flex !important;
    /* Slideshow / Info / Acesso */
}

/* Modal INFO (corrigir visibilidade e empilhamento) */
.modalAdvice {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    /* acima de tudo */
}

.modalAdvice.hidden {
    display: none !important;
}

.modalAdvice .modal-box {
    width: min(92vw, 560px);
    max-height: 80vh;
    overflow: auto;
    background: #fff;
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.modalAdvice .btns {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 12px;
}

.modalAdvice .btns button {
    background: #4C7DA6;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
}

.modalAdvice .btns button:hover {
    background: #6FA3C5;
}

/* Modal LOGIN (estrutura e botões visíveis) */
#loginModal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

#loginModal.hidden {
    display: none !important;
}

#loginModal .modal-box {
    width: min(92vw, 420px);
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

#loginModal input {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    margin-bottom: 10px;
}

#loginModal .btns {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}

#loginModal .btns .unlock-btn {
    background: #4C7DA6;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
}

#loginModal .btns .unlock-btn:hover {
    background: #6FA3C5;
}

#loginModal .btns .toggle-btn {
    background: #e2e8f0;
    color: #1f2d3d;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
}

#loginModal .btns .toggle-btn:hover {
    background: #cdd6df;
}

#loginError {
    color: #b91c1c;
    font-size: 14px;
}

/* ==== ZOOM (centragem horizontal e vertical) ================== */
#zoomModal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    /* centrar via Flexbox */
    align-items: center;
    /* centro vertical */
    justify-content: center;
    /* centro horizontal */
    z-index: 2000;
    /* acima de tudo o resto */
}

#zoomModal.hidden {
    display: none !important;
}

/* A própria imagem: bloquear “alinhamento à esquerda” */
#zoomImg,
#zoomModal .zoomed {
    display: block;
    /* evita comportamento inline */
    max-width: 88vw;
    /* não sair da viewport horizontal */
    max-height: 88vh;
    /* não sair da viewport vertical */
    margin: 0;
    /* não usar margens herdadas */
}

/* Botões de navegação continuam absolutos, não quebram o layout */
#zoomModal .nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 48px;
    cursor: pointer;
    padding: 8px;
    user-select: none;
}

#zoomModal .nav.prev {
    left: 20px;
}

#zoomModal .nav.next {
    right: 20px;
}

/* Botão fechar */
#zoomModal .close {
    position: absolute;
    top: 20px;
    right: 24px;
    font-size: 36px;
    color: #fff;
    cursor: pointer;
}

/* Legenda centrada e largura controlada */
#zoomCaption {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 90vw;
    color: #e5e7eb;
    text-align: center;
    font-size: 14px;
    line-height: 1.35;
}

/* ================================
   DESKTOP PHOTO GRID WITH MARGINS
   20% | 60% area (3 columns) | 20%
   ================================ */
@media screen and (min-width: 1024px) {
    #gallery {
        width: 60%;
        margin-left: 20%;
        margin-right: 20%;
    }
}

/* ================================
   Legenda "on hover" no rodapé
   ================================ */

.thumb-wrap {
    position: relative;
    display: block;
    overflow: hidden;
    /* evita bleed de efeitos */
}

.thumb-wrap .thumb {
    display: block;
    width: 100%;
    height: auto;
}

/* Overlay da legenda */
.thumb-wrap .thumb-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;

    /* Visual */
    background: linear-gradient(transparent, rgba(0, 0, 0, .65));
    color: #fff;
    padding: 8px 10px;

    /* Tipografia */
    font-size: 0.9rem;
    line-height: 1.2;

    /* Interação */
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .18s ease-out, transform .18s ease-out;

    /* Evitar selecção de texto acidental */
    user-select: none;
    pointer-events: none;
    /* deixa cliques irem para a imagem (zoom) */
}

/* Efeito "on mouse over": mostra a legenda */
.thumb-wrap:hover .thumb-caption {
    opacity: 1;
    transform: translateY(0);
}

/* Com suporte a touch (mobile): mostrar sempre a legenda se quiseres
   Mas como pediste "não alterar mobile", deixamos desligado.
   Se um dia quiseres ligar só no touch, podes usar:
@media (hover: none) and (pointer: coarse) {
  .thumb-wrap .thumb-caption { opacity: 1; transform: none; }
}
*/
.thumb-wrap .thumb-caption {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    /* máx. 2 linhas */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

#zoomImg {
    width: 88vw;
    /* ocupa sempre o mesmo espaço */
    height: 88vh;
    object-fit: contain;
}

#zoomImg.blur {
    filter: blur(20px);
}

#zoomImg {
    transition: opacity .25s ease, filter .4s ease;
}