/* ============================================
   SERRY SRL — CSS CONDIVISO
   Questo file contiene gli stili comuni a tutte
   le pagine del sito (header, nav, footer,
   bottoni, animazioni, widget).
   ============================================ */

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

/* Variabili */
:root {
    --primary: #b08d57;
    --primary-light: #c9a876;
    --primary-dark: #96743d;
    --text-dark: #1a1a1a;
    --text-medium: #4a4a4a;
    --text-light: #6b6b6b;
    --bg-white: #ffffff;
    --bg-cream: #f8f6f2;
    --bg-warm: #f5f0e8;
    --border-light: #e8e4dc;
    --shadow-soft: 0 4px 20px rgba(0,0,0,0.06);
    --shadow-medium: 0 8px 40px rgba(0,0,0,0.08);
    --shadow-strong: 0 20px 60px rgba(0,0,0,0.12);
    --transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Base */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-dark);
    line-height: 1.7;
    background: var(--bg-white);
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 40px;
}

/* ============================================
   HEADER & NAVIGAZIONE
   ============================================ */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    z-index: 1000;
    height: 90px;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}

header.scrolled {
    height: 70px;
    box-shadow: var(--shadow-soft);
}

nav {
    height: 100%;
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.logo img {
    height: 55px;
    width: auto;
    transition: var(--transition);
}

header.scrolled .logo img {
    height: 45px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2.5rem;
}

.nav-menu a {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    transition: var(--transition);
    position: relative;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

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

.nav-menu a:hover::after,
.nav-menu a.active::after {
    width: 100%;
}

/* Dropdown */
.dropdown {
    position: relative;
    padding-bottom: 15px;
    margin-bottom: -15px;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
}

.dropdown-toggle svg {
    width: 12px;
    height: 12px;
    transition: var(--transition);
}

.dropdown:hover .dropdown-toggle svg {
    transform: rotate(180deg);
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: -20px;
    background: var(--bg-white);
    box-shadow: var(--shadow-medium);
    border-radius: 12px;
    padding: 15px 0;
    min-width: 220px;
    border: 1px solid var(--border-light);
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    display: block;
    padding: 12px 25px;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.dropdown-content a:hover {
    background: var(--bg-cream);
    color: var(--primary);
}

.dropdown-content a::after {
    display: none;
}

.nav-cta .btn {
    padding: 12px 28px;
    font-size: 0.9rem;
}

/* ============================================
   BOTTONI
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px 36px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.03em;
    transition: var(--transition);
    cursor: pointer;
    border: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.btn-outline {
    background: transparent;
    color: var(--text-dark);
    border: 2px solid var(--text-dark);
}

.btn-outline:hover {
    background: var(--text-dark);
    color: white;
}

.btn-white {
    background: white;
    color: var(--text-dark);
}

.btn-white:hover {
    background: var(--bg-cream);
    transform: translateY(-2px);
}

.btn-outline-white {
    background: transparent;
    color: white;
    border: 2px solid rgba(255,255,255,0.5);
}

.btn-outline-white:hover {
    background: white;
    color: var(--text-dark);
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    background: var(--bg-cream);
    padding: 80px 0 40px;
    border-top: 1px solid var(--border-light);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 60px;
    margin-bottom: 60px;
}

.footer-brand p {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.8;
    margin-top: 20px;
    margin-bottom: 25px;
}

.footer-brand .logo img {
    height: 50px;
}

.footer-column h4 {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 25px;
    color: var(--text-dark);
}

.footer-column a {
    display: block;
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 8px 0;
    transition: var(--transition);
}

.footer-column a:hover {
    color: var(--primary);
}

.footer-bottom {
    padding-top: 40px;
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.footer-bottom p {
    font-size: 0.88rem;
    color: var(--text-light);
    margin: 0;
    line-height: 1.6;
}

.footer-bottom a {
    color: var(--text-light);
    text-decoration: none;
}

.footer-bottom a:hover {
    color: var(--primary);
}

/* ============================================
   WHATSAPP WIDGET
   ============================================ */
.whatsapp-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    transition: var(--transition);
    z-index: 999;
}

.whatsapp-widget:hover {
    transform: scale(1.1);
}

.whatsapp-widget svg {
    width: 30px;
    height: 30px;
    fill: white;
}

/* Focus visible accessibility */
:focus-visible {
    outline: 3px solid #b08d57;
    outline-offset: 2px;
    border-radius: 2px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #b08d57;
    outline-offset: 2px;
}
/* No outline su click mouse, solo tab keyboard */
:focus:not(:focus-visible) {
    outline: none;
}

/* Exit-intent popup */
.exit-intent-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}
.exit-intent-overlay.visible {
    opacity: 1;
    visibility: visible;
}
.exit-intent-modal {
    background: white;
    border-radius: 18px;
    padding: 16px 30px 30px;
    max-width: 460px;
    width: 100%;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
    position: relative;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.96);
    transition: transform 0.25s;
    /* Reset di sicurezza per evitare ereditarietà di text-align/direction da parent */
    text-align: left;
    direction: ltr;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}
.exit-intent-modal *,
.exit-intent-modal *::before,
.exit-intent-modal *::after {
    box-sizing: border-box;
}
.exit-intent-overlay.visible .exit-intent-modal {
    transform: scale(1);
}
.exit-intent-close {
    /* Sticky in alto a destra: resta visibile anche se l'utente scrolla dentro il modal su schermi bassi */
    position: sticky;
    top: 0;
    align-self: flex-end;
    margin-right: -16px;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.7rem;
    color: #444;
    cursor: pointer;
    line-height: 1;
    transition: background 0.2s, color 0.2s;
    padding: 0;
    z-index: 5;
    flex-shrink: 0;
}
.exit-intent-close:hover {
    background: #f0ebe3;
    color: #1a1a1a;
}
.exit-intent-modal h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin: 0 0 12px 0;
    color: #1a1a1a;
    text-align: left;
    line-height: 1.25;
    padding-right: 30px; /* spazio per il bottone X */
}
.exit-intent-modal > p {
    color: #555;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 20px 0;
    text-align: left;
}
.exit-intent-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
}
.exit-intent-form input[type="text"],
.exit-intent-form input[type="email"],
.exit-intent-form input[type="tel"] {
    width: 100%;
    padding: 13px 16px;
    font-size: 0.95rem;
    border: 1.5px solid #e8e4dc;
    border-radius: 10px;
    background: #fafafa;
    transition: border-color 0.2s, background 0.2s;
    font-family: inherit;
    color: #1a1a1a;
    text-align: left;
}
.exit-intent-form input:focus {
    outline: none;
    border-color: #b08d57;
    background: white;
}
.exit-intent-form button {
    margin-top: 4px;
    padding: 14px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
/* Consent label: override degli inline-style del JS (colore bianco = invisibile su sfondo bianco) */
.exit-intent-consent {
    display: flex !important;
    align-items: flex-start !important;
    gap: 10px !important;
    margin: 14px 0 !important;
    font-size: 0.82rem !important;
    color: #555 !important;
    line-height: 1.45 !important;
    cursor: pointer;
    text-align: left;
}
.exit-intent-consent input[type="checkbox"] {
    flex-shrink: 0;
    margin-top: 2px;
    width: 16px;
    height: 16px;
    accent-color: #b08d57;
    cursor: pointer;
}
.exit-intent-consent > span {
    flex: 1 1 auto;
    min-width: 0; /* permette word-wrap corretto in flex */
    word-break: break-word;
}
.exit-intent-consent a {
    color: #b08d57;
    text-decoration: underline;
}
.exit-intent-disclaimer {
    font-size: 0.78rem;
    color: #888;
    text-align: center;
    margin: 0;
}
.exit-intent-disclaimer a {
    color: #b08d57;
    text-decoration: underline;
}
/* Landscape mobile a schermo basso: comprimi il popup per stare nello viewport */
@media (orientation: landscape) and (max-height: 520px) {
    .exit-intent-overlay {
        padding: 8px;
    }
    .exit-intent-modal {
        padding: 12px 22px 20px;
        max-width: 520px;
    }
    .exit-intent-modal h3 {
        font-size: 1.15rem;
        margin-bottom: 6px;
        padding-right: 28px;
    }
    .exit-intent-modal > p {
        font-size: 0.86rem;
        line-height: 1.45;
        margin-bottom: 12px;
    }
    .exit-intent-form {
        gap: 8px;
        margin-bottom: 8px;
    }
    .exit-intent-form input[type="text"],
    .exit-intent-form input[type="email"],
    .exit-intent-form input[type="tel"] {
        padding: 9px 12px;
        font-size: 0.88rem;
        border-radius: 8px;
    }
    .exit-intent-consent {
        margin: 8px 0 !important;
        font-size: 0.76rem !important;
        line-height: 1.35 !important;
    }
    .exit-intent-form button {
        padding: 10px 20px;
        font-size: 0.88rem;
        margin-top: 2px;
    }
    .exit-intent-close {
        width: 32px;
        height: 32px;
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .exit-intent-modal {
        padding: 14px 22px 26px;
    }
    .exit-intent-modal h3 {
        font-size: 1.25rem;
        padding-right: 24px;
    }
    .exit-intent-modal > p {
        font-size: 0.9rem;
    }
}

/* ============================================
   MENU MOBILE
   ============================================ */
.menu-toggle {
    display: none;
    position: relative;
    width: 44px;
    height: 44px;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    z-index: 1003;
    -webkit-tap-highlight-color: transparent;
}

.menu-toggle span {
    position: absolute;
    left: 10px;
    width: 24px;
    height: 2px;
    background: var(--text-dark);
    border-radius: 2px;
    transition: top 0.2s ease 0.2s, transform 0.2s ease, opacity 0.15s ease 0.15s;
}

.menu-toggle span:nth-child(1) { top: 14px; }
.menu-toggle span:nth-child(2) { top: 21px; }
.menu-toggle span:nth-child(3) { top: 28px; }

.menu-toggle.active span {
    transition: top 0.2s ease, transform 0.2s ease 0.2s, opacity 0.15s ease;
}

.menu-toggle.active span:nth-child(1) {
    top: 21px;
    transform: rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    top: 21px;
    transform: rotate(-45deg);
}

/* Overlay scuro dietro al drawer */
.menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.menu-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Body scroll lock quando menu aperto */
body.menu-open {
    overflow: hidden;
}

/* Quando menu aperto: header sopra l'overlay (drawer è figlio dell'header)
   senza backdrop-filter (creava stacking context isolato) */
body.menu-open header {
    z-index: 1010;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: white;
}

/* Logo torna scuro su menu aperto (su index l'hero invertiva il logo a bianco) */
body.menu-open header .logo img {
    filter: none;
}

body.menu-open header .menu-toggle span {
    background: var(--text-dark);
}

/* ============================================
   ANIMAZIONI
   ============================================ */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   RESPONSIVE — PARTI COMUNI
   ============================================ */
/* Breakpoint navbar/drawer: hamburger attivo fino a 1199px (copre iPad landscape, laptop con scaling 125-150%, laptop 1280, viewport intermedi 1025-1199 dove le 7 voci + CTA non entrano) */
@media (max-width: 1199px) {
    .menu-toggle {
        display: block;
    }

    .nav-cta {
        display: none;
    }

    /* Drawer mobile: testo sempre scuro, anche su header trasparente */
    header .nav-menu > li > a,
    header .nav-menu .dropdown-toggle {
        color: var(--text-dark);
    }
    header .nav-menu .dropdown-content a {
        color: var(--text-medium);
    }

    /* MENU DRAWER MOBILE */
    .nav-menu {
        position: fixed;
        top: 0;
        right: 0;
        width: min(86vw, 360px);
        height: 100vh;
        height: 100dvh;
        background: white;
        z-index: 1001;
        display: flex;
        flex-direction: column;
        gap: 0;
        align-items: stretch;
        padding: 80px 0 24px;
        margin: 0;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.18);
        transform: translateX(100%);
        transition: transform 0.35s cubic-bezier(0.7, 0.0, 0.3, 1);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .nav-menu.active {
        transform: translateX(0);
    }

    .nav-menu li {
        list-style: none;
        border-bottom: 1px solid #f0ebe3;
    }

    .nav-menu li:last-child {
        border-bottom: none;
    }

    .nav-menu > li > a,
    .nav-menu > li > a.dropdown-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 28px;
        font-size: 1rem;
        font-weight: 500;
        color: var(--text-dark);
        text-decoration: none;
        line-height: 1.3;
    }

    .nav-menu > li > a::after {
        display: none;
    }

    .nav-menu > li > a:hover {
        color: var(--primary);
        background: var(--bg-cream);
    }

    /* Voce "Professionisti" piccola: la rendo coerente con le altre */
    .nav-menu > li > a[style*="font-size:0.88em"] {
        font-size: 1rem !important;
    }

    /* Dropdown accordion mobile */
    .nav-menu .dropdown {
        padding: 0;
        margin: 0;
    }

    .nav-menu .dropdown-toggle svg {
        width: 14px;
        height: 14px;
        transition: transform 0.3s ease;
        flex-shrink: 0;
    }

    .nav-menu .dropdown.open .dropdown-toggle svg {
        transform: rotate(180deg);
    }

    .nav-menu .dropdown-content {
        position: static;
        display: block;
        max-height: 0;
        overflow: hidden;
        padding: 0;
        background: var(--bg-cream);
        box-shadow: none;
        border: none;
        border-radius: 0;
        min-width: 0;
        transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .nav-menu .dropdown.open .dropdown-content {
        max-height: 500px;
    }

    .nav-menu .dropdown-content a {
        display: block;
        padding: 13px 28px 13px 44px;
        font-size: 0.92rem;
        color: var(--text-medium);
        text-align: left;
        border: none;
        text-decoration: none;
    }

    .nav-menu .dropdown-content a:hover {
        color: var(--primary);
        background: white;
    }

    /* Override eventuali style inline su voci speciali del dropdown */
    .nav-menu .dropdown-content a[style*="font-weight:600"] {
        color: var(--text-dark) !important;
    }
}

/* Container/footer: layout per tablet/laptop piccoli (non-navbar) */
@media (max-width: 1024px) {
    .container {
        padding: 0 30px;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 20px;
    }

    header {
        height: 70px;
    }

    .logo img {
        height: 40px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .whatsapp-widget {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
    }

    .whatsapp-widget svg {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
}

/* ============================================
   ACCESSIBILITÀ
   ============================================ */

/* Skip to content link */
.skip-nav {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: 0 0 8px 8px;
    z-index: 10000;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
    transition: top 0.3s ease;
}

.skip-nav:focus {
    top: 0;
}

/* Focus styles */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.btn:focus-visible,
.tab-btn:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
    border-radius: 4px;
}

/* Cookie Consent Banner */
.cookie-banner {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--text-dark);
    color: rgba(255, 255, 255, 0.9);
    padding: 20px 0;
    z-index: 9999;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.cookie-banner.visible {
    display: block;
}

.cookie-banner .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.cookie-banner p {
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
    flex: 1;
    min-width: 250px;
}

.cookie-banner a {
    color: var(--primary-light);
    text-decoration: underline;
}

.cookie-banner a:hover {
    color: var(--primary);
}

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

.cookie-buttons .btn {
    padding: 10px 24px;
    font-size: 0.85rem;
    white-space: nowrap;
}

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

.btn-accept:hover {
    background: var(--primary-dark);
}

.btn-reject {
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-reject:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

@media (max-width: 768px) {
    .cookie-banner .container {
        flex-direction: column;
        text-align: center;
    }

    .cookie-banner p {
        font-size: 0.85rem;
    }

    .cookie-buttons {
        width: 100%;
        justify-content: center;
    }
}

/* Policy Pages Content */
.policy-content {
    padding: 60px 0 100px;
}

.policy-content .container {
    max-width: 860px;
}

.policy-content h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 50px 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-light);
}

.policy-content h2:first-child {
    margin-top: 0;
}

.policy-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 30px 0 12px;
}

.policy-content p {
    font-size: 0.95rem;
    color: var(--text-medium);
    line-height: 1.8;
    margin-bottom: 15px;
}

.policy-content ul, .policy-content ol {
    margin: 15px 0 20px 25px;
    color: var(--text-medium);
    font-size: 0.95rem;
    line-height: 1.8;
}

.policy-content li {
    margin-bottom: 8px;
}

.policy-content strong {
    color: var(--text-dark);
}

.policy-content a {
    color: var(--primary);
    text-decoration: underline;
}

.policy-content a:hover {
    color: var(--primary-dark);
}

.policy-content .policy-update {
    font-size: 0.85rem;
    color: var(--text-light);
    font-style: italic;
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

