/* ================= VARIABLES & DARK MODE LOGIC ================= */
:root {
    --primary: #4FB1E2;
    --primary-dark: #3a8eb8;
    --shadow: 0 15px 35px rgba(0,0,0,0.1);
    
    /* Colori Modalità Chiara (Default) */
    --bg-body: #f8f9fa;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --border-color: #eeeeee;
    --input-bg: #fafafa;
    --white-fixed: #ffffff; /* Colore che resta bianco (es. testo su bottoni) */
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-body: #121212;
        --bg-card: #1e1e1e;
        --bg-header: #181818;
        --text-main: #f0f0f0;
        --text-muted: #bbbbbb;
        --border-color: #333333;
        --input-bg: #252525;
        --shadow: 0 15px 35px rgba(0,0,0,0.3);
    }
    
    /* Riduce l'abbaglio delle immagini in dark mode */
    img { filter: brightness(.85) contrast(1.05); }
    
    /* Scurisce leggermente la mappa per non sparare troppo bianco */
    .map-container iframe { filter: grayscale(10%) invert(5%) contrast(100%); }
}

/* ================= RESET & BASE ================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Montserrat', sans-serif;
    color: var(--text-main);
    line-height: 1.7;
    background-color: var(--bg-body);
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4 { font-family: 'Comfortaa', cursive; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ================= HEADER & NAV ================= */
header {
    background-color: var(--bg-header);
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

nav { display: flex; justify-content: space-between; align-items: center; }

.nav-links { display: flex; list-style: none; }
.nav-links li a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    margin-left: 25px;
    transition: 0.3s;
}
.nav-links li a:hover, .nav-links li a.active { color: var(--primary); }

.menu-toggle { display: none; font-size: 24px; cursor: pointer; color: var(--primary); }

.logo a { display: flex; align-items: center; }
.logo img {
    max-height: 65px;
    width: auto;
    transition: transform 0.3s ease;
}
.logo img:hover { transform: scale(1.05); }

/* ================= HERO SECTIONS ================= */
.hero-home {
    background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('https://images.unsplash.com/photo-1576201836106-db1758fd1c97?auto=format&fit=crop&w=1600') center/cover;
    height: 75vh;
    display: flex; align-items: center; justify-content: center;
    color: var(--white-fixed); text-align: center;
}
.hero-home h1 { font-size: 3.5rem; margin-bottom: 20px; }

.page-header {
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('https://images.unsplash.com/photo-1583337130417-3346a1be7dee?auto=format&fit=crop&w=1200') center/cover;
    color: var(--white-fixed); padding: 80px 0; text-align: center; margin-bottom: 50px;
}

/* ================= BOTTONI ================= */
.btn {
    display: inline-block; background: var(--primary); color: var(--white-fixed);
    padding: 12px 30px; border-radius: 50px; text-decoration: none;
    font-weight: bold; border: 2px solid var(--primary); cursor: pointer; transition: 0.3s;
}
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); transform: translateY(-3px); box-shadow: 0 5px 15px rgba(79,177,226,0.4); }

.btn-outline {
    display: inline-block; background: transparent; color: var(--primary);
    padding: 10px 25px; border-radius: 50px; text-decoration: none;
    font-weight: bold; border: 2px solid var(--primary); cursor: pointer; transition: 0.3s;
    margin-top: auto;
}
.btn-outline:hover { background: var(--primary); color: var(--white-fixed); }

/* ================= GRIGLIE E CARDS ================= */
.overlap-cards {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px; margin-top: -80px; padding-bottom: 50px; position: relative; z-index: 10;
}

.grid-cards {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px; margin-bottom: 50px;
}

.card {
    background-color: var(--bg-card); padding: 40px 30px; border-radius: 15px;
    box-shadow: var(--shadow); text-align: center; transition: 0.3s;
    display: flex; flex-direction: column; justify-content: space-between;
}
.card:hover { transform: translateY(-10px); }
.card i { font-size: 45px; color: var(--primary); margin-bottom: 20px; }
.card h3 { margin-bottom: 15px; color: var(--text-main); }

.card.highlight { border-top: 5px solid var(--primary); }

/* -----------------------------------------
   STILI PER IL BADGE DEL CV
----------------------------------------- */
/* Assicura che l'icona resti ancorata alla card */
.relative-card {
    position: relative;
}

/* Stile dell'icona: niente palla, solo l'icona spostata più al centro */
.cv-badge {
    position: absolute;
    top: 22px;   /* Aumentato per staccarla di più dal bordo superiore */
    right: 22px; /* Aumentato per staccarla di più dal bordo destro */
    color: #5ab1e6; /* Il tuo colore azzurro */
    font-size: 1.5rem; /* Grandezza dell'icona */
    text-decoration: none;
    transition: transform 0.2s ease; /* Prepara l'animazione fluida */
    z-index: 10;
}

/* Effetto al passaggio del mouse */
.cv-badge:hover {
    transform: scale(1.2); /* Ingrandisce l'icona del 20% */
}


/* -----------------------------------------
   EFFETTO HOVER SULL'AVATAR DEL MEDICO
----------------------------------------- */
/* Assicuriamoci che l'avatar abbia una transizione fluida */
.avatar-placeholder {
    transition: all 0.3s ease; 
}

.avatar-placeholder i {
    transition: all 0.3s ease;
}

/* Quando l'utente passa il mouse sopra l'INTERA CARD, l'avatar si inverte */
.card:hover .avatar-placeholder {
    background-color: #5ab1e6; /* Sfondo azzurro */
    border-color: #5ab1e6; /* Bordo azzurro, se ne hai uno */
}

.card:hover .avatar-placeholder i {
    color: #1a1a1a; /* L'icona del medico diventa nera/scura */
}

/* ================= TESTI A SCOMPARSA (SERVIZI) ================= */
.service-full-text {
    display: none;
    text-align: left; font-size: 0.95rem; color: var(--text-muted);
    margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border-color);
}
.service-full-text.open { display: block; animation: fadeIn 0.4s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.btn-toggle {
    display: inline-block; background: transparent; color: var(--primary);
    padding: 8px 25px; border-radius: 50px; font-weight: bold;
    border: 2px solid var(--primary); cursor: pointer; transition: 0.3s;
    margin-top: 20px; font-size: 0.95rem; align-self: center;
}
.btn-toggle:hover { background: var(--primary); color: var(--white-fixed); }

/* ================= DOVE SIAMO E CONTATTI ================= */
.contact-wrapper { display: grid; grid-template-columns: 1fr 1.5fr; gap: 40px; margin-bottom: 50px; }
.contact-info-box { background-color: var(--bg-card); padding: 40px; border-radius: 15px; box-shadow: var(--shadow); }
.contact-info-box i { color: var(--primary); margin-right: 10px; width: 25px; text-align: center; }

.map-container {
    width: 100%; border-radius: 15px; overflow: hidden;
    box-shadow: var(--shadow); height: 100%; min-height: 400px;
}

/* ================= FORM CONTATTI MODERNO ================= */
.contact-form-modern { display: flex; flex-direction: column; gap: 20px; }
.form-subtitle {
    font-size: 0.95rem; color: var(--text-muted); margin-bottom: 10px;
    border-left: 3px solid var(--primary); padding-left: 10px; text-align: left;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.input-group { display: flex; flex-direction: column; text-align: left; }
.input-group label { font-size: 0.9rem; font-weight: 700; color: var(--text-main); margin-bottom: 8px; }

.input-group input, .input-group textarea {
    width: 100%; padding: 14px 16px; border: 1px solid var(--border-color);
    border-radius: 8px; font-family: inherit; font-size: 1rem;
    background-color: var(--input-bg); color: var(--text-main); transition: 0.3s;
}
.input-group input:focus, .input-group textarea:focus {
    outline: none; border-color: var(--primary); background-color: var(--bg-card);
    box-shadow: 0 0 0 4px rgba(79, 177, 226, 0.15);
}

/* ================= FOOTER ================= */
footer { background: #1a1a1a; color: #bbbbbb; padding: 50px 0 20px; margin-top: 50px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; margin-bottom: 30px; }

.fab-call {
    position: fixed; bottom: 30px; right: 30px; background: #25D366;
    color: white; width: 60px; height: 60px; border-radius: 50%; display: flex;
    justify-content: center; align-items: center; font-size: 24px;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4); z-index: 1000; transition: 0.3s; text-decoration: none;
}
.fab-call:hover { transform: scale(1.1); }

/* ================= RESPONSIVE ================= */
@media (max-width: 768px) {
    .hero-home h1 { font-size: 2.2rem; }
    .form-row { grid-template-columns: 1fr; }
    .contact-wrapper { grid-template-columns: 1fr; }
    .overlap-cards { margin-top: -30px; }

    .nav-links {
        position: fixed; top: 0; right: -100%; width: 80%; max-width: 300px;
        height: 100vh; background-color: var(--bg-header); flex-direction: column;
        justify-content: center; align-items: center; box-shadow: -5px 0 20px rgba(0,0,0,0.15);
        transition: right 0.4s cubic-bezier(0.77, 0, 0.175, 1); z-index: 1000; display: flex;
    }
    .nav-links.active { right: 0; }
    .nav-links li { margin-bottom: 25px; }
    .nav-links li a { margin-left: 0; font-size: 1.2rem; }
    .menu-toggle { display: block; z-index: 1001; position: relative; }
}

.overlay-menu {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 999; opacity: 0; visibility: hidden; transition: 0.3s;
}
.overlay-menu.active { opacity: 1; visibility: visible; }

/* ================= SFONDI ================= */
.bg-chi-siamo { background-image: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('https://images.unsplash.com/photo-1606425271394-c3ca9aa1fc06?auto=format&fit=crop&w=1600'); }
.bg-servizi { background-image: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('https://images.unsplash.com/photo-1583337130417-3346a1be7dee?auto=format&fit=crop&w=1600'); }
.bg-dove-siamo { background-image: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('https://images.unsplash.com/photo-1517423440428-a5a00ad493e8?auto=format&fit=crop&w=1600'); }
.bg-contatti { background-image: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('https://images.unsplash.com/photo-1514888286974-6c03e2ca1dba?auto=format&fit=crop&w=1600'); }

/* ================= AVATAR ================= */
.avatar-placeholder {
    width: 120px; height: 120px; background-color: var(--input-bg);
    border: 4px solid var(--border-color); border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    margin: 0 auto 15px auto; font-size: 50px; color: var(--primary); transition: 0.3s;
}
.card:hover .avatar-placeholder { background-color: var(--primary); color: var(--white-fixed); transform: scale(1.05); }