/* =================================================================== */
/* ============= FOGLIO DI STILE COMPLETO E DEFINITIVO =============== */
/* =================== TROVAGLUTENFREE.IT ============================ */
/* =================================================================== */


/* ------------------------------------------------------------------- */
/* 1. VARIABILI GLOBALI E STILI DI BASE
/* ------------------------------------------------------------------- */
:root {
    /* TUA NUOVA PALETTE COLORI */
    --primary-color: #357638; /* Verde Scuro */
    --primary-color-dark: #2a5a2c; /* Versione più scura per hover */
    --secondary-color: #e9b109; /* Giallo Ocra */
    --background-color: #eedaba; /* Beige di sfondo */
    --white-color: #f9f2e5; /* "Finto bianco" per le card */
    
    /* Colori di servizio */
    --text-color: #333;
    --text-color-light: #666;
    --border-color: #e0e0e0;
    --danger-color: #c62828; /* Rosso per errori/alert */
    --danger-background: #ffebee;
    
    /* Misure e Ombre */
    --container-padding: 20px;
    --border-radius: 8px;
    --form-border-radius: 16px;
    --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-strong: 0 8px 32px rgba(0, 0, 0, 0.1);
}

@font-face {
    font-family: 'Karla';
    src: url('../fonts/Karla-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Karla';
    src: url('../fonts/Karla-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

body {
    font-family: 'Karla', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main { flex: 1; }
hr { border: 0; height: 1px; background-color: var(--border-color); margin: 30px 0; }

/* MODIFICA CHIAVE N.1: Regola generale per i link */
a {
    color: var(--primary-color);
    text-decoration: none; /* Rimuove la sottolineatura da TUTTI i link di default */
}
a:hover {
    color: var(--primary-color-dark);
    text-decoration: underline; /* La sottolineatura appare SOLO al passaggio del mouse */
}


/* ------------------------------------------------------------------- */
/* 2. LAYOUT PRINCIPALE (HEADER, FOOTER)
/* ------------------------------------------------------------------- */
header { background-color: var(--white-color); box-shadow: var(--shadow-light); padding: 0 var(--container-padding); }
nav { display: flex; justify-content: space-between; align-items: center; min-height: 80px; max-width: 1200px; margin: 0 auto; flex-wrap: wrap; }
.logo a { display: flex; align-items: center; }
.logo img { max-width: 220px; height: auto; display: block; }
.menu a { margin-left: 15px; font-weight: bold; }
footer { text-align: center; padding: var(--container-padding); background-color: var(--secondary-color); color: #000000; }
.menu2 a { margin-left: 15px; text-decoration: none; color: var(--text-color); font-weight: bold; }


/* ------------------------------------------------------------------- */
/* 3. STILI HOMEPAGE
/* ------------------------------------------------------------------- */
.intro-text { text-align: center; padding: 20px; max-width: 800px; margin: 20px auto; }
.intro-text h1 { color: var(--primary-color); }
.map-container { position: relative; max-width: 1200px; margin: 20px auto; padding: 0 20px; }
#map { height: 500px; width: 100%; border-radius: var(--border-radius); box-shadow: var(--shadow-light); }
#geolocate-btn { position: absolute; top: 10px; right: 10px; z-index: 401; background-color: var(--white-color); color: var(--text-color); border: 2px solid rgba(0,0,0,0.2); border-radius: 4px; padding: 8px; cursor: pointer; font-size: 1.2em; line-height: 1; box-shadow: 0 1px 5px rgba(0,0,0,0.65); }
#geolocate-btn:hover { background-color: #f4f4f4; }
.content-section { max-width: 1200px; margin: 40px auto; padding: 0 var(--container-padding); }
.content-section h2 { text-align: center; margin-bottom: 30px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-top: 20px; }

.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}
/* MODIFICA CHIAVE N.2: Impedisce la sottolineatura sulle card */
.card-link:hover {
    text-decoration: none;
}

.locale-card, .recensione-card { background-color: var(--white-color); border-radius: var(--border-radius); padding: 20px; box-shadow: var(--shadow-light); transition: transform 0.2s, box-shadow 0.2s; height: 100%; box-sizing: border-box; display: flex; flex-direction: column; }
.locale-card:hover, .recensione-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-strong); }
.locale-card h3, .recensione-card h4 { margin-top: 0; margin-bottom: 10px; }
.locale-card-address { flex-grow: 1; color: var(--text-color-light); }
.recensione-card blockquote { flex-grow: 1; margin: 10px 0; padding-left: 15px; border-left: 3px solid var(--primary-color); font-style: italic; color: var(--text-color-light);}
.recensione-card .author { padding-top: 10px; text-align: right; font-weight: bold; }


/* ------------------------------------------------------------------- */
/* 4. NUOVO STILE PER I FORM
/* ------------------------------------------------------------------- */
.form-container { max-width: 500px; margin: 40px auto; padding: 40px; background-color: var(--white-color); border-radius: var(--form-border-radius); box-shadow: var(--shadow-strong); border: 1px solid rgba(255, 255, 255, 0.2); }
.form-header { text-align: center; margin-bottom: 30px; }
.form-header h1 { margin: 0; font-size: 2em; color: var(--text-color); }
.form-header p { margin-top: 8px; color: var(--text-color-light); font-size: 0.95em; }
.form-group { margin-bottom: 20px; position: relative; }
.form-group label { display: block; font-weight: bold; margin-bottom: 8px; color: #555; font-size: 0.9em; }
.form-input { width: 100%; padding: 12px 15px; border: 1px solid var(--border-color); border-radius: var(--border-radius); background-color: #f9f9f9; font-size: 1em; color: var(--text-color); box-sizing: border-box; transition: border-color 0.3s, box-shadow 0.3s; }
.form-input:focus { outline: none; border-color: var(--primary-color); background-color: var(--white-color); box-shadow: 0 0 0 3px rgba(53, 118, 56, 0.2); }
textarea.form-input { resize: vertical; min-height: 120px; }
.form-btn { width: 100%; padding: 15px; border: none; border-radius: var(--border-radius); background-color: var(--primary-color); color: var(--white-color); font-size: 1.1em; font-weight: bold; cursor: pointer; transition: background-color 0.3s, transform 0.2s; margin-top: 10px; }
.form-btn:hover { background-color: var(--primary-color-dark); transform: translateY(-2px); }
.btn-centered { display: block; width: fit-content; margin-left: auto; margin-right: auto; text-decoration: none; }
.form-footer { text-align: center; margin-top: 25px; font-size: 0.9em; }
.form-footer a { color: var(--primary-color); font-weight: bold; }
.form-message { padding: 15px; margin-bottom: 20px; border-radius: var(--border-radius); text-align: center; }
.form-message.error { background-color: var(--danger-background); color: var(--danger-color); border: 1px solid var(--danger-color); }
.form-message.success { background-color: #e8f5e9; color: #2e7d32; border: 1px solid #2e7d32; }
.form-divider { border: 0; height: 1px; background-color: var(--border-color); margin: 30px 0; }
/* NUOVI STILI PER LA VALIDAZIONE IN TEMPO REALE (CORRETTI) */
.validation-message {
    font-size: 0.85em;
    margin-top: 5px;
    padding-left: 5px;
}
.validation-message.error {
    color: var(--danger-color);
}
.validation-message.success {
    color: var(--primary-color);
}
.validation-message.loading {
    color: var(--text-color-light);
}

.form-input-wrapper {
    position: relative;
}
.form-input-wrapper .validation-icon {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    display: none; /* Nascosto di default */
}

/* MODIFICA CHIAVE QUI: Selettori più specifici */
.form-input.is-valid ~ .validation-icon.success {
    display: block;
}
.form-input.is-invalid ~ .validation-icon.error {
    display: block;
}
/* FINE MODIFICA */

.form-input.is-valid {
    border-color: var(--primary-color);
}
.form-input.is-invalid {
    border-color: var(--danger-color);
}

/* ------------------------------------------------------------------- */
/* 5. NUOVO STILE SCHEDA LOCALE
/* ------------------------------------------------------------------- */
.scheda-container { display: grid; grid-template-columns: 2fr 1fr; gap: 30px; max-width: 1200px; margin: 40px auto; padding: var(--container-padding); }
.scheda-main-content { background-color: var(--white-color); padding: 30px; border-radius: var(--border-radius); box-shadow: var(--shadow-light); }
.scheda-main-content h2 { margin-top: 40px; }
.scheda-sidebar { position: sticky; top: 20px; }
.sidebar-card { background-color: var(--white-color); padding: 20px; border-radius: var(--border-radius); box-shadow: var(--shadow-light); margin-bottom: 20px; }
.sidebar-card h3 { margin-top: 0; }
#scheda-map { height: 250px; width: 100%; border-radius: var(--border-radius); }
.locale-info-list { list-style: none; padding: 0; margin-top: 20px; }
.info-item { display: flex; align-items: center; margin-bottom: 15px; font-size: 1.05em; }
.info-item i { font-size: 1.2em; color: var(--primary-color); width: 30px; text-align: center; margin-right: 15px; }
.info-item a { font-weight: bold; }
.recensione-item { display: flex; gap: 15px; }
.recensione-avatar { width: 45px; height: 45px; border-radius: 50%; background-color: var(--primary-color); color: var(--white-color); display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 1.2em; flex-shrink: 0; }
.recensione-body { flex-grow: 1; }
.btn-problema { display: block; width: 100%; box-sizing: border-box; padding: 10px; background-color: var(--danger-color); color: white; text-align: center; text-decoration: none; border-radius: var(--border-radius); font-size: 0.9em; font-weight: bold; }
.btn-problema:hover { background-color: #b71c1c; }
.form-recensione { margin-top: 0; padding: 0; background-color: transparent; border: none; }
.locale-features { margin-top: 30px; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 15px; list-style: none; padding: 0; }
.feature-item { display: flex; align-items: center; gap: 10px; background-color: #f8f9fa; padding: 10px; border-radius: var(--border-radius); }
.feature-item i { color: var(--primary-color); font-size: 1.2em; }
.locale-tipologia-header { color: #666; font-weight: bold; display: flex; align-items: center; gap: 8px; margin-bottom: 0; }
.tipologia-icon { height: 35px; width: 35px; }


/* ------------------------------------------------------------------- */
/* 6. STILE PAGINE DI CONTENUTO (PRIVACY, TERMINI, ECC.)
/* ------------------------------------------------------------------- */
.content-page-container { max-width: 900px; margin: 40px auto; padding: 40px; background-color: var(--white-color); border-radius: var(--border-radius); box-shadow: var(--shadow-light); line-height: 1.7; }
.content-page-container h1 { text-align: center; margin-top: 0; margin-bottom: 30px; }
.content-page-container h2 { margin-top: 30px; margin-bottom: 15px; padding-bottom: 5px; border-bottom: 1px solid var(--border-color); }
.content-page-container p, .content-page-container ul { margin-bottom: 15px; }
.content-page-container ul { padding-left: 25px; }
.content-page-container li { margin-bottom: 10px; }


/* ------------------------------------------------------------------- */
/* 7. STILE DASHBOARD AMMINISTRATORE
/* ------------------------------------------------------------------- */
.admin-container { max-width: 1200px; margin: 40px auto; padding: var(--container-padding); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; margin-bottom: 40px; }
.stat-card { background-color: var(--white-color); padding: 25px; border-radius: var(--border-radius); box-shadow: var(--shadow-light); display: flex; align-items: center; gap: 20px; }
.stat-card .icon { font-size: 2.5em; color: var(--primary-color); }
.stat-card .info .number { font-size: 2.2em; font-weight: bold; display: block; }
.stat-card .info .label { color: var(--text-color-light); }
.admin-panel { background-color: var(--white-color); border-radius: var(--border-radius); box-shadow: var(--shadow-light); margin-bottom: 40px; overflow: hidden; }
.admin-panel-header { padding: 20px; border-bottom: 1px solid var(--border-color); }
.admin-panel-header h2 { margin: 0; }
.admin-panel-body { padding: 20px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 15px; text-align: left; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.data-table thead th { font-size: 0.9em; text-transform: uppercase; color: var(--text-color-light); background-color: #f8f9fa; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-admin { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 6px; text-decoration: none; font-weight: bold; font-size: 0.9em; border: 1px solid transparent; transition: all 0.2s; }
.btn-admin i { font-size: 1.1em; }
.btn-approve { background-color: #e8f5e9; color: #2e7d32; border-color: #a5d6a7; }
.btn-approve:hover { background-color: #c8e6c9; color: #1b5e20; }
.btn-reject { background-color: var(--danger-background); color: var(--danger-color); border-color: #ef9a9a; }
.btn-reject:hover { background-color: #ffcdd2; color: #b71c1c; }
.btn-resolve { background-color: #e3f2fd; color: #0d47a1; border-color: #90caf9; }
.btn-resolve:hover { background-color: #bbdefb; color: #0a3a82; }
.btn-edit { background-color: #fffde7; color: #f57f17; border-color: #fff176; }
.btn-edit:hover { background-color: #fff9c4; color: #e65100; }
.admin-panel-controls { display: flex; justify-content: space-between; align-items: center; padding: 20px; border-bottom: 1px solid var(--border-color); }
.admin-search-form { display: flex; gap: 10px; }
.pagination { display: flex; justify-content: center; align-items: center; padding: 20px; gap: 10px; flex-wrap: wrap; }
.pagination a, .pagination span { display: inline-block; padding: 8px 12px; border: 1px solid var(--border-color); border-radius: 6px; text-decoration: none; color: var(--text-color); }
.pagination a:hover { background-color: #f0f0f0; }
.pagination span.current, .pagination a.current { background-color: var(--primary-color); color: var(--white-color); border-color: var(--primary-color); font-weight: bold; }
.pagination span.disabled {
    color: #ccc;
    border-color: #eee;
}

/* NUOVA REGOLA PER IL PULSANTE AGGIUNGI LOCALE */
.admin-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* ------------------------------------------------------------------- */
/* 8. STILI GENERICI, RICERCA E UPLOAD
/* ------------------------------------------------------------------- */
.stars { --percent: calc(var(--rating) / 5 * 100%); display: inline-block; font-size: 24px; font-family: Times; line-height: 1; }
.stars::before { content: '★★★★★'; letter-spacing: 3px; background: linear-gradient(90deg, var(--secondary-color) var(--percent), #c7c7c7 var(--percent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.locale-card .stars, .recensione-card .stars, .recensione-item .stars { font-size: 18px; }
.social-links { display: flex; justify-content: center; gap: 20px; margin-top: 15px; }
.social-links a { font-size: 1.8em; transition: color 0.3s, transform 0.3s; }
.search-container { max-width: 1200px; margin: 20px auto; padding: 25px; background-color: var(--white-color); border-radius: var(--border-radius); box-shadow: var(--shadow-light); }
#search-form { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: end; }
#search-form .search-input-group { display: flex; align-items: center; border: 1px solid var(--border-color); border-radius: var(--border-radius); overflow: hidden; }
#search-form .search-input-group i { padding: 0 15px; color: var(--text-color-light); }
#search-form input[type="text"] { flex-grow: 1; border: none; padding: 15px; font-size: 1.1em; }
#search-form input[type="text"]:focus { outline: none; }
#search-form button { padding: 15px 30px; font-size: 1.1em; }
.filters-group { grid-column: 1 / -1; padding-top: 15px; border-top: 1px solid #f0f0f0; margin-top: 15px; }
.filters-group legend { font-weight: bold; margin-bottom: 10px; }
.filters-group .filter-options { display: flex; flex-wrap: wrap; gap: 15px; }
.filter-options label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.locale-gallery h2 { margin-top: 40px; margin-bottom: 20px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));gap: 15px; }
.gallery-item img { width: 100%; height: 120px; object-fit: cover; border-radius: var(--border-radius); transition: transform 0.3s; }
.gallery-item img:hover { transform: scale(1.05); }
.upload-form-container { border: 2px dashed var(--border-color); border-radius: var(--border-radius); padding: 20px; text-align: center; transition: border-color 0.3s, background-color 0.3s; }
.upload-form-container.dragover { border-color: var(--primary-color); background-color: #e8f5e9; }
.upload-form-container label { font-weight: bold; cursor: pointer; }
.upload-form-container p { color: var(--text-color-light); margin: 10px 0; }
#file-input { display: none; }
#file-preview { margin-top: 15px; font-style: italic; }


/* ------------------------------------------------------------------- */
/* 9. STILI PAGINA PROFILO E PREFERITI
/* ------------------------------------------------------------------- */
.profile-container { max-width: 900px; margin: 40px auto; padding: var(--container-padding); }
.profile-card { background-color: var(--white-color); border-radius: var(--border-radius); box-shadow: var(--shadow-light); padding: 30px; margin-bottom: 30px; }
.profile-card h2 { margin-top: 0; padding-bottom: 15px; border-bottom: 1px solid var(--border-color); }
.profile-card p { font-size: 1.1em; color: var(--text-color-light); }
.profile-card strong { color: var(--text-color); }
.user-review-list .review-item { padding: 20px; border: 1px solid var(--border-color); border-radius: var(--border-radius); margin-bottom: 15px; }
.user-review-list .review-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.user-review-list .review-item-header h3 { margin: 0; }
.user-review-list .review-item-header h3 a { text-decoration: none; }
.user-review-list .review-item blockquote { margin: 10px 0; font-style: italic; color: var(--text-color-light); border-left: 3px solid var(--secondary-color); padding-left: 15px; }
#favorite-btn { font-size: 0.9em; color: #ccc; cursor: pointer; background: none; border: none; padding: 0; margin-left: 15px; transition: color 0.2s, transform 0.2s; vertical-align: middle; }
#favorite-btn:hover { transform: scale(1.1); }
#favorite-btn.is-favorite { color: var(--danger-color); }
.user-favorites-list .favorite-item { display: flex; align-items: center; gap: 15px; padding: 15px; border: 1px solid var(--border-color); border-radius: var(--border-radius); margin-bottom: 15px; }
.user-favorites-list .favorite-item-info { flex-grow: 1; }
.user-favorites-list .favorite-item-info h3 { margin: 0 0 5px 0; }
.user-favorites-list .favorite-item-info p { margin: 0; color: var(--text-color-light); }
.user-favorites-list .favorite-item .stars { font-size: 16px; }


/* ------------------------------------------------------------------- */
/* 10. RESPONSIVE (MEDIA QUERIES)
/* ------------------------------------------------------------------- */
@media (max-width: 992px) {
    .scheda-container { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    nav { flex-direction: column; justify-content: center; padding-top: 15px; padding-bottom: 15px; min-height: auto; }
    .logo { margin-bottom: 15px; }
    .menu { display: flex; flex-wrap: wrap; justify-content: center; width: 100%; }
    .menu a { margin: 5px 10px; }
    .data-table thead { display: none; }
    .data-table tr { display: block; margin-bottom: 20px; border: 1px solid var(--border-color); border-radius: var(--border-radius); box-shadow: var(--shadow-light); }
    .data-table td { display: block; text-align: right; padding-left: 50%; position: relative; border-bottom: 1px solid #f0f0f0; }
    .data-table td:last-child { border-bottom: none; }
    .data-table td::before { content: attr(data-label); position: absolute; left: 15px; font-weight: bold; text-align: left; }
    .data-table .actions { justify-content: flex-end; }
    .admin-panel-controls { flex-direction: column; gap: 15px; }
    .admin-search-form { width: 100%; }
    .scheda-container { grid-template-columns: 1fr; }
}