/* =========================================
   RESET GLOBALE
   ========================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
    scroll-behavior: smooth;
    scroll-padding-top: 160px;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

html::-webkit-scrollbar {
    display: none;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    position: relative;
    font-family: var(--font-body);
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

body::-webkit-scrollbar {
    display: none;
}

/* =========================================
   0. DESIGN TOKENS
   ========================================= */
:root {
    --font-display: "Space Grotesk", "Work Sans", sans-serif;
    --font-body: "Work Sans", "Space Grotesk", sans-serif;
    --color-primary: #1f9d55;
    --color-primary-dark: #137a42;
    --color-primary-glow: rgba(31, 157, 85, 0.28);
    --color-accent: #f2a43a;
    --color-accent-soft: rgba(242, 164, 58, 0.2);
    --color-bg: #f6f2ea;
    --color-surface: rgba(255, 255, 255, 0.7);
    --color-text-dark: #19262d;
    --color-text-gray: #5f6a72;
    --color-text-light: #fdfcf8;
    --header-bg: rgba(255, 255, 255, 0.78);
    --header-border: rgba(25, 38, 45, 0.08);
    --settings-bg: rgba(255, 255, 255, 0.55);
    --settings-hover: rgba(255, 255, 255, 0.9);
    --dropdown-bg: rgba(255, 255, 255, 0.96);
    --dropdown-border: rgba(25, 38, 45, 0.08);
    --icon-color: #45525b;
    --icon-hover-bg: #e3efe7;
    --divider-color: #d6ddd8;
    --card-bg: rgba(255, 255, 255, 0.92);
    --card-bg-hover: #ffffff;
    --card-border: rgba(25, 38, 45, 0.1);
    --footer-bg: #eef3ef;
    --footer-text: #47525b;
    --footer-title: #172126;
    --footer-icon-bg: #ffffff;
    --radius-sm: 14px;
    --radius-md: 22px;
    --radius-lg: 32px;
    --radius-pill: 999px;
    --shadow-sm: 0 12px 30px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 18px 40px rgba(15, 23, 42, 0.12);
    --shadow-lg: 0 28px 70px rgba(15, 23, 42, 0.18);
    --shadow-green: 0 12px 30px var(--color-primary-glow);
    --transition-base: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    --easing-out: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
    --color-bg: #0a1128;
    --color-surface: rgba(15, 23, 42, 0.7);
    --color-text-dark: #f5f5f7;
    --color-text-gray: #a1a1a6;
    --header-bg: rgba(15, 23, 42, 0.85);
    --header-border: rgba(255, 255, 255, 0.1);
    --settings-bg: rgba(30, 41, 59, 0.7);
    --settings-hover: rgba(51, 65, 85, 0.9);
    --dropdown-bg: rgba(15, 23, 42, 0.96);
    --dropdown-border: rgba(255, 255, 255, 0.12);
    --icon-color: #a1a1a6;
    --icon-hover-bg: #1e293b;
    --divider-color: #334155;
    --card-bg: rgba(30, 41, 59, 0.75);
    --card-bg-hover: #0f172a;
    --card-border: rgba(255, 255, 255, 0.1);
    --footer-bg: #000000;
    --footer-text: #a1a1a6;
    --footer-title: #f5f5f7;
    --footer-icon-bg: #1e293b;
}

body {
    background:
        radial-gradient(1200px 600px at 8% -10%, rgba(31, 157, 85, 0.18), transparent 60%),
        radial-gradient(900px 500px at 92% 0%, rgba(242, 164, 58, 0.2), transparent 60%),
        var(--color-bg);
    color: var(--color-text-dark);
    min-height: 100%;
    line-height: 1.6;
}

[data-theme="dark"] body {
    background: var(--color-bg) !important;
}

main {
    position: relative;
    z-index: 1;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}

a {
    color: inherit;
}

::selection {
    background: rgba(31, 157, 85, 0.25);
    color: var(--color-text-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    width: 0%;
    z-index: 1200;
    box-shadow: 0 6px 20px rgba(31, 157, 85, 0.35);
}

/* =========================================
   REVEAL ANIMATIONS
   ========================================= */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
    filter: blur(8px);
    transition: opacity 0.8s var(--easing-out), transform 0.8s var(--easing-out), filter 0.8s var(--easing-out);
    transition-delay: var(--reveal-delay, 0ms);
    will-change: opacity, transform, filter;
}

.reveal-on-scroll.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
}

.delay-100 {
    --reveal-delay: 100ms;
}

.delay-200 {
    --reveal-delay: 200ms;
}

.delay-300 {
    --reveal-delay: 300ms;
}

.delay-400 {
    --reveal-delay: 400ms;
}

/* Responsive adjustments for specific containers */
@media (max-width: 600px) {
    .stats-container {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
        padding: 0 16px !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }

    .stat-box {
        padding: 24px 16px !important;
    }

    .stat-number {
        font-size: 2.2rem !important;
    }

    .stat-label {
        font-size: 0.8rem !important;
        letter-spacing: 0.1em !important;
    }
}

/* =========================================
   2. HEADER & NAVIGAZIONE
   ========================================= */
header.header-principale {
    background: var(--header-bg);
    backdrop-filter: blur(26px) saturate(140%);
    -webkit-backdrop-filter: blur(26px) saturate(140%);
    border: 1px solid var(--header-border);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
    border-radius: var(--radius-pill);
    padding: 10px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    margin: 0 auto;
    width: auto;
    max-width: 1100px;
    z-index: 1000;
    transition: all 0.4s var(--easing-out);
}

header.header-principale.nav-open {
    background: var(--color-bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.logo {
    display: flex;
    align-items: center;
    font-weight: 800;
    color: var(--color-text-dark);
    text-decoration: none;
    gap: 10px;
    font-family: var(--font-display);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    flex: 1;
}

.header-logo-img {
    height: 32px;
    width: auto;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 32px;
    margin: 0;
    padding: 0;
}

nav a {
    text-decoration: none;
    color: var(--color-text-gray);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    transition: color 0.3s ease;
}

nav a:hover,
nav a.active {
    color: var(--color-primary);
}

.header-settings {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    gap: 8px;
}

.settings-trigger {
    width: 38px;
    height: 38px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--settings-bg);
    border-radius: 50%;
    border: 1px solid var(--header-border);
    color: var(--icon-color);
    cursor: pointer;
    transition: var(--transition-base);
    z-index: 2;
}

.settings-trigger:hover {
    background: var(--color-primary);
    color: white;
    transform: rotate(45deg);
}

.settings-options {
    display: flex;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.4s ease;
}

.header-settings:hover .settings-options,
.header-settings.active .settings-options {
    max-width: 150px;
    opacity: 1;
    padding-left: 8px;
    overflow: visible;
}

.setting-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--icon-color);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-base);
}

.setting-btn:hover {
    background: var(--color-primary);
    color: white;
}

.language-dropdown-wrapper {
    position: relative;
}

.language-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--dropdown-bg);
    border: 1px solid var(--dropdown-border);
    border-radius: 12px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    min-width: 70px;
}

.language-dropdown-wrapper:hover .language-dropdown {
    opacity: 1;
    visibility: visible;
}

.lang-option {
    padding: 8px 16px;
    text-decoration: none;
    color: var(--icon-color);
    text-align: center;
}

.lang-option:hover,
.lang-option.active {
    color: var(--color-primary);
    background: rgba(22, 163, 74, 0.1);
}

.settings-divider {
    width: 1px;
    height: 16px;
    background: var(--divider-color);
    margin: 0 4px;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.35rem;
    color: var(--color-text-dark);
    cursor: pointer;
}

/* =========================================
   3. BOTTONI GLOBALI E UTILITY
   ========================================= */
.neon-btn {
    text-decoration: none;
    background: linear-gradient(135deg, var(--color-primary), #2cbf6d);
    color: var(--color-text-light);
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 14px 32px;
    border-radius: var(--radius-pill);
    border: none;
    transition: var(--transition-base);
    box-shadow: var(--shadow-green);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.neon-btn:hover {
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 10px 26px var(--color-primary-glow);
}

.center-btn-wrapper {
    text-align: center;
    margin-top: 30px;
}

/* =========================================
   5. FOOTER & WIDGET ORARI
   ========================================= */
.site-footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    padding: 80px 0 30px;
    border-top: 4px solid var(--color-primary);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    gap: 40px;
    flex-wrap: wrap;
}

.footer-col {
    flex: 1;
    min-width: 260px;
}

.footer-title {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 25px;
    color: var(--footer-title);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: var(--font-display);
}

.contact-row {
    display: flex;
    align-items: center;
    margin-bottom: 18px;
    transition: var(--transition-base);
}

.contact-row:hover {
    transform: translateX(5px);
}

.icon-glow {
    width: 40px;
    height: 40px;
    background: var(--footer-icon-bg);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 15px;
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.contact-row .text,
.contact-row .text a {
    color: var(--footer-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.quick-links ul {
    list-style: none;
    padding: 0;
}

.quick-links li {
    margin-bottom: 14px;
}

.quick-links a {
    text-decoration: none;
    color: var(--footer-text);
    font-weight: 600;
    transition: var(--transition-base);
}

.quick-links a:hover {
    color: var(--color-primary);
    padding-left: 5px;
}

.hours-widget-glow {
    background: var(--footer-icon-bg);
    border-radius: var(--radius-md);
    padding: 25px;
    box-shadow: var(--shadow-md);
}

.status-badge-container {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 15px;
}

.status-badge {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.status-badge.open {
    background: rgba(22, 163, 74, 0.15);
    color: #15803d;
    border: 1px solid var(--color-primary);
}

.status-badge.closed {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
    border: 1px solid #ef4444;
}

.hours-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.hours-table td {
    padding: 10px 10px;
    border-bottom: 1px solid var(--card-border);
}

.text-right {
    text-align: right;
    font-weight: 700;
}

.today-row {
    background: rgba(22, 163, 74, 0.08);
    border-left: 4px solid var(--color-primary);
    font-weight: bold;
}

.footer-bottom-bar {
    border-top: 1px solid var(--divider-color);
    margin-top: 50px;
    padding-top: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.legal-links-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

.toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-text-gray);
    transition: color 0.3s;
}

.toggle-btn:hover {
    color: var(--color-primary);
}

/* =========================================
   6. Banner Cookie, Popup, Modali
   ========================================= */

/* --- Banner Cookie --- */
.cookie-banner {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    background: var(--header-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--header-border);
    box-shadow: 0 -18px 45px rgba(15, 23, 42, 0.18);
    padding: 20px;
    z-index: 9999;
    transition: bottom 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.cookie-banner.show {
    bottom: 0;
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.cookie-text h3 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
    color: var(--color-text-dark);
}

.cookie-text p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--color-text-gray);
    line-height: 1.5;
}

.cookie-text a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition-base);
}

.cookie-text a:hover {
    text-decoration: underline;
}

.cookie-buttons {
    display: flex;
    gap: 15px;
    flex-shrink: 0;
}

.btn-decline,
.btn-accept {
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-base);
    border: none;
}

.btn-decline {
    background: transparent;
    border: 1px solid var(--color-text-gray);
    color: var(--color-text-gray);
}

.btn-decline:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--color-text-dark);
}

.btn-accept {
    background: linear-gradient(135deg, var(--color-primary), #2cbf6d);
    color: #ffffff;
    box-shadow: 0 4px 20px var(--color-primary-glow);
}

.btn-accept:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
}

.cookie-revoke-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 2px solid rgba(0, 0, 0, 0.9);
    color: var(--color-text-dark);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    z-index: 10001;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cookie-revoke-btn i {
    font-size: 1.8rem;
    color: var(--color-primary);
    filter: drop-shadow(0 0 8px var(--color-primary-glow));
    transition: transform 0.4s ease;
}

.cookie-revoke-btn:hover {
    transform: scale(1.1) translateY(-5px);
    background: rgba(255, 255, 255, 0.25);
    border-color: var(--color-primary);
    box-shadow: 0 12px 40px 0 rgba(31, 157, 85, 0.3);
}

.cookie-revoke-btn:hover i {
    transform: rotate(15deg);
    color: var(--color-accent);
}

/* Fix per Mobile */
@media (max-width: 768px) {
    .cookie-revoke-btn {
        bottom: 20px;
        left: 20px;
        width: 50px;
        height: 50px;
        border-radius: 16px;
    }

    .cookie-revoke-btn i {
        font-size: 1.4rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto;
    }

    .reveal-on-scroll {
        opacity: 1;
        transform: none;
        filter: none;
        transition: none;
    }
}

.cookie-revoke-btn:hover {
    transform: scale(1.1);
    color: var(--color-primary);
}

/* --- Modali a Schermo Intero (Privacy & Termini) --- */
.global-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.global-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.global-modal-content {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    width: 90%;
    max-width: 650px;
    max-height: 85vh;
    border-radius: var(--radius-lg);
    padding: 40px;
    position: relative;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.global-modal-overlay.active .global-modal-content {
    transform: translateY(0) scale(1);
}

.global-close-btn {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 2rem;
    color: var(--color-text-gray);
    cursor: pointer;
    line-height: 1;
    transition: var(--transition-base);
}

.global-close-btn:hover {
    color: var(--color-text-dark);
    transform: rotate(90deg);
}

.modal-title-green,
#terms-modal-title {
    color: var(--color-primary);
    margin: 0 0 5px 0;
    font-size: 1.8rem;
    font-weight: 800;
}

.modal-subtitle {
    font-size: 0.9rem;
    color: var(--color-text-gray);
    margin-bottom: 20px;
}

.modal-h4 {
    color: var(--color-text-dark);
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.global-modal-text {
    overflow-y: auto;
    padding-right: 15px;
    margin: 10px 0 20px;
    color: var(--color-text-dark);
    line-height: 1.6;
}

.global-modal-text p {
    margin-bottom: 15px;
    font-size: 0.95rem;
}

/* Scrollbar personalizzata per le modali */
.global-modal-text::-webkit-scrollbar {
    width: 6px;
}

.global-modal-text::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.global-modal-text::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 10px;
}

.modal-submit-btn {
    align-self: flex-end;
    margin-top: 10px;
}

/* --- Popup Dati Societari --- */
.legal-wrapper {
    position: relative;
}

.content-popup {
    position: absolute;
    bottom: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-lg);
    padding: 20px;
    border-radius: var(--radius-md);
    width: max-content;
    max-width: 320px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
    backdrop-filter: blur(15px);
    text-align: left;
}

.content-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.popup-title {
    display: block;
    color: var(--color-primary);
    margin-bottom: 10px;
    font-size: 1.1rem;
    font-weight: 800;
}

.scrollable-content {
    font-size: 0.9rem;
    color: var(--color-text-gray);
    line-height: 1.5;
}

/* =========================================
   MEDIA QUERIES (RESPONSIVE PER MOBILE)
   ========================================= */
@media (max-width: 768px) {

    /* Header Responsive */
    header.header-principale {
        padding: 12px 14px;
        height: 60px;
        flex-wrap: nowrap;
        border-radius: 32px;
    }

    .logo {
        flex: 1;
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .logo-text {
        font-size: 0.75rem;
        font-weight: 700;
        line-height: 1.2;
        overflow: hidden;
        overflow: visible;
        white-space: normal;
    }

    .mobile-toggle {
        display: block;
        order: 3;
        flex-shrink: 0;
        margin-left: 8px;
    }

    .header-settings {
        order: 2;
        margin-left: 8px;
        flex-shrink: 0;
    }

    nav[aria-label="Menu Principale"] {
        display: none;
        position: absolute;
        top: calc(100% + 10px);
        left: 0;
        width: 100%;
        margin-top: 10px;
        background: var(--color-bg);
        border-radius: 24px;
        padding: 24px;
        box-shadow: var(--shadow-lg);
        border: 1px solid var(--header-border);
    }

    nav.nav-open {
        display: block;
    }

    nav ul {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    /* Footer & Elementi Popup Responsive */
    .footer-container {
        flex-direction: column;
        text-align: center;
        gap: 40px;
    }

    .contact-row {
        justify-content: center;
        flex-direction: column;
        gap: 10px;
    }

    .contact-row:hover {
        transform: translateY(-5px);
    }

    .icon-glow {
        margin-right: 0;
    }

    .quick-links ul {
        align-items: center;
    }

    .separator {
        display: none;
    }

    .legal-links-container {
        flex-direction: column;
        gap: 15px;
    }

    .cookie-content {
        flex-direction: column;
        text-align: center;
    }

    .global-modal-content {
        padding: 25px;
        width: 95%;
    }

    /* Fix Tabella Orari Mobile */
    .hours-widget-glow {
        padding: 15px 10px;
    }

    .hours-table {
        font-size: 0.85rem;
    }

    .hours-table td {
        padding: 8px 4px;
    }

    /* Fix Cookie Banner Mobile */
    .cookie-buttons {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .btn-decline,
    .btn-accept {
        width: 100%;
        padding: 14px;
        text-align: center;
    }
}