/* =========================================================================
   Viajar em Portugal – public website
   Colours taken from the logo: ocean blue, sun yellow and green.
   ========================================================================= */

:root {
    --brand: #0a5fb4;
    --brand-dark: #084a8c;
    --brand-soft: #e7f1fb;
    --green: #3f9c1f;
    --sun: #f5a300;
    --ink: #1c2633;
    --muted: #647082;
    --line: #e2e7ee;
    --ground: #f5f8fb;
    --header-h: 84px;
    --sidebar-w: 300px;
    --radius: 14px;
    --bs-link-color: var(--brand);
    --bs-link-hover-color: var(--brand-dark);
    --bs-link-color-rgb: 10, 95, 180;
    --bs-link-hover-color-rgb: 8, 74, 140;
}

html {
    scroll-padding-top: calc(var(--header-h) + 1rem);
}

/* Bootstrap's display utilities (.d-flex, .d-grid, ...) use !important, which otherwise beats the
   native [hidden] rule and leaves "hidden" elements (e.g. #resultsPager in map view) visible. */
[hidden] { display: none !important; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--ground);
    color: var(--ink);
}

.min-w-0 { min-width: 0; }
.text-brand { color: var(--brand) !important; }

.skip-link {
    position: absolute;
    top: .5rem;
    left: .5rem;
    z-index: 2000;
    background: #fff;
    padding: .5rem 1rem;
    border-radius: 8px;
}

/* ---- Buttons ------------------------------------------------------------ */

.btn-brand {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--brand-dark);
    --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--brand-dark);
    --bs-btn-active-border-color: var(--brand-dark);
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
    --bs-btn-focus-shadow-rgb: 10, 95, 180;
}

.btn-outline-brand {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--brand);
    --bs-btn-active-border-color: var(--brand);
    --bs-btn-focus-shadow-rgb: 10, 95, 180;
}

.btn-icon {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    color: var(--ink);
    font-size: 1.25rem;
}

.btn-icon:hover { background: var(--brand-soft); color: var(--brand); }

.form-check-input:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}

.form-check-input:indeterminate {
    background-color: var(--brand);
    border-color: var(--brand);
}

.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: #7fb2e6;
    box-shadow: 0 0 0 .25rem rgba(10, 95, 180, .18);
}

/* ---- Header ------------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--header-h);
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--line);
}

.brand img {
    height: 68px;
    width: auto;
    display: block;
}

.lang-switch {
    display: flex;
    gap: .25rem;
    padding: .2rem;
    background: var(--ground);
    border: 1px solid var(--line);
    border-radius: 999px;
}

.lang-flag {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .55rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    line-height: 1;
}

.lang-flag .fi {
    width: 1.35em;
    line-height: 1em;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
}

.lang-flag:hover { color: var(--ink); background: #fff; }

.lang-flag.active {
    background: #fff;
    color: var(--brand);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

@media (max-width: 575.98px) {
    :root { --header-h: 68px; }
    .brand img { height: 52px; }
    .lang-code { display: none; }
    .lang-flag { padding: .35rem; }
}

/* ---- Body: sidebar + main ------------------------------------------------ */

.site-body {
    flex: 1 0 auto;
    display: flex;
    align-items: flex-start;
}

.site-main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 3rem;
    outline: none;
}

.sidebar {
    background: #fff;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem .5rem;
}

.sidebar-title {
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0;
}

.sidebar-tools {
    padding: 0 1rem .75rem;
    border-bottom: 1px solid var(--line);
}

.sidebar-body {
    padding: .5rem 0 1.5rem;
}

@media (min-width: 992px) {
    .sidebar {
        position: sticky;
        top: var(--header-h);
        flex: 0 0 var(--sidebar-w);
        width: var(--sidebar-w);
        height: calc(100vh - var(--header-h));
        border-right: 1px solid var(--line);
        display: flex;
        flex-direction: column;
        transition: margin-left .25s ease, visibility .25s;
    }

    .sidebar-body {
        flex: 1 1 auto;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    body.sidebar-collapsed .sidebar {
        margin-left: calc(-1 * var(--sidebar-w));
        visibility: hidden;
    }
}

@media (max-width: 991.98px) {
    .sidebar.offcanvas-lg { --bs-offcanvas-width: min(var(--sidebar-w), 88vw); }
    .sidebar .offcanvas-body, .sidebar-body { overflow-y: auto; }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar { transition: none !important; }
}

/* ---- Category tree -------------------------------------------------------- */

.tree, .tree-children {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tree-children {
    margin-left: 1.15rem;
    border-left: 1px dashed var(--line);
}

.tree-row {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .75rem .2rem .5rem;
    border-radius: 8px;
    margin: 0 .5rem;
}

.tree-row:hover { background: var(--ground); }

.tree-caret, .tree-caret-spacer {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
}

.tree-caret {
    display: grid;
    place-items: center;
    border: 0;
    background: none;
    border-radius: 6px;
    color: var(--muted);
    padding: 0;
}

.tree-caret:hover { background: var(--line); color: var(--ink); }
.tree-caret .bi { transition: transform .15s ease; font-size: .8rem; }
.tree-caret[aria-expanded="true"] .bi { transform: rotate(90deg); }

.tree-check {
    flex: 0 0 auto;
    margin: 0;
    cursor: pointer;
}

.tree-label {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .3rem 0;
    cursor: pointer;
    font-size: .925rem;
    user-select: none;
}

.tree-label .bi { color: var(--brand); flex: 0 0 auto; }
.tree-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree > .tree-node > .tree-row .tree-label { font-weight: 600; }
.tree-check:checked + .tree-label, .tree-check:indeterminate + .tree-label { color: var(--brand-dark); }

.tree-count {
    flex: 0 0 auto;
    font-size: .72rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--ground);
    border-radius: 999px;
    padding: .1rem .45rem;
    min-width: 1.6rem;
    text-align: center;
}

.tree-count.is-empty { opacity: .55; }

.tree-node.is-filtered-out { display: none; }
.tree-name mark { padding: 0; background: #fff3cd; }

/* ---- Search & welcome ----------------------------------------------------- */

.search-bar {
    max-width: 860px;
    margin-bottom: 1.75rem;
}

.search-bar .input-group-text {
    background: #fff;
    color: var(--muted);
}

.search-bar .form-control { border-left: 0; }

.hero {
    position: relative;
    overflow: hidden;
    border-radius: calc(var(--radius) * 1.4);
    padding: clamp(1.5rem, 4vw, 3rem);
    color: #fff;
    background:
        radial-gradient(circle at 92% 12%, rgba(245, 163, 0, .85) 0, rgba(245, 163, 0, 0) 30%),
        linear-gradient(135deg, #084a8c 0%, var(--brand) 45%, #1597d4 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 2rem;
    align-items: center;
    margin-bottom: 2.5rem;
}

.hero h1 {
    font-size: clamp(1.75rem, 3.2vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -.02em;
}

.hero .lead { color: rgba(255, 255, 255, .92); }

.hero-cards { display: grid; gap: .85rem; }

.hero-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem 1.1rem;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: var(--radius);
    backdrop-filter: blur(4px);
}

.hero-card > .bi { font-size: 1.75rem; line-height: 1; }
.hero-card p { color: rgba(255, 255, 255, .88); }

.hero-kicker {
    display: inline-flex;
    align-items: center;
    padding: .3rem .8rem;
    margin-bottom: .85rem;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #3a2a00;
    background: var(--sun);
    border-radius: 999px;
}

@media (max-width: 991.98px) {
    .hero { grid-template-columns: 1fr; }
}

/* ---- Travel essentials ------------------------------------------------------ */

.essentials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.essential-card {
    display: flex;
    gap: .9rem;
    padding: 1rem 1.1rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.essential-icon {
    flex: 0 0 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 1.2rem;
}

.essential-title {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 .1rem;
}

.essential-value {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
}

.essential-value a { color: inherit; text-decoration: none; }
.essential-value a:hover { color: var(--brand); text-decoration: underline; }
.essential-note { font-size: .85rem; color: var(--muted); margin: .2rem 0 0; }

.essential-card.is-alert { border-color: #f3c2c2; background: #fff8f8; }
.essential-card.is-alert .essential-icon { background: #fde2e2; color: #c62828; }
.essential-card.is-alert .essential-value { color: #b71c1c; }

.section-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: .35rem;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 1rem;
}

.category-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .35rem;
    padding: 1.1rem;
    text-align: left;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.category-tile:hover, .category-tile:focus-visible {
    transform: translateY(-2px);
    border-color: #b7d3ef;
    box-shadow: 0 10px 24px -12px rgba(10, 95, 180, .35);
}

.category-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 1.3rem;
    margin-bottom: .35rem;
}

.category-tile:nth-child(3n+2) .category-icon { background: #e9f6e3; color: var(--green); }
.category-tile:nth-child(3n+3) .category-icon { background: #fff4d9; color: #b86e00; }

.category-name { font-weight: 600; line-height: 1.25; }
.category-count { font-size: .8rem; color: var(--muted); }

.event-card {
    position: relative;
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.event-date {
    flex: 0 0 56px;
    height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    line-height: 1;
}

.event-day { font-size: 1.4rem; font-weight: 800; }
.event-month { font-size: .75rem; text-transform: uppercase; font-weight: 600; margin-top: .15rem; }

/* ---- Results -------------------------------------------------------------- */

.results-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.selection-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .5rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .35rem .25rem .7rem;
    font-size: .85rem;
    background: var(--brand-soft);
    color: var(--brand-dark);
    border: 1px solid #c5dcf3;
    border-radius: 999px;
}

.chip button {
    border: 0;
    background: none;
    color: inherit;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    padding: 0;
}

.chip button:hover { background: rgba(10, 95, 180, .15); }

.results-loading {
    display: flex;
    justify-content: center;
    padding: 3rem 0;
}

.place-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.place-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    text-align: left;
    padding: 0;
    color: inherit;
    transition: transform .15s ease, box-shadow .15s ease;
}

.place-card:hover, .place-card:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -16px rgba(28, 38, 51, .35);
}

.place-image {
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, var(--brand-soft), #fff4d9);
    display: grid;
    place-items: center;
    color: var(--brand);
    font-size: 2.5rem;
    overflow: hidden;
}

.place-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.place-body { padding: 1rem 1.1rem 1.1rem; }

.place-type {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--brand);
}

.place-name { font-size: 1.05rem; font-weight: 700; margin: .2rem 0 .35rem; }
.place-description { font-size: .9rem; color: var(--muted); margin: 0; }
/* The place the visitor asked to see on the map ("View on the map"): ringed so it stands out among the other pins. */
.map-marker.is-focus { box-shadow: 0 0 0 5px rgba(255, 193, 7, .75), 0 2px 6px rgba(0, 0, 0, .3); }

.place-event { font-size: .85rem; font-weight: 600; color: var(--brand); margin-bottom: .35rem; }
.place-event.is-past { color: var(--muted); font-weight: 400; }

.place-facts {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    display: grid;
    gap: .4rem;
}

.place-facts li { display: flex; gap: .6rem; align-items: baseline; overflow-wrap: anywhere; }
.place-facts .bi { color: var(--brand); }

.map-container { position: relative; }

.map-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ground);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    z-index: 1;
    pointer-events: none;
    transition: opacity .2s ease;
}

.results-map {
    height: min(70vh, 640px);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    z-index: 0;
}

.map-marker {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    background: var(--brand);
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}

.map-marker .bi { transform: rotate(45deg); color: #fff; font-size: .95rem; }

.empty-state {
    text-align: center;
    padding: 3.5rem 1rem;
    background: #fff;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
}

.empty-state > .bi { font-size: 2.75rem; color: var(--brand); }

.pagination { --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand); --bs-pagination-color: var(--brand); }

.place-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .5rem;
    margin-bottom: 1rem;
}

.place-gallery-item {
    margin: 0;
}

.place-gallery-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}

.place-gallery-credit {
    margin-top: .25rem;
}

.place-gallery-credit a {
    color: inherit;
}

.place-description-full { white-space: pre-line; }

/* ---- Auth & content pages ------------------------------------------------- */

.auth-page {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: clamp(1.5rem, 6vh, 4rem);
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) * 1.3);
    padding: clamp(1.5rem, 4vw, 2.5rem);
    box-shadow: 0 20px 50px -30px rgba(28, 38, 51, .35);
}

.auth-icon, .content-icon {
    width: 56px;
    height: 68px;
    display: inline-grid;
    place-items: center;
    border-radius: 16px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 1.6rem;
    flex: 0 0 auto;
}

.content-page { max-width: 980px; margin: 0 auto; width: 100%; }

.content-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) * 1.3);
    padding: clamp(1.25rem, 4vw, 2.75rem);
}

.content-body h2 { font-size: 1.15rem; font-weight: 700; margin-top: 1.75rem; }
.content-body p, .content-body li { line-height: 1.7; }

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.contact-item {
    display: flex;
    gap: .85rem;
    padding: 1rem;
    border-radius: var(--radius);
    background: var(--ground);
    overflow-wrap: anywhere;
}

.contact-item > .bi { font-size: 1.4rem; color: var(--brand); }

/* ---- Footer --------------------------------------------------------------- */

.site-footer {
    flex-shrink: 0;
    background: #0c1d33;
    color: rgba(255, 255, 255, .85);
    position: relative;
    z-index: 1;
}

.footer-brand img {
    height: 64px;
    width: auto;
}

.footer-muted { color: rgba(255, 255, 255, .65); max-width: 34ch; }

.footer-title {
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #fff;
    margin-bottom: 1rem;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: .55rem;
}

.footer-links a, .footer-link-btn {
    color: rgba(255, 255, 255, .75);
    text-decoration: none;
    font-size: .925rem;
    text-align: left;
}

.footer-links a:hover, .footer-link-btn:hover { color: #fff; text-decoration: underline; }

.footer-contacts li {
    display: flex;
    gap: .6rem;
    align-items: baseline;
    overflow-wrap: anywhere;
}

.footer-contacts .bi { color: #ffc44d; }
.footer-contacts .footer-emergency { margin-top: .35rem; color: #fff; }
.footer-contacts .footer-emergency .bi { color: #ff8a80; }
.footer-contacts .footer-emergency a { color: #fff; font-weight: 700; }

.social-link {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.social-link:hover { background: var(--brand); color: #fff; }

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, .1);
    padding: 1rem 0;
    font-size: .85rem;
    color: rgba(255, 255, 255, .6);
}

/* ---- Cookie banner -------------------------------------------------------- */

.cookie-banner {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 1060;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 0;
    max-width: 1200px;
    margin: 0 auto;
    animation: cookie-in .35s ease-out;
}

@keyframes cookie-in {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .cookie-banner { animation: none; }
}

.cookie-category {
    padding: .85rem 0;
    border-bottom: 1px solid var(--line);
}

.cookie-category:last-child { border-bottom: 0; }
.cookie-category .form-check-input { width: 2.5em; height: 1.3em; flex-shrink: 0; }

/* ---- Filter toolbar (region, city, search) – same as viveremportugal ---------------- */

:root { --toolbar-h: 54px; }

.toolbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
    z-index: 1020;
}

.toolbar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
    padding-block: .6rem;
}

.toolbar-field {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.toolbar-field > .bi {
    position: absolute;
    left: .75rem;
    color: var(--muted);
    pointer-events: none;
    z-index: 1;
}

.toolbar-field .form-select,
.toolbar-field .form-control {
    padding-left: 2.1rem;
    min-width: 11rem;
    border-radius: 999px;
}

.toolbar-search { flex: 1 1 16rem; max-width: 30rem; }
.toolbar-search .form-control { width: 100%; }
.toolbar-submit { border-radius: 999px; padding-inline: 1rem; }

@media (min-width: 992px) {
    .toolbar { position: sticky; top: var(--header-h); }
    body.has-toolbar .sidebar {
        top: calc(var(--header-h) + var(--toolbar-h));
        height: calc(100vh - var(--header-h) - var(--toolbar-h));
    }
}

@media (max-width: 575.98px) {
    .toolbar-field { flex: 1 1 45%; }
    .toolbar-field .form-select, .toolbar-field .form-control { min-width: 0; width: 100%; }
    .toolbar-search { flex: 1 1 60%; max-width: none; }
}
