* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Helvetica Neue', Arial, sans-serif;
}

/* Prevenzione overflow orizzontale */
*, *::before, *::after {
    max-width: 100%;
    box-sizing: border-box;
}

img, video, iframe, canvas, svg {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Prevenzione overflow per elementi con larghezza fissa */
.section, .gallery, .hero {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body {
    background-color: #ffffff;
    color: #333;
    line-height: 1.6;
}

header {
    background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('muro.png');
    background-size: cover;
    background-position: center;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 20px;
    color: #fff;
}

/* Stile per la barra di navigazione */
nav {
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: relative;
    width: 100%;
    z-index: 1000;
    padding: 15px 0;
}

nav ul {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

nav li {
    margin: 0 15px;
}

nav a {
    text-decoration: none;
    transition: all 0.3s ease;
}

/* Stile per i link testuali */
nav a.scritte {
    color: #333;
    font-weight: 500;
    font-size: 16px;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

nav a.scritte:hover {
    background-color: #f5f5f5;
    color: #000;
    transform: translateY(-2px);
}

/* Stile per i link con icone */
nav a.loghi {
    color: #555;
    font-size: 18px;
    padding: 8px;
    border-radius: 50%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    background-color: #f8f8f8;
    transition: all 0.3s ease;
}

nav a.loghi:hover {
    background-color: #333;
    color: #fff;
    transform: translateY(-2px);
}

nav a.loghi:hover i {
    color: #fff;
}

/* Stile responsive per tablet */
@media (max-width: 768px) {
    nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    nav li {
        margin: 5px 8px;
    }
    
    nav a.scritte {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero p {
        font-size: 1.1rem;
    }
    
    .section {
        padding: 40px 15px;
    }
    
    .container {
        max-width: 95%;
    }
}

/* Header ora scorre con la pagina */
body {
    padding-top: 0;
}

nav ul li {
    margin: 0 20px;
}

/* Rimuovi o commenta queste regole che causano conflitti */
/*
nav ul li a {
    text-decoration: none;
    color: #333;
    font-weight: 400;
    transition: color 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

nav ul li a:hover {
    color: #999;
}
*/

.logo {
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 300;
    letter-spacing: 3px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.stars {
    margin-bottom: 10px;
}

.stars i {
    color: #ffffff;
    font-size: 1rem;
    margin: 0 3px;
}

.tagline {
    font-size: 1.2rem;
    margin-bottom: 30px;
    font-weight: 300;
    color: #fff;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.btn {
    display: inline-block;
    background-color: transparent;
    color: #fff;
    padding: 12px 30px;
    border: 1px solid #fff;
    text-decoration: none;
    font-weight: 400;
    transition: all 0.3s;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.btn:hover {
    background-color: #fff;
    color: #333;
}

section {
    padding: 80px 20px;
}

.container {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 0 15px;
}

h2 {
    text-align: center;
    margin-bottom: 50px;
    font-size: 1.8rem;
    color: #333;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
}

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

.room {
    background-color: #fff;
    overflow: hidden;
    transition: transform 0.3s;
}

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

.room img {
    width: 100%;
    height: 250px;
    object-fit: cover;
}

.room-info {
    padding: 20px 0;
}

.room-info h3 {
    margin-bottom: 10px;
    color: #333;
    font-weight: 400;
}

.price {
    font-weight: 400;
    color: #666;
    font-size: 1rem;
    margin-top: 10px;
}

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

.feature {
    text-align: center;
    padding: 20px;
}

.feature i {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 20px;
}

.about {
    background-color: #ffffff;
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
}

.about-img img {
    width: 100%;
}

.contact {
    background-color: #fff;
    padding: 80px 20px;
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 50px;
    align-items: start;
}

.contact-info {
    padding: 30px;
    background-color: #f8f8f8;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.contact-form {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border: 1px solid #f0f0f0;
}

.form-group {
    margin-bottom: 25px;
    position: relative;
}

/* Stile per i placeholder */
input::placeholder, textarea::placeholder, select::placeholder {
    color: #999;
    font-style: italic;
}

/* Stile per i campi richiesti */
input[required], textarea[required], select[required] {
    position: relative;
}

input[required]:invalid {
    border-color: #ddd;
}

input[required]:valid {
    border-color: #51cf66;
}

/* Messaggio di successo/errore */
#form-message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 500;
    display: none;
}

#form-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#form-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.contact-info h3 {
    margin-bottom: 20px;
    font-weight: 400;
    font-size: 1.3rem;
}

.contact-info p {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.contact-info i {
    margin-right: 10px;
    color: #555;
    width: 20px;
}

.contact-hours {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.contact-hours h4 {
    margin-bottom: 15px;
    font-weight: 400;
    font-size: 1.1rem;
}



.form-row {
    display: flex;
    gap: 15px;
}

.half {
    flex: 1;
}

.location {
    background-color: white;
}

.location-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

.directions h3 {
    margin-bottom: 15px;
}

.directions p {
    margin-bottom: 10px;
}

input, textarea, select {
    width: 100%;
    padding: 15px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    background-color: #ffffff;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #333;
    background-color: #fafafa;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

input:hover, textarea:hover, select:hover {
    border-color: #999;
    box-shadow: 0 3px 8px rgba(0,0,0,0.08);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 16px;
    cursor: pointer;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

button {
    background: linear-gradient(135deg, #333 0%, #555 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 15px 30px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    width: 100%;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}

button:hover {
    background: linear-gradient(135deg, #555 0%, #777 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* Effetto ripple per il button */
button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transition: width 0.6s, height 0.6s;
    transform: translate(-50%, -50%);
    z-index: 0;
}

button:active::before {
    width: 300px;
    height: 300px;
}

footer {
    background-color: #f8f8f8;
    color: #000;
    text-align: center;
    padding: 30px 20px;
    font-size: 0.9rem;
}

footer a {
    color: #000;
    text-decoration: none;
    transition: color 0.3s;
}

footer a:hover {
    color: #333;
}

.social-links {
    margin-top: 20px;
}

.social-links a {
    color: #333;
    margin: 0 10px;
    font-size: 1.2rem;
    transition: color 0.3s;
}

.social-links a:hover {
    color: #999;
}

nav ul li a i {
    font-size: 1.1rem;
    color: #333;
    transition: color 0.3s;
}

nav ul li a:hover i {
    color: #999;
}

/* Stile specifico per le icone di contatto nella nav */
nav ul li:nth-child(n+7) a {
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f8f8;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    transition: all 0.3s;
}

nav ul li:nth-child(n+6) a:hover {
    background-color: #333;
    color: #fff;
}

nav ul li:nth-child(n+6) a:hover i {
    color: #fff;
}

@media (max-width: 768px) {
    /* Manteniamo il layout a colonne per mobile */
    .about-content {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
    
    .location-content {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
    
    /* Miglioriamo il layout del form contatti su tablet */
    .contact-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .contact-info {
        padding: 20px;
    }
    
    .contact-form {
        padding: 20px;
    }
    
    /* Manteniamo il menu orizzontale */
    nav {
        padding: 15px 0;
        position: sticky;
        background-color: rgba(255, 255, 255, 0.95);
    }
    
    nav ul {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
    }
    
    nav ul li {
        margin: 5px 10px;
        font-size: 0.8rem;
    }
    
    /* Miglioriamo il layout per le date su tablet */
    .form-row {
        display: flex;
        flex-direction: row;
        gap: 15px;
    }
    
    /* Ottimizziamo i campi del form per tablet */
    input, textarea, select {
        padding: 12px 15px;
        font-size: 16px; /* Previene lo zoom su iOS */
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    /* Adattiamo la mappa */
    .map iframe {
        height: 350px;
    }
    
    /* Adattiamo i font */
    .logo {
        font-size: 1.8rem;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    h2 {
        font-size: 1.6rem;
        margin-bottom: 40px;
    }
    
    /* Adattiamo le camere */
    .rooms {
        gap: 20px;
    }
}

/* Per schermi medi - Tablet piccoli e telefoni grandi */
@media (max-width: 600px) and (min-width: 481px) {
    .contact-content {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .contact-info, .contact-form {
        padding: 25px;
    }
    
    .form-row {
        display: flex;
        flex-direction: row;
        gap: 12px;
    }
    
    input, textarea, select {
        padding: 14px 16px;
        font-size: 16px;
    }
    
    button {
        padding: 14px 25px;
        font-size: 0.95rem;
    }
}

/* Per schermi molto piccoli - Mobile */
@media (max-width: 480px) {
    .hero h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero p {
        font-size: 1rem;
        margin: 15px 0;
    }
    
    .section {
        padding: 30px 10px;
    }
    
    .container {
        max-width: 98%;
        padding: 0 5px;
    }
    
    nav ul {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        padding: 5px;
    }
    
    nav li {
        margin: 2px 4px;
    }
    
    nav a.scritte {
        font-size: 11px;
        padding: 6px 8px;
    }
    
    .about-content, .location-content, .contact-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    /* Assicuriamo che su mobile le info di contatto siano sopra il form */
    .contact-content {
        display: flex;
        flex-direction: column;
    }
    
    .contact-info {
        order: 1;
        margin-bottom: 20px;
        padding: 20px;
    }
    
    .contact-form {
        order: 2;
        padding: 20px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .room img {
        height: 180px;
    }
    
    .map iframe {
        height: 200px;
    }
    
    h2 {
        font-size: 1.8rem;
    }
    
    h3 {
        font-size: 1.3rem;
    }
    
    p, li {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    /* Ottimizzazioni per form e bottoni su mobile */
    input, textarea, select {
        padding: 12px 15px;
        font-size: 16px; /* Previene lo zoom su iOS */
        border-radius: 6px;
    }
    
    button {
        padding: 14px 20px;
        font-size: 0.95rem;
        border-radius: 8px;
        margin-top: 10px;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    .form-row {
        margin-bottom: 15px;
    }
    
    textarea {
        min-height: 100px;
    }
}

/* Per schermi extra piccoli - Telefoni piccoli */
@media (max-width: 320px) {
    .hero h1 {
        font-size: 1.6rem;
    }
    
    .hero p {
        font-size: 0.9rem;
    }
    
    .section {
        padding: 20px 5px;
    }
    
    nav a.scritte {
        font-size: 10px;
        padding: 4px 6px;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    p, li {
        font-size: 0.8rem;
    }
    
    .room img {
        height: 150px;
    }
    
    .map iframe {
        height: 180px;
    }
    
    /* Form e bottoni per schermi extra piccoli */
    input, textarea, select {
        padding: 10px 12px;
        font-size: 16px;
    }
    
    button {
        padding: 10px 15px;
        font-size: 0.8rem;
    }
    
    textarea {
        min-height: 80px;
    }
}

/* Stili per la galleria */
.gallery {
    background-color: #fff;
    padding: 60px 20px;
}

.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    grid-auto-rows: 200px;
    gap: 2px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    grid-auto-flow: dense;
    box-sizing: border-box;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    cursor: pointer;
}

/* Layout uniforme per eliminare spazi vuoti */
.gallery-item {
    grid-column: span 1;
    grid-row: span 1;
}

/* Alcune variazioni per mantenere interesse visivo */
.gallery-item:nth-child(5n+1) { 
    grid-row: span 2; 
}
.gallery-item:nth-child(7n+3) { 
    grid-column: span 2; 
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
    z-index: 10;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* Stili per il modale delle foto */
.foto-modale {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.foto-modale-contenuto {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.foto-modale-contenuto img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.chiudi-modale {
    position: absolute;
    top: 15px;
    right: 25px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
}

.nav-foto {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    padding: 16px;
    user-select: none;
    z-index: 2001;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s;
}

.nav-foto:hover {
    background-color: rgba(0, 0, 0, 0.6);
}

.prev {
    left: 20px;
}

.next {
    right: 20px;
}

/* Adattamento per dispositivi mobili */
@media (max-width: 768px) {
    .gallery {
        padding: 40px 15px;
    }
    
    .gallery-container {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        grid-auto-rows: 140px;
        gap: 3px;
    }
    
    /* Pattern semplificato per tablet */
    .gallery-item:nth-child(4n+1) { grid-row: span 2; }
    .gallery-item:nth-child(6n+3) { grid-column: span 2; }
}

@media (max-width: 480px) {
    .gallery {
        padding: 30px 10px;
    }
    
    .gallery-container {
        grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
        grid-auto-rows: 90px;
        gap: 2px;
    }
    
    /* Pattern molto semplificato per mobile */
    .gallery-item { 
        grid-column: span 1; 
        grid-row: span 1; 
        border-radius: 4px;
    }
    .gallery-item:nth-child(4n+1) { grid-row: span 2; }
    
    .prev, .next {
        font-size: 18px;
        width: 35px;
        height: 35px;
    }
    
    .prev { left: 10px; }
    .next { right: 10px; }
}

@media (max-width: 320px) {
    .gallery {
        padding: 20px 5px;
    }
    
    .gallery-container {
        grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));
        grid-auto-rows: 75px;
        gap: 1px;
    }
    
    .gallery-item {
        border-radius: 3px;
    }
}