/* =========================================
   HEADER, NAVIGAZIONE, LANG SWITCHER, FOOTER
   Coordinati con il nuovo design del sito
   ========================================= */

header {
    background-color: var(--primary-color);
    color: var(--background-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    height: auto;
    padding: 0.65rem 1.5rem 0.85rem 1.5rem;
    border-bottom: 2px solid rgba(182, 123, 13, 0.55);
    box-shadow: 0 4px 16px rgba(60, 44, 28, 0.14);
    position: relative;
    z-index: 100;
}

.top-bar {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    overflow: hidden;
}

/* Navigazione */
nav {
    width: 100%;
    max-width: 1280px;
    margin: 0.25rem auto 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid rgba(253, 247, 238, 0.18);
    padding-top: 0.55rem;
}

.menu {
    display: none;
    flex-direction: column;
    list-style: none;
    gap: 10px;
    background-color: transparent;
    width: 100%;
    padding: 0.5rem 0;
    margin: 0;
}

.menu.active {
    display: flex;
}

.menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
    padding: 0.5rem 0.85rem;
    flex-shrink: 0;
    font-size: 1.85rem;
    background: none;
    border: 1px solid rgba(253, 247, 238, 0.25);
    border-radius: 6px;
    color: var(--background-color);
    cursor: pointer;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.menu-toggle:hover {
    background-color: rgba(253, 247, 238, 0.12);
    border-color: #b67b0d;
}

.menu li {
    font-size: 1.05rem;
    padding: 0 0.75rem;
}

.menu a {
    position: relative;
    display: inline-block;
    text-decoration: none;
    color: var(--background-color);
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 400;
    letter-spacing: 0.4px;
    padding: 6px 4px;
    border-radius: 0;
    background-color: transparent !important;
    transition: color 0.25s ease;
}

.menu a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0%;
    height: 2px;
    background-color: #b67b0d;
    transition: width 0.3s ease;
}

.menu a:hover,
.menu a[aria-current="page"] {
    color: #ffffff;
}

.menu a[aria-current="page"] {
    font-weight: 600;
}

.menu a:hover::after,
.menu a[aria-current="page"]::after {
    width: 100%;
}

/* Pulsante Cambio Lingua (Bianco grassetto per la lingua attiva) */
.lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding-left: 1rem;
    flex-shrink: 0;
}

.lang-separator {
    color: rgba(253, 247, 238, 0.4);
    user-select: none;
}

.lang-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 38px;
    padding: 4px 8px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
    font-size: 0.98rem;
    letter-spacing: 0.8px;
    font-family: 'Playfair Display', Georgia, serif;
    transition: color 0.25s ease, border-color 0.25s ease;
}

.lang-switcher .lang-link[data-lang-active="true"],
.lang-switcher .lang-link.active {
    color: #ffffff !important;
    font-weight: 700 !important;
    border-bottom: 2px solid #ffffff !important;
    opacity: 1 !important;
}

.lang-switcher .lang-link:not([data-lang-active="true"]):not(.active) {
    color: rgba(255, 255, 255, 0.7) !important;
    font-weight: 400 !important;
    border-bottom: none !important;
}

.lang-switcher .lang-link:hover {
    color: #ffffff !important;
}

/* Testo scorrevole */
.scrolling-text {
    overflow: hidden;
    white-space: nowrap;
    width: 100%;
    flex: 1;
    margin-left: 0.75rem;
}

.scrolling-text h2 {
    display: inline-block;
    padding-left: 100%;
    animation: scroll-left 18s linear infinite;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    font-style: normal;
    letter-spacing: 0.04em;
    line-height: 1.4;
    color: var(--background-color);
    margin: 0.35rem 0;
    -webkit-font-smoothing: antialiased;
}

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

footer {
    background-color: var(--primary-color);
    color: var(--background-color);
    text-align: center;
    padding: 1.75rem 1.25rem;
    border-top: 2px solid rgba(182, 123, 13, 0.55);
    box-shadow: 0 -4px 16px rgba(60, 44, 28, 0.08);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

footer p {
    max-width: 960px;
    margin: 0 auto;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.98rem;
    line-height: 1.75;
    letter-spacing: 0.3px;
    color: rgba(253, 247, 238, 0.92);
}

footer a {
    color: var(--background-color);
    text-decoration: none;
    border-bottom: 1px solid rgba(182, 123, 13, 0.65);
    padding-bottom: 1px;
    margin: 0 4px;
    transition: color 0.25s ease, border-color 0.25s ease;
}

footer a:hover {
    color: #ffffff;
    border-bottom-color: #ffffff;
}

/* =========================================
   DESKTOP (Menu orizzontale pulito)
   ========================================= */
@media (min-width: 1025px) {
    .menu-toggle {
        display: none;
    }

    .scrolling-text {
        margin-left: 0;
    }

    .menu {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 1.5rem;
        padding: 0;
    }

    .menu li {
        padding: 0;
    }
}

/* =========================================
   MOBILE & TABLET
   ========================================= */
@media (max-width: 1024px) {
    header {
        padding: 0.6rem 1rem;
    }

    nav {
        flex-direction: column;
        align-items: flex-start;
        border-top: none;
        padding-top: 0;
        margin-top: 0;
    }

    .menu {
        padding: 0.85rem 0.25rem;
        border-top: 1px solid rgba(253, 247, 238, 0.18);
        margin-top: 0.5rem;
        gap: 12px;
    }

    .menu li {
        padding: 0;
    }

    .menu a {
        font-size: 1.05rem;
        padding: 4px 0;
    }

    .lang-switcher {
        margin-left: 0;
        padding-left: 0;
        margin-top: 0.35rem;
    }

    .scrolling-text h2 {
        font-size: 1.15rem;
    }

    footer {
        padding: 1.5rem 1rem;
    }

    footer p {
        font-size: 0.92rem;
    }
}

@keyframes scroll-left {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* PWA Desktop Window Controls Overlay */
@media (display-mode: window-controls-overlay) {
    header {
        padding-right: env(titlebar-area-x, 0);
        -webkit-app-region: drag;
    }

    header button,
    header a,
    header nav {
        -webkit-app-region: no-drag;
    }
}

/* =========================================
   COOKIE BANNER (GDPR)
   ========================================= */

.cookie-banner {
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 1120px;
    background-color: var(--background-color);
    color: var(--text-color);
    border: 2px solid var(--primary-color);
    border-top: 4px solid #b67b0d;
    border-radius: 12px;
    box-shadow: 0 12px 35px rgba(45, 32, 18, 0.28);
    padding: 1.25rem 1.75rem;
    z-index: 99999;
    font-family: 'Playfair Display', Georgia, serif;
}

.cookie-banner-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.cookie-close-x {
    position: absolute;
    top: -8px;
    right: -10px;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--primary-color);
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s ease;
}

.cookie-close-x:hover {
    color: #b67b0d;
}

.cookie-banner-text h4 {
    font-size: 1.15rem;
    color: var(--primary-color);
    margin-bottom: 0.35rem;
}

.cookie-banner-text p {
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
    color: #333333;
}

.cookie-banner-text a {
    color: #b67b0d;
    font-weight: 600;
    text-decoration: underline;
}

.cookie-banner-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    padding-right: 1.2rem;
}

.cookie-btn {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.65rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.cookie-btn-reject {
    background-color: transparent;
    color: var(--primary-color);
    border: 1.5px solid var(--primary-color);
}

.cookie-btn-reject:hover {
    background-color: rgba(140, 111, 77, 0.1);
}

.cookie-btn-accept {
    background-color: var(--primary-color);
    color: #ffffff;
    border: 1.5px solid var(--primary-color);
}

.cookie-btn-accept:hover {
    background-color: #b67b0d;
    border-color: #b67b0d;
}

/* Link gestione cookie nel footer */
.footer-cookie-btn {
    background: none;
    border: none;
    border-bottom: 1px solid rgba(182, 123, 13, 0.65);
    color: var(--background-color);
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.98rem;
    cursor: pointer;
    padding: 0 0 1px 0;
    margin: 0 4px;
    transition: color 0.25s ease, border-color 0.25s ease;
}

.footer-cookie-btn:hover {
    color: #ffffff;
    border-bottom-color: #ffffff;
}

@media (max-width: 768px) {
    .cookie-banner {
        bottom: 10px;
        padding: 1.1rem 1.25rem;
    }

    .cookie-banner-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .cookie-banner-actions {
        flex-direction: column;
        padding-right: 0;
    }

    .cookie-btn {
        width: 100%;
        text-align: center;
    }
}