/* ===================================================
  style_copilot.cleaned.v3.css — versão moderna e consolidada
  Compatível com o teu index.html atual (desktop + mobile)
  Jorge Sá — Look-up-Photos
=================================================== */

/* ===================================================
 0) VARIÁVEIS / TOKENS (ajuste rápido de visu)
=================================================== */
:root {
    /* Cores base */
    --color-text: #111;
    --color-primary-ink: #000;
    --color-accent: darkgrey;
    --color-brand-grey: lightgrey;
    /* fundo da navbar */
    --color-border: rgba(155, 155, 155, 0.2);
    --color-footer-bg: rgb(61, 61, 61);
    --color-zoom-overlay: rgba(0, 0, 0, 0.9);
    --color-zoom-chip: rgba(0, 0, 0, 0.6);

    /* Tipografia e ritmo */
    --fs-base: 15px;
    --lh-base: 1.6;
    --gap-xs: 6px;
    --gap-sm: 8px;
    --gap-md: 12px;
    --gap-lg: 16px;

    /* Layout */
    --nav-height: 48px;
    /* altura unificada da barra */
    --z-navbar: 1000;
    /* acima do conteúdo base */
    --z-zoom-img: 1001;
    --z-zoom-ui: 1002;
}

/* ===================================================
 1) BASE / RESET
=================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: clamp(14px, 1.6vw, 18px);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "San Francisco", "Helvetica Neue", Helvetica, Ubuntu, Roboto, Noto, "Segoe UI", Arial, sans-serif;
    font-size: var(--fs-base);
    font-weight: 400;
    line-height: var(--lh-base);
    color: var(--color-text);
    margin: 0;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ===================================================
 2) NAVBAR / MENU PRINCIPAL (desktop + mobile)
=================================================== */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: var(--z-navbar);
}

nav {
    position: relative;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--nav-bg);
    padding: 0 12px;
    white-space: nowrap;
    overflow: visible
}

/* Navigation Styles */
nav {
    display: flex;
    justify-content: center;
    background-color: #a5a5a5;
    padding: 0.5em;
}

nav a {
    color: #fff;
    text-decoration: none;
    padding: 0.5em 1em;
    margin: 0 0.5em;
    border-radius: 4px;
    transition: background-color 0.3s;
}

nav a:hover {
    background-color: #555;
}

/* Ícone hamburguer */
.menu-icon {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-size: 22px;
    user-select: none;
}

.menu-icon span {
    display: inline-block;
}

/* Logo */
.logo {
    display: inline-flex;
    align-items: center;
    height: var(--nav-height);
}

.logo img {
    height: calc(var(--nav-height) - 12px);
    width: auto;
}

/* Lista de itens (suporta <div class="nav-items"> com <li> dentro ou <ul class="nav-items">) */
.nav-items {
    display: flex;
    align-items: center;
    gap: 0;
    height: var(--nav-height);
    margin-left: 8px;
    padding: 0;
}

.nav-items li {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Links e botões com a MESMA métrica da barra */
.nav-items>li>a,
.nav-items .dropbtn {
    display: inline-flex;
    align-items: center;
    height: var(--nav-height);
    padding: 0 14px;
    line-height: 1;
    text-decoration: none;
    color: var(--color-primary-ink);

}

.nav-items>li>a:hover {
    color: var(--color-accent);
}

/* Dropdown (trigger + conteúdo) */
.dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: var(--nav-height);
}

.dropbtn {
    cursor: pointer;
    background: transparent;
    border: 0;
    font-weight: 600;
    color: inherit;

}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: #f1f1f1;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 2000;
}

.dropdown-content a {
    display: block;
    padding: 12px 16px;
    color: #000;
    text-decoration: none;

}

.dropdown-content a:hover {
    background: #ddd;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Search — compatível com #searchForm (HTML atual) e .nav-search (futuro) */
nav form,
nav form.nav-search {
    /* base coerente */
    height: calc(var(--nav-height) - 10px);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 0 6px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #ccc;
}

nav form .search-data,
nav form.nav-search .search-input {
    height: 26px;
    line-height: 26px;
    padding: 0 6px;
    font-size: 14px;
    border: none;
    outline: 0;
    min-width: 0;
}

nav form button {
    display: none;
}

/* evita “2ª lupa” do <button> interno */

/* Lupa principal (fora do form) → sempre visível no desktop e mobile */
.search-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    margin-left: 6px;
}

.cancel-icon {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-size: 18px;
}

/* ======== Desktop (>=1140px) ======== */
@media (min-width: 1140px) {
    .menu-icon {
        display: none !important;
    }

    .nav-items {
        display: flex !important;
        flex-direction: row;
        gap: 0;
    }
}

/* ======== Mobile (<=1139px) ======== */
@media (max-width: 1140px) {
    nav {
        padding: 0 10px;
    }

    .search-icon {
        display: inline-flex !important;
    }

    /* .nav-items fechado por defeito; abre com .active (JS existente) */
    .nav-items {
        display: none;
    }

    .nav-items.active {
        display: flex;
    }

    /*
    @media (max-width: 768px) {
        nav {
            flex-direction: column;
        }

        nav a {
            margin: 0.5em 0;
        }

        main {
            padding: 1em;
        }
    }
*/
    /* Caixa do menu encostada à ESQUERDA, compacta */
    .nav-items {
        position: absolute !important;
        /* top: var(--nav-height) !important;*/
        top: 32px;
        left: 0px !important;
        right: auto !important;
        width: min(260px, 92vw) !important;
        height: 300px;
        flex-direction: column !important;
        background: #cecece !important;
        padding: 8px 0;
        border-radius: 10px;
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
        z-index: calc(var(--z-navbar) + 10);
    }

    .nav-items>li>a,
    .nav-items .dropbtn {
        height: 44px;
        padding: 0 16px;
        color: #fff !important;
    }

    .dropdown-content {
        position: static !important;
        background: #757575 !important;
        border: none !important;
        width: 100%;
        padding: 6px 0;
    }

    .dropdown-content a {
        color: #fff !important;
        padding: 10px 16px;
    }

    /* "Close Menu" (assume ser o último <li>) */
    .nav-items>li:last-child {
        background: #333 !important;
        color: #fff !important;
        font-weight: 700;
        border-top: 1px solid #999;
    }

    .nav-items>li:last-child a {
        color: #fff !important;
    }
}

/* Ajustes finos de espaçamentos por largura */
@media (max-width: 980px) {

    .menu-icon,
    .cancel-icon,
    .search-icon {
        margin: 0 12px;
    }
}

@media (max-width: 350px) {

    .menu-icon,
    .cancel-icon,
    .search-icon {
        margin: 0 8px;
    }
}

/* ===================================================
 3) MENUS DE FILTRO (ANO / CONTEÚDO)
=================================================== */
.scrollmenu {
    overflow: auto;
    width: 99%;
    white-space: nowrap;
    text-align: center;
    background: linear-gradient(90deg, rgba(160, 160, 160, 1) 0%, #fff 10%, #fff 90%, rgba(160, 160, 160, 1) 100%);
}

.scrollmenu button {
    display: inline-block;
    cursor: pointer;
}

button.btn {
    /* background: transparent;*/
    background-color: #b8b8b8;
}

/* ===================================================
 4) IMAGEM PRINCIPAL
=================================================== */
.mainContainer {
    margin-top: calc(var(--nav-height) + 80px);
    background: rgb(230, 230, 230);
    text-align: center;
}

#mainFigCaption {
    background-color: gainsboro;
    font-size: 1.1em;
    text-align: center;
    box-shadow: inset 0 -10px 10px rgba(0, 0, 0, 0.1), 0 0 0 2px #fff, 0.3em 0.3em 1em rgba(0, 0, 0, 0.5);
}

/* ===================================================
 5) GALERIA – COLUNAS DE FOTOS
=================================================== */
.row {
    padding-left: 10%;
}

.column {
    float: left;
    width: 30%;
    text-align: center;
}

.column img,
.column figcaption {
    margin-left: auto;
    margin-right: auto;
}

.row .column img:hover {
    cursor: zoom-in;
}

/* ===================================================
 6) ZOOM / MODAL DE IMAGEM
=================================================== */
.zoomCaption {
    position: fixed;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    z-index: var(--z-zoom-ui);
    background: var(--color-zoom-chip);
    color: #fff;
    padding: 6px 12px;
    border-radius: 12px;
    max-width: 90vw;
    text-align: center;
    white-space: normal;
    pointer-events: none;
}

#zoomCaption {
    color: inherit;
    font-weight: 600;
    line-height: 1.35;
    white-space: normal;
}

#divModal {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--color-zoom-overlay);
    z-index: calc(var(--z-zoom-ui) - 2);
    align-items: center;
    justify-content: center;
    overflow: hidden;
    isolation: isolate;
}

#zoom {
    max-width: 100vw;
    max-height: calc(100vh - 10px);
    object-fit: contain;
    cursor: grab;
    position: relative;
    z-index: calc(var(--z-zoom-ui) - 1);
    transform-origin: center center;
}

.exitZoom,
.scrolLeft,
.scrolRight {
    position: fixed;
    z-index: var(--z-zoom-ui);
    pointer-events: auto;
    display: flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    background-color: rgba(235, 232, 232, 0.6) !important;
    color: #fff;
    border-radius: 12px;
}

.exitZoom {
    top: 16px;
    right: 16px;
}

.scrolLeft {
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
}

.scrolRight {
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
}

.exitZoom span,
.scrolLeft span,
.scrolRight span {
    display: block;
    line-height: 1.2;
    font-size: 36px;
    user-select: none;
}

.zoom-btn {
    border-radius: 999px;
}

/* ===================================================
 7) MODAL CONTENT (Login / Password)
=================================================== */
.modal-content {
    background-color: #fefefe;
    transform: translate(-50%, -50%);
    width: 50%;
    position: absolute;
    border-radius: 20px;
    border: 2px solid #304710;
    top: 30%;
    left: 50%;
    opacity: 1;
    z-index: 1001;
}

.close {
    color: #474747f6;
    float: right;
    font-size: 12px;
    font-weight: bold;
    background-color: #d8d8d8;
}

.close:hover,
.close:focus {
    color: #f1efef;
    text-decoration: none;
    cursor: pointer;
}


/* ===================================================
 8) GALERIA — IMAGENS E LEGENDAS
=================================================== */
.photo-img {
    display: block;
    width: 96%;
    margin: 20px auto 0;
}

.photo-caption {
    display: block;
    width: 96%;
    margin: 4px auto 12px;
    padding: 4px 6px;
    background-color: gainsboro;
    font-size: 10px;
    text-align: center;
    box-shadow: inset 0 -10px 10px rgba(0, 0, 0, 0.1), 0 0 0 2px #fff, 0.3em 0.3em 1em rgba(0, 0, 0, 0.5);
}

/* ===================================================
 9) FOOTER
=================================================== */
.footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    background-color: var(--color-footer-bg);
    color: #fff;
    text-align: center;
    font-size: 1.05rem;
}

header,
footer {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 1em 0;
}

header h1,
footer p {
    margin: 0;
}

/* ===================================================
 10) DROPDOWN — GENÉRICO (fora da navbar se necessário)
=================================================== */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    background-color: var(--color-brand-grey);
    border: none;
    cursor: pointer;
}

.dropdown-content {
    z-index: 1000;
}

/* ===================================================
 11) MODAL ADVICE / COPYRIGHT
=================================================== */
.modalAdvice {
    display: none;
    position: fixed;
    background: rgb(201, 201, 201);
    width: 60%;
    height: 70%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    overflow: auto;
    font-size: 1.05rem;
}

.columnAdv {
    float: left;
    text-align: center;
}

/* ===================================================
 12) UTILITÁRIOS
=================================================== */
.active {
    color: darkgreen;
    font-weight: bold;
    text-shadow: 2px 2px 2px grey;
}

.block {
    display: block;
    width: 100%;
    border: none;
    background-color: rgb(85, 179, 85);
    color: #fff;
    padding: 14px 28px;
    font-size: 16px;
    cursor: pointer;
    text-align: center;
}

.block:hover {
    background-color: #ddd;
    color: #000;
}

/* ===================================================
 13) TIPOGRAFIA / AJUSTES DE TEXTO
=================================================== */
.fntSize {
    font-size: 0.9rem;
    line-height: 1.35;
}

#zoomCaption,
#mainFigCaption {
    line-height: 1.35;
    word-wrap: break-word;
}

/* ===================================================
 14) ADVERTISING
=================================================== */
.advertising-content {
    padding: 24px;
    font-size: 14px;
    line-height: 1.6;
    color: #222;
    white-space: normal;
}

.advertising-content h3 {
    margin-top: 24px;
}

.advertising-content hr {
    margin: 20px 0;
}

.advertising-langbar {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.85);
    padding: 8px 12px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.langbtn {
    padding: 6px 10px;
    border: 1px solid #aaa;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

.langbtn:hover {
    background: #f0f0f0;
}

.langbtn:last-child {
    font-weight: 700;
}

/* Main Content Styles */
main {
    padding: 2em;
    max-width: 1200px;
    margin: 0 auto;
}

section {
    margin-bottom: 2em;
}

h2 {
    border-bottom: 2px solid #333;
    padding-bottom: 0.5em;
}

/* Button Styles */
button {
    background-color: #333;
    color: #5a5a5a;
    border: none;
    padding: 0.5em 1em;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #555;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

/* ===========================
   SEARCH "LUPA INSIDE" (FINAL)
   =========================== */

/* 1) O form passa a ser o contentor do input + botão "dentro" */
nav .nav-search {
    position: relative;
    /* ancora o botão interno */
    display: inline-block;
    /* evita esticar além do necessário */
    margin-left: auto;
    /* mantém à direita da NAV */
    height: 32px;
    /* altura coerente */
    padding: 0;
    /* o padding passará para o input */
    background: transparent;
    /* fundo visual será o do input */
    border: none;
    /* remove a borda do form */
}

/* 2) O input ganha "moldura" e espaço para o botão por dentro (à direita) */
nav .nav-search .search-input {
    display: block;
    height: 32px;
    line-height: 32px;
    padding: 0 36px 0 10px;
    /* <-- 36px de espaço para a lupa */
    min-width: 160px;
    /* largura base (ajusta se quiseres) */
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 18px;
    /* pill look; troca p/ 6px se preferires */
    background: #fff;
    color: #222;
    outline: 0;
}

/* 3) O botão da lupa fica POSICIONADO DENTRO do input (canto direito) */
nav .nav-search .search-btn {
    position: absolute;
    top: 50%;
    right: 6px;
    /* encostado à borda interna do input */
    transform: translateY(-50%);
    height: 26px;
    width: 26px;
    border: none;
    border-radius: 50%;
    background: transparent;
    /* ícone “flutuado” sobre o input */
    color: #777;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

/* Ícone ligeiramente menor para ficar elegante dentro do input */
nav .nav-search .search-btn .fa {
    font-size: 14px;
    line-height: 1;
}

/* 4) Opcional: esconde a lupa externa da NAV para não haver duplicação */
nav .search-icon {
    display: none !important;
}

/* --- Versão mobile: input um pouco mais compacto --- */
@media (max-width: 1140px) {
    nav .nav-search .search-input {
        min-width: 130px;
        /* podes baixar p/ 110–120 se necessário */
        padding-right: 34px;
        /* acompanha o botão */
    }
}

/* ================================
   ZOOM CONTROLS — TOP BAR (MOBILE)
   ================================ */
@media (max-width: 1140px) {

    /* Botões ficam no topo do ecrã (acima da imagem) */
    .exitZoom,
    .scrolLeft,
    .scrolRight {
        top: 8px !important;
        /* linha superior */
        transform: none !important;
        /* remove translateY(-50%) do CSS atual */
        background-color: rgba(0, 0, 0, .45) !important;
        /* chip mais discreto e legível */
        width: 40px;
        height: 40px;
        /* ligeiramente menor para mobile */
        border-radius: 10px;
        z-index: 3000;
        /* sobe acima de qualquer overlay */
    }

    /* « esquerda */
    .scrolLeft {
        left: 12px !important;
    }

    /* X centrado */
    .exitZoom {
        left: 50% !important;
        transform: translateX(-50%) !important;
        /* centrar horizontalmente */
    }

    /* » direita */
    .scrolRight {
        right: 12px !important;
    }

    /* Ícones mais contidos visualmente */
    .exitZoom span,
    .scrolLeft span,
    .scrolRight span {
        font-size: 22px !important;
        /* redução ajuda a não "invadir" a foto */
        line-height: 1;
        user-select: none;
    }
}

@media (max-width: 1140px) {

    /* cria uma “linha guia” transparente na parte superior */
    #divModal::before {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        /* altura da “barra” */
        background: linear-gradient(to bottom, rgba(182, 181, 181, 0.35), rgba(180, 180, 180, 0));
        z-index: 2999;
        /* abaixo dos botões (3000), acima da imagem */
        pointer-events: none;
    }
}