/* Stili Generali e Reset */
:root {
    --primary-color: #2c3e50; /* Blu scuro e professionale */
    --accent-color: #3498db; /* Azzurro per accenti e link */
    --text-color: #34495e; /* Grigio scuro per il testo principale */
    --light-bg: #ecf0f1; /* Sfondo grigio chiaro molto delicato */
    --white: #ffffff;
    --border-color: #dcdde1; 
    --shadow-color: rgba(0, 0, 0, 0.08); 
}

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

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    /* Impostiamo overflow-x: hidden sul contenitore principale per prevenire overflow */
    overflow-x: hidden; 
    padding: 0 20px; 
}

a {
    color: var(--accent-color); 
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #2980b9; 
}

/* Header */
header {
    background: var(--primary-color);
    color: var(--white);
    padding: 40px 0;
    text-align: center;
    box-shadow: 0 4px 8px var(--shadow-color);
}

header h1 {
    font-size: 2.8em;
    margin-bottom: 10px;
    font-weight: 700;
}

header h2 {
    font-size: 1.4em;
    font-weight: 300;
    opacity: 0.9;
}

/* Main Content */
main {
    flex: 1; 
    padding: 40px 0;
}

.card {
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 4px 15px var(--shadow-color);
    margin-bottom: 30px;
    padding: 30px;
    border: 1px solid var(--border-color);
}

.card h3 {
    color: var(--primary-color);
    font-size: 2em;
    margin-bottom: 20px;
    font-weight: 700;
    text-align: center;
}

.card p {
    margin-bottom: 15px;
    font-size: 1.1em;
    line-height: 1.8;
}

/* Sezione Info Medico */
#info-medico {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 30px;
}

#info-medico .testo-info {
    flex: 2;
    min-width: 300px;
}

#info-medico .testo-info h3 {
    text-align: left;
    margin-top: 0;
}

.contatti-dettaglio {
    background-color: var(--light-bg);
    border-left: 5px solid var(--accent-color); 
    padding: 20px;
    border-radius: 5px;
    margin-top: 25px;
}

.contatti-dettaglio h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.3em;
}

.contatti-dettaglio p {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    font-size: 1.05em;
    /* Soluzione 1: Forzare le parole lunghe ad andare a capo */
    word-break: break-word; 
}

.contatti-dettaglio p i {
    margin-right: 10px;
    font-size: 1.2em;
    color: var(--accent-color); 
    /* Soluzione 2: L'icona è un elemento a parte e non dovrebbe forzare l'overflow */
    flex-shrink: 0;
}


.foto-container {
    flex: 1;
    min-width: 250px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.foto-container img {
    max-width: 100%;
    height: auto;
    border-radius: 50%;
    border: 5px solid var(--accent-color);
    box-shadow: 0 8px 20px var(--shadow-color);
    width: 250px;
    height: 250px;
    object-fit: cover; 
    object-position: top center; 
}


/* Sezione Posizione Studio */
#posizione-studio.card {
    padding: 0;
    overflow: hidden;
}

.mappa-header {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 20px 30px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    text-align: center;
}

.mappa-header h3 {
    color: var(--white);
    margin: 0;
    font-size: 1.8em;
}

.mappa-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

.mappa-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

/* Footer */
footer {
    background: var(--primary-color); 
    color: var(--white);
    text-align: center;
    padding: 25px 0;
    margin-top: 50px;
    font-size: 0.9em;
    box-shadow: 0 -4px 8px var(--shadow-color);
}

/* Media Queries per la responsività */
/* STILI PER TABLET E MOBILE LARGO (sotto i 768px) */
@media (max-width: 768px) {
    .container {
        padding: 0 15px; 
    }
    header h1 {
        font-size: 2.2em;
    }

    header h2 {
        font-size: 1.2em;
    }

    .card {
        padding: 20px;
    }

    .card h3 {
        font-size: 1.8em;
    }

    #info-medico {
        flex-direction: column; 
        text-align: center;
    }

    .foto-container {
        order: 1; 
        margin-bottom: 20px;
    }

    #info-medico .testo-info {
        order: 2; 
    }

    #info-medico .testo-info h3 {
        text-align: center;
    }

    .foto-container img {
        width: 180px; 
        height: 180px;
    }

    .contatti-dettaglio {
        text-align: left;
    }

    .mappa-header h3 {
        font-size: 1.5em;
    }
}

/* STILI PER SMARTPHONE (sotto i 480px) */
@media (max-width: 480px) {
    /* Assicuriamo che nulla forzi l'overflow */
    body {
        overflow-x: hidden;
    }
    
    header {
        padding: 30px 0;
    }

    header h1 {
        font-size: 1.8em;
    }

    header h2 {
        font-size: 1em;
    }

    main {
        padding: 20px 0;
    }

    .card {
        margin-bottom: 15px;
    }

    .contatti-dettaglio p {
        font-size: 0.95em;
        padding: 5px 0; 
        /* Rimuoviamo la flexbox orizzontale e lasciamo che l'icona e il testo si gestiscano come blocco. */
        display: block; 
    }
    
    .contatti-dettaglio p i {
        /* Rimuoviamo il flex-shrink specifico per il mobile se usiamo display: block; */
        margin-right: 5px; /* Riduciamo lo spazio */
    }
    
    .mappa-header {
        padding: 15px 15px;
    }
}