/* ============================================
   FARMACIA COMUNALE — Design System v5
   Identità: bianco + blu #1560A8, accenti teal/viola
   Font unico: Outfit (coerente su tutto il sito)
   ============================================ */

:root {
    /* Palette — tema blu/medicale */
    --blue: #1560A8;
    --blue-dark: #0E3D6B;
    --blue-deep: #0A2C4F;
    --teal: #0B725A;
    --teal-bright: #52C9A8;
    --purple: #6C4FB0;

    /* Tinte chiare per icone */
    --blue-soft: #E3EEFB;
    --teal-soft: #DDF1EA;
    --purple-soft: #ECE7F8;

    /* Surfaces */
    --bg: #F2F7FC;
    --white: #ffffff;

    /* Text */
    --ink: #1E3A5F;
    --text: #46586B;
    --muted: #566A7D;
    --faint: #9AA8B5;

    /* Lines */
    --line: #DCE7F0;
    --line-soft: #EAF1F8;

    /* Status */
    --danger: #C4453B;
    --success: var(--teal);
    --info: #0dcaf0;
    --warning: #ffc107;

    /* Alias legacy (usati in stili inline delle pagine) */
    --primary: var(--blue);
    --primary-dark: var(--blue-dark);
    --primary-light: var(--blue);
    --gray-400: var(--muted);

    /* Typography — un'unica famiglia per coerenza */
    --font: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4.5rem;

    /* Radius */
    --radius-sm: 0.6rem;
    --radius-md: 0.9rem;
    --radius-lg: 1.25rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(14,61,107,.06);
    --shadow-md: 0 8px 24px -8px rgba(14,61,107,.16);
    --shadow-lg: 0 18px 40px -16px rgba(14,61,107,.22);
    --shadow-xl: 0 30px 70px -24px rgba(14,61,107,.32);

    /* Transitions */
    --transition: all .3s cubic-bezier(.4,0,.2,1);

    /* Header heights */
    --topbar-h: 48px;
    --navbar-h: 88px;
}

/* Reset & Base */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
    font-family: var(--font);
    color: var(--text);
    background-color: var(--bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a { color: var(--blue); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--blue-dark); }
main p a { text-decoration: underline; text-underline-offset: 3px; }

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

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--spacing-md); }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.site-header :focus-visible, .footer :focus-visible { outline-color: currentColor; }

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 10000;
    padding: .75rem 1rem;
    background: var(--white);
    color: var(--blue-dark);
    border: 2px solid currentColor;
    border-radius: var(--radius-sm);
    text-decoration: underline;
    text-underline-offset: 3px;
    transform: translateY(calc(-100% - 16px));
}
.skip-link:focus {
    transform: translateY(0);
    outline-style: solid;
    outline-width: 3px;
    outline-color: var(--blue);
    outline-offset: 4px;
}
#main-content { scroll-margin-top: calc(var(--topbar-h) + var(--navbar-h) + 16px); }

/* ============================================
   SITE HEADER (topbar + navbar)
   ============================================ */
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
}

.topbar {
    background: var(--blue);
    color: rgba(255,255,255,.92);
    font-size: .85rem;
    letter-spacing: .02em;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    width: 100%;
}

.topbar a, .topbar span {
    color: rgba(255,255,255,.92);
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    white-space: nowrap;
}

.topbar a:hover { color: #fff; }
.topbar i { font-size: .78rem; color: rgba(255,255,255,.9); }

/* Navbar — bianca con link navy e underline teal */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--line-soft);
    transition: var(--transition);
}

.navbar.scrolled { box-shadow: 0 8px 30px -18px rgba(14,61,107,.25); }

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--navbar-h);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: var(--blue-dark);
    text-decoration: none;
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
}

.brand-icon img { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }

.brand-title {
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--blue-dark);
}

.brand-subtitle {
    font-size: .66rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .18em;
}

/* Nav Toggle (Hamburger) */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--blue-dark);
    border-radius: 2px;
    transition: var(--transition);
}

.nav-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Nav Menu — link piano, attivo con underline teal */
.nav-list { display: flex; list-style: none; gap: .3rem; }

.nav-link {
    position: relative;
    display: block;
    padding: .55rem 1.05rem .75rem;
    color: #33517A;
    font-weight: 600;
    font-size: .94rem;
    transition: var(--transition);
    text-decoration: none;
}

.nav-link:hover { color: var(--blue-dark); }

.nav-link.active { color: var(--blue-dark); }

.nav-link.active::after {
    content: '';
    position: absolute;
    left: 1.05rem;
    right: 1.05rem;
    bottom: .28rem;
    height: 3px;
    border-radius: 2px;
    background: var(--teal);
}

.nav-spacer { height: calc(var(--topbar-h) + var(--navbar-h)); }

/* ============================================
   HERO / PAGE HEADER
   ============================================ */
.hero {
    background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 60%, #4D9FD6 135%);
    color: var(--white);
    padding: var(--spacing-2xl) 0;
    text-align: center;
}

.hero .container { position: relative; z-index: 1; }

.hero-title {
    font-size: clamp(2.2rem, 4vw, 2.9rem);
    font-weight: 700;
    margin-bottom: .75rem;
    letter-spacing: -.01em;
    line-height: 1.15;
}

.hero-subtitle {
    font-size: 1.08rem;
    font-weight: 400;
    color: rgba(255,255,255,.78);
    max-width: 600px;
    margin: 0 auto;
}

.hero-sm { padding: var(--spacing-xl) 0; }
.hero-sm .hero-title { font-size: clamp(1.9rem, 3vw, 2.4rem); }

/* ============================================
   EYEBROW LABEL
   ============================================ */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--blue);
    margin-bottom: var(--spacing-sm);
}

.eyebrow i { font-size: .72rem; }

/* ============================================
   BUTTONS — blu scuro, pill (come il mockup)
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    padding: .82rem 1.7rem;
    font-size: .94rem;
    font-weight: 600;
    font-family: var(--font);
    border: 1.5px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

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

.btn-primary:hover {
    background: var(--blue-dark);
    border-color: var(--blue-dark);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -10px rgba(21,96,168,.5);
}

.btn-outline {
    background: transparent;
    color: var(--blue);
    border-color: var(--blue);
}

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

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

.btn-white:hover {
    background: var(--bg);
    color: var(--blue-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-outline-white {
    background: transparent;
    color: var(--white);
    border-color: rgba(255,255,255,.5);
}

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

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

.btn-danger:hover {
    background: #a83a31;
    border-color: #a83a31;
    color: var(--white);
}

.btn-sm { padding: .5rem 1.1rem; font-size: .82rem; }
.btn-lg { padding: .95rem 2.1rem; font-size: 1rem; }

/* ============================================
   CARDS
   ============================================ */
.card {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--line-soft);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-5px);
    border-color: var(--blue-soft);
}

.card-image {
    position: relative;
    width: 100%;
    height: 230px;
    overflow: hidden;
    background: var(--bg);
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: var(--spacing-sm);
    transition: transform .6s cubic-bezier(.4,0,.2,1);
}

.card:hover .card-image img { transform: scale(1.06); }

.card-image .card-badge {
    position: absolute;
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    background: var(--teal);
    color: var(--white);
    padding: .32rem .85rem;
    border-radius: var(--radius-full);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.card-body { padding: var(--spacing-md) var(--spacing-md) var(--spacing-sm); }

.card-title {
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--blue-dark);
    margin-bottom: .4rem;
    line-height: 1.35;
}

.card-text {
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.65;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-details {
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: inherit;
    cursor: pointer;
}
.card-details::after { content: ''; position: absolute; inset: 0; }
.card:focus-within { outline: 1px solid var(--line); outline-offset: 3px; }
.card:has(:focus-visible) { outline: 3px solid var(--blue); outline-offset: 4px; }

.card-footer {
    padding: 0 var(--spacing-md) var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Grid layouts */
.grid { display: grid; gap: var(--spacing-lg); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ============================================
   SECTION STYLES
   ============================================ */
.section { padding: var(--spacing-2xl) 0; }

.section-gray { background: var(--white); }

.section-header { text-align: center; margin-bottom: var(--spacing-xl); }

.section-title {
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 700;
    color: var(--blue-dark);
    margin-bottom: .5rem;
    letter-spacing: -.01em;
}

.section-subtitle {
    color: var(--muted);
    font-size: 1rem;
    max-width: 520px;
    margin: 0 auto;
}

/* ============================================
   HOMEPAGE HERO — due colonne, card "La nostra sede" a destra
   ============================================ */
.home-hero {
    position: relative;
    overflow: hidden;
    color: var(--ink);
    padding: calc(var(--spacing-2xl) + 1rem) 0 150px;
    background-color: #EAF3FC; /* fallback se l'immagine manca */
}

/* Prima foto (interno.jpg) */
.home-hero-bg-alt {
    position: absolute;
    inset: 0;
    background-image: url('../img/interno.jpg');
    background-size: cover;
    background-position: center;
    opacity: 1;
    animation: heroBgB 12s ease-in-out infinite;
}

/* Seconda foto (esterno.png) */
.home-hero-bg-ext {
    position: absolute;
    inset: 0;
    background-image: url('../img/esterno.png');
    background-size: cover;
    background-position: center;
    opacity: 0;
    animation: heroBgC 12s ease-in-out infinite;
}

/* Crossfade a due: interno → esterno, ~6s ciascuna */
@keyframes heroBgB {
    0%, 40%   { opacity: 1; }
    50%, 90%  { opacity: 0; }
    100%      { opacity: 1; }
}

@keyframes heroBgC {
    0%, 40%   { opacity: 0; }
    50%, 90%  { opacity: 1; }
    100%      { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .home-hero-bg-alt, .home-hero-bg-ext { animation: none; }
}

/* Velo chiaro a sinistra per la leggibilità + dissolvenza in basso */
.home-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, transparent 65%, rgba(242,247,252,.9) 100%),
        linear-gradient(90deg, rgba(238,246,253,.97) 0%, rgba(238,246,253,.82) 38%, rgba(238,246,253,.35) 62%, rgba(238,246,253,0) 100%);
}

.home-hero-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: var(--spacing-xl);
    align-items: center;
}

.home-hero-content { text-align: left; }

.home-hero-content .hero-title {
    font-size: clamp(2.5rem, 4.6vw, 3.7rem);
    font-weight: 800;
    letter-spacing: -.01em;
    line-height: 1.12;
    color: var(--blue-dark);
    margin-bottom: .9rem;
}

.home-hero .hero-motto {
    font-size: 1.12rem;
    font-weight: 400;
    color: var(--text);
    max-width: 46ch;
    margin: 0 0 var(--spacing-lg);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    justify-content: flex-start;
}

/* Card "La nostra sede" */
.home-hero-card { display: flex; justify-content: center; }

.alert-box {
    background: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px -20px rgba(14,61,107,.30);
    padding: 1.9rem;
    width: 100%;
    max-width: 400px;
}

.alert-box h2 {
    display: flex;
    align-items: center;
    gap: .8rem;
    color: var(--blue-dark);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1.1rem;
}

.alert-box h2 i {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--teal-soft);
    color: var(--teal);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .95rem;
    flex-shrink: 0;
}

.alert-box p { color: var(--text); font-size: .95rem; line-height: 1.7; margin-bottom: .45rem; }
.alert-box a { color: var(--blue); font-weight: 600; }
.alert-box a:hover { color: var(--blue-dark); }

.alert-box .contact-row i {
    width: 1.2em;
    text-align: center;
    margin-right: .5rem;
    color: var(--blue);
}

/* Quick access cards — riga che sovrappone il hero */
.home-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
    margin-top: -96px;
    position: relative;
    z-index: 2;
}

.home-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.7rem 1.6rem;
    color: var(--ink);
    transition: var(--transition);
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .9rem;
    position: relative;
    padding-right: 4.6rem;
    border: 1px solid var(--line-soft);
    box-shadow: 0 18px 44px -20px rgba(14,61,107,.25);
}

.home-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.home-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    font-size: 1.3rem;
}

.home-card h2 {
    font-size: 1.28rem;
    font-weight: 700;
    color: var(--blue-dark);
}

.home-card p {
    font-size: .9rem;
    color: var(--muted);
    line-height: 1.6;
}

/* Freccia circolare a destra, colore per card */
.home-card-arrow {
    position: absolute;
    right: 1.6rem;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: .9rem;
    transition: var(--transition);
}

.home-card-arrow:hover { transform: translateY(-50%) scale(1.08); }

/* Card 1 — blu */
.home-cards .home-card:nth-child(1) .home-card-icon { background: var(--blue-soft); color: var(--blue); }
.home-cards .home-card:nth-child(1) .home-card-arrow { background: var(--blue); }
.home-cards .home-card:nth-child(1) .home-card-arrow:hover { background: var(--blue-dark); }

/* Card 2 — teal */
.home-cards .home-card:nth-child(2) .home-card-icon { background: var(--teal-soft); color: var(--teal); }
.home-cards .home-card:nth-child(2) .home-card-arrow { background: var(--teal); }
.home-cards .home-card:nth-child(2) .home-card-arrow:hover { background: #0B6E57; }

.home-cards-four { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; }
.home-cards-four .home-card { padding: 1.5rem 1.25rem 4.5rem; min-width: 0; }
.home-cards-four .home-card-arrow { top: auto; bottom: 1.25rem; right: 1.25rem; transform: none; }
.home-cards-four .home-card-arrow:hover { transform: scale(1.08); }
.home-card-duty { text-decoration: none; }
.pharmacies-grid .card { min-width: 0; overflow-wrap: anywhere; }
.home-card-duty .home-card-icon { background: var(--teal-soft); color: var(--teal); }
.home-card-duty .home-card-arrow { background: var(--teal); }
.home-card-duty:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }

/* Card 3 — viola */
.home-cards .home-card:nth-child(3) .home-card-icon { background: var(--purple-soft); color: var(--purple); }
.home-cards .home-card:nth-child(3) .home-card-arrow { background: var(--purple); }
.home-cards .home-card:nth-child(3) .home-card-arrow:hover { background: #57408F; }

/* ============================================
   CONTACTS PAGE
   ============================================ */
.contact-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    align-items: start;
}

.contact-info-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--line-soft);
}

.contact-info-card :is(h2, h3) {
    color: var(--blue-dark);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--blue-soft);
    font-weight: 700;
}

.contact-detail {
    display: flex;
    gap: .9rem;
    margin-bottom: var(--spacing-md);
    align-items: flex-start;
}

.contact-detail i {
    font-size: 1rem;
    color: var(--blue);
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--blue-soft);
    border-radius: 50%;
    flex-shrink: 0;
}

.contact-detail-content strong {
    display: block;
    font-size: .74rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-bottom: 2px;
    font-weight: 700;
}

.contact-detail-content span,
.contact-detail-content a {
    font-size: .95rem;
    color: var(--ink);
    font-weight: 500;
}

.contact-detail-content a:hover { color: var(--blue-dark); }

.map-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--line-soft);
    height: 100%;
    min-height: 420px;
}

.map-card iframe { width: 100%; height: 100%; min-height: 420px; border: 0; }

/* Schedule card */
.schedule-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--line-soft);
}

.schedule-card :is(h2, h3) {
    color: var(--blue-dark);
    margin-bottom: var(--spacing-md);
    font-weight: 700;
    font-size: 1.3rem;
}

.schedule-card :is(h2, h3) i { color: var(--teal); margin-right: .5rem; }

.schedule-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
    align-items: start;
    gap: .7rem;
    padding: .5rem 0;
    font-size: .92rem;
    color: var(--text);
}

.schedule-item > span { display: flex; align-items: baseline; gap: .7rem; }
.schedule-item i { color: var(--blue); font-size: .85rem; flex-shrink: 0; }
.schedule-item strong span { display: inline-block; white-space: nowrap; }

.schedule-item strong { color: var(--ink); font-weight: 700; }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    color: inherit;
    position: fixed;
    inset: 0;
    background: rgba(10,44,79,.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    animation: fadeIn .2s ease;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    max-width: 720px;
    width: 100%;
    max-height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    animation: slideUp .35s cubic-bezier(.22,.61,.36,1);
}

.modal-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: 1.2rem var(--spacing-lg);
    border-bottom: 1px solid var(--line-soft);
}

.modal-header h3 {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--blue-dark);
    font-size: 1.35rem;
    font-weight: 700;
}

.modal-close {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--muted);
    transition: var(--transition);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
}

.modal-close:hover { background: var(--blue-soft); color: var(--blue-dark); }
.modal-close:focus-visible { outline-width: 1px; outline-offset: 2px; }

.modal-body {
    margin: 0 6px 12px 0;
    padding: var(--spacing-lg) calc(var(--spacing-lg) - 6px) calc(var(--spacing-lg) - 12px) var(--spacing-lg);
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--faint) transparent;
}

.modal-body::-webkit-scrollbar { width: 8px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb {
    background: var(--faint);
    border: 2px solid var(--white);
    border-radius: var(--radius-full);
}
.modal-body::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.modal-body img { width: 100%; max-height: 320px; object-fit: contain; border-radius: var(--radius-md); margin-bottom: var(--spacing-md); }

.modal-body .modal-description {
    color: var(--text);
    line-height: 1.8;
    font-size: .95rem;
}

.modal-description :is(ul, ol) { padding-left: 1.5em; }

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: var(--spacing-md); }

.form-label {
    display: block;
    font-weight: 600;
    font-size: .85rem;
    color: var(--ink);
    margin-bottom: .45rem;
}

.form-control {
    width: 100%;
    padding: .8rem 1.05rem;
    font-size: .92rem;
    font-family: var(--font);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--ink);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(21,96,168,.12);
}

textarea.form-control { min-height: 130px; resize: vertical; }

.form-control-file {
    padding: var(--spacing-sm);
    background: var(--bg);
    border: 2px dashed var(--line);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.form-control-file:hover {
    border-color: var(--blue);
    background: var(--blue-soft);
}

.form-check { display: flex; align-items: center; gap: .5rem; }

.form-check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--blue); }

/* ============================================
   ADMIN PANEL
   ============================================ */
.admin-layout {
    --line: #B8C9D9;
    --line-soft: #DCE5EE;
    --gray-100: var(--bg);
    --gray-300: var(--muted);
    --gray-500: var(--muted);
    --gray-800: var(--ink);
    --accent: var(--teal);
    --info: var(--blue);
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: calc(100vh - var(--navbar-h));
}

.admin-sidebar {
    background: #FBFCFA;
    border-right: 1px solid var(--line);
    padding: var(--spacing-lg);
}

.admin-sidebar h4 {
    color: var(--blue-dark);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--blue-soft);
    font-weight: 700;
}

.admin-menu { list-style: none; }
.admin-menu li { margin-bottom: .35rem; }

.admin-menu a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem 1rem;
    color: var(--text);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 600;
    transition: var(--transition);
    text-decoration: none;
}

.admin-menu a:hover { background: var(--blue-soft); color: var(--blue-dark); }

.admin-menu a.active {
    background: var(--blue);
    color: var(--white);
}

.admin-menu a i { width: 20px; text-align: center; }

.admin-content { padding: var(--spacing-lg); }

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.admin-header h2 {
    color: var(--blue-dark);
    font-size: 1.6rem;
    font-weight: 700;
}

.admin-table {
    width: 100%;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--line);
}

.admin-table thead { background: var(--blue-soft); }

.admin-table tbody tr:nth-child(even) { background: #F2F7FC; }
.admin-table tbody tr:hover { background: var(--blue-soft); }
.admin-table th + th, .admin-table td + td { border-left: 1px solid var(--line-soft); }
.admin-table thead + tbody tr:first-child td { border-top-color: var(--line); }

.admin-table th {
    padding: .8rem var(--spacing-md);
    text-align: left;
    font-size: .74rem;
    font-weight: 700;
    color: var(--ink);
    text-transform: uppercase;
    letter-spacing: .08em;
}

.admin-table td {
    padding: .8rem var(--spacing-md);
    border-top: 1px solid var(--line-soft);
    font-size: .9rem;
    color: var(--text);
    vertical-align: middle;
}

.admin-table .table-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--bg);
}

.admin-table .actions { display: flex; gap: .5rem; }

.admin-content .card {
    border-color: var(--line);
    box-shadow: var(--shadow-md);
}

.admin-layout .badge-draft { color: #80520D; }

.action-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    background: var(--white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: .85rem;
    color: var(--muted);
}

.action-btn:hover { background: var(--bg); }

.action-btn.edit:hover { color: var(--blue); border-color: var(--blue); background: var(--blue-soft); }

.action-btn.delete:hover { color: var(--danger); border-color: var(--danger); background: #FBEDEB; }

/* Login page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 60%, #4D9FD6 135%);
    padding: var(--spacing-md);
}

.login-card {
    background: var(--white);
    padding: var(--spacing-xl);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
}

.login-card h2 {
    text-align: center;
    color: var(--blue-dark);
    margin-bottom: var(--spacing-lg);
    font-weight: 700;
}

.login-card .brand-icon {
    margin: 0 auto var(--spacing-md);
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
}

/* Login compatta */
.login-card { padding: var(--spacing-lg); max-width: 380px; }
.login-card h2 { margin-bottom: var(--spacing-sm); font-size: 1.4rem; }
.login-card .brand-icon { width: 44px; height: 44px; font-size: 1.25rem; margin-bottom: var(--spacing-xs); }
.login-card .form-group { margin-bottom: var(--spacing-sm); }

.alert {
    padding: .8rem var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    font-size: .87rem;
}

.alert-danger { background: #FBEDEB; color: var(--danger); border: 1px solid #EFC9C4; }
.alert-success { background: var(--teal-soft); color: var(--success); border: 1px solid #BFE5D8; }

/* Form card per admin */
.form-card {
    --line: #B8C9D9;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--line);
    max-width: 700px;
    margin: 0 auto;
}

.form-card .form-group { margin-bottom: var(--spacing-sm); }

.pharmacy-fields {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: .75rem 1rem;
    margin: 1rem 0;
}
.pharmacy-fields .form-group { grid-column: span 6; margin-bottom: 0; min-width: 0; }
.pharmacy-fields .pharmacy-field-cap { grid-column: span 2; }
.pharmacy-fields .pharmacy-field-comune { grid-column: span 7; }
.pharmacy-fields .pharmacy-field-provincia { grid-column: span 3; }
.pharmacy-fields .pharmacy-field-orari,
.pharmacy-fields .pharmacy-field-note { grid-column: 1 / -1; }
.pharmacy-fields .form-label { margin-bottom: .35rem; }
.pharmacy-fields .form-control { padding: .6rem .75rem; }
.pharmacy-fields textarea.form-control { min-height: 90px; }

@media (max-width: 600px) {
    .pharmacy-fields { grid-template-columns: minmax(0, 1fr); }
    .pharmacy-fields .form-group { grid-column: auto; }
}

.form-card h3 {
    color: var(--blue-dark);
    margin-bottom: var(--spacing-md);
    font-weight: 700;
}

.form-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--line-soft);
}

/* ============================================
   FOOTER — blu profondo
   ============================================ */
.footer {
    background: var(--blue-deep);
    color: rgba(255,255,255,.78);
    padding-top: var(--spacing-2xl);
    position: relative;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--teal), transparent 70%);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr .8fr;
    gap: var(--spacing-xl);
    padding-bottom: var(--spacing-xl);
}

.footer-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: var(--spacing-md);
}

.footer-text {
    font-size: .9rem;
    line-height: 1.8;
    margin-bottom: .5rem;
}

.footer-text i {
    width: 20px;
    color: var(--teal-bright);
    margin-right: .4rem;
    font-size: .85rem;
}

.footer-text a { color: rgba(255,255,255,.9); text-decoration: underline; text-underline-offset: 3px; }
.footer-text a:hover { color: #fff; }

.footer-indent { padding-left: 2.1rem; }

.footer-schedule small { opacity: .65; }

.footer-link {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
    color: rgba(255,255,255,.85);
    padding: .3rem 0;
}

.footer-link i { color: var(--teal-bright); }
.footer-link:hover { color: #fff; }

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.18);
    padding: 1.4rem 0;
}

.footer-bottom p { font-size: .8rem; color: rgba(255,255,255,.6); }

/* ============================================
   WHATSAPP FAB
   ============================================ */
.whatsapp-fab {
    position: fixed;
    bottom: 30px;
    right: 27px;
    width: 52px;
    height: 52px;
    background: #1FAF57;
    color: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 30px -10px rgba(31,175,87,.6);
    transition: var(--transition);
    z-index: 9996;
}

.whatsapp-fab:has(+ .back-to-top.visible) { bottom: 86px; }

.whatsapp-fab:hover {
    background: #179A4B;
    transform: translateY(-3px) scale(1.05);
}

/* ============================================
   COOKIE BANNER
   ============================================ */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: min(760px, calc(100% - 32px));
    background: var(--white);
    color: var(--text);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 9998;
    padding: 1rem 1.3rem;
}

.cookie-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
}

.cookie-content p { font-size: .85rem; color: var(--text); margin: 0; }
.cookie-content a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }

/* shortcut: MAUVE non risolve var() negli sfondi ereditati, ripristinare le variabili quando lo supporta. */
.topbar a, .topbar span { background-color: #1560A8; }
.footer-title, .footer-text, .footer-text span, .footer-text strong,
.footer-text small, .footer-text a, .footer-link, .footer-bottom p { background-color: #0A2C4F; }
.cookie-content p { color: #46586B; background-color: #fff; }
.cookie-content a { color: #1560A8; background-color: #fff; }
.cookie-content button { background-color: #1560A8; }
.btn-outline { background-color: #fff; }

/* ============================================
   BACK TO TOP
   ============================================ */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 46px;
    height: 46px;
    background: var(--blue);
    color: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    z-index: 9997;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
}

.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }

.back-to-top:hover {
    background: var(--blue-dark);
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state { text-align: center; padding: var(--spacing-2xl) var(--spacing-md); color: var(--faint); }
.empty-state i { font-size: 3.5rem; margin-bottom: var(--spacing-md); display: block; }
.empty-state :is(h2, h3) { color: var(--muted); margin-bottom: .4rem; font-weight: 700; }
.empty-state p { font-size: .9rem; }

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }
.mt-5 { margin-top: var(--spacing-xl); }
.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }
.mb-5 { margin-bottom: var(--spacing-xl); }
.hidden { display: none !important; }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-on-scroll {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .7s cubic-bezier(.22,.61,.36,1), transform .7s cubic-bezier(.22,.61,.36,1);
}

.animate-on-scroll.visible { opacity: 1; transform: translateY(0); }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 992px) {
    .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .contact-layout { grid-template-columns: 1fr; }
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { display: none; }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--spacing-lg); }

    .home-hero-grid { grid-template-columns: 1fr; gap: var(--spacing-lg); }
    .home-hero-card { justify-content: flex-start; }
    .home-cards { grid-template-columns: 1fr; margin-top: -60px; }
    .home-cards-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    :root { --topbar-h: 40px; --navbar-h: 72px; }
    html { font-size: 15px; }

    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

    .topbar-inner { justify-content: center; gap: var(--spacing-md); }
    .topbar-right { display: none; }

    .nav-toggle { display: flex; }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 300px;
        height: 100vh;
        background: var(--white);
        box-shadow: var(--shadow-xl);
        padding: calc(var(--topbar-h) + var(--navbar-h)) var(--spacing-lg) var(--spacing-lg);
        visibility: hidden;
        overflow-y: auto;
        transition: right .35s cubic-bezier(.22,.61,.36,1), visibility .35s;
        z-index: 999;
    }

    .nav-menu.active { right: 0; visibility: visible; }

    .nav-list { flex-direction: column; gap: .4rem; }

    .nav-link { font-size: 1rem; padding: .8rem 1.1rem; }

    .hero-title { font-size: 2rem; }
    .home-hero .hero-title { font-size: 2.3rem; }
    .section-title { font-size: 1.75rem; }
    .section { padding: var(--spacing-xl) 0; }

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

    .admin-table { font-size: .85rem; }
    .admin-table td, .admin-table th { padding: .5rem; }

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

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media (max-width: 480px) {
    .home-cards-four { grid-template-columns: 1fr; }
    .container { padding: 0 var(--spacing-sm); }
    .hero { padding: var(--spacing-xl) 0; }
    .hero-title { font-size: 1.6rem; }
    .home-hero .hero-title { font-size: 1.9rem; }
    .section { padding: var(--spacing-lg) 0; }
    .hero-actions .btn { width: 100%; }
    .schedule-card { padding: 1.25rem; }
    .modal-overlay { padding: var(--spacing-sm); }
    .modal-header { padding: 1rem 1.5rem; }
    .modal-header h3 { font-size: 1.15rem; }
    .modal-body { padding: 1rem calc(1.5rem - 6px) 1rem 1.5rem; }
}

/* Badge stato (admin) */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge-published { background: var(--teal-soft); color: var(--success); }
.badge-draft { background: #FFF4E5; color: #B7791F; }
.action-btn.disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }

/* Editor HTML basilare (admin) */
.editor-toolbar { display: flex; gap: .3rem; margin-bottom: .4rem; }
.editor-toolbar button { width: 2.2rem; height: 2rem; border: 1px solid var(--line); background: #fff; border-radius: var(--radius-sm); cursor: pointer; color: var(--text); display: flex; align-items: center; justify-content: center; }
.editor-toolbar button:hover { background: var(--bg); border-color: var(--blue); color: var(--blue); }
.editor-area { min-height: 140px; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-md); line-height: 1.6; background: #fff; }
.editor-area:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }

/* Confirm dialog (admin) — variante compatta */
.modal-confirm { max-width: 420px; }
.modal-confirm .modal-header { padding: .8rem 1.25rem; border-bottom: none; }
.modal-confirm .modal-header h3 { font-size: 1.05rem; }
.modal-confirm .modal-body { padding: .75rem 1.25rem 1rem; }
.confirm-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .9rem; }
