/* css/style.css */
:root {
    --primary-blue: #0056b3;
    --dark-blue: #003d82;
    --primary-orange: #ff7f50;
    --dark-orange: #e65c00;
    --bg-color: #f4f6f9;
    --text-color: #333;
    --white: #ffffff;
    --teal: #00796b; /* Colore per i tasti della privacy */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: 60px; 
}

/* =========================================================
   HEADER, MENU E SLOGAN (TESTI BIANCHI)
   ========================================================= */
header {
    background-color: var(--primary-blue);
    padding: 20px 20px 0 20px; 
    border-bottom: 5px solid var(--primary-orange);
    display: block !important;
}

header .logo-container {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 15px !important;
    flex-wrap: wrap;
}

/* Slogan sotto il logo: Bianco e ben visibile */
header .slogan-text {
    color: var(--white) !important;
    font-size: 16px;
    font-weight: 500;
    text-align: right;
    margin-left: 20px;
}

header a { display: inline-block; text-decoration: none; }
header img { max-height: 80px; display: block; margin: 0; }
header h1 { margin: 0; color: var(--white) !important; }

nav.main-menu { width: 100%; display: block; clear: both; }
nav.main-menu ul { list-style: none !important; padding: 0 !important; margin: 0 !important; display: flex !important; flex-direction: row !important; justify-content: flex-start !important; gap: 15px !important; }
nav.main-menu li { list-style: none !important; margin: 0 !important; padding: 0 !important; }
nav.main-menu a { display: block !important; color: var(--white) !important; text-decoration: none !important; padding: 12px 25px !important; font-weight: bold !important; font-size: 16px !important; border-radius: 6px 6px 0 0 !important; transition: background 0.3s; background-color: transparent; }
nav.main-menu a:hover, nav.main-menu a.active { background-color: var(--dark-blue) !important; color: var(--primary-orange) !important; }

/* =========================================================
   BARRA SUPERIORE (TOP BAR)
   ========================================================= */
.top-bar { display: flex; justify-content: flex-end; padding: 10px 20px; background: var(--dark-blue); color: var(--white) !important; font-size: 14px; }
.top-bar a { color: var(--primary-orange) !important; text-decoration: none; margin-left: 15px; font-weight: bold; }
.top-bar a:hover { text-decoration: underline; }
.top-bar strong { color: var(--white); margin-left: 5px; }

/* =========================================================
   LAYOUT PRINCIPALE E SIDEBAR
   ========================================================= */
.container { display: flex; max-width: 1200px; margin: 30px auto; padding: 0 15px; gap: 20px; flex: 1; width: 100%; box-sizing: border-box; }
.sidebar { flex: 1; min-width: 250px; background: var(--white); padding: 20px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); height: fit-content; }
.sidebar h3 { margin-top: 0; border-bottom: 2px solid var(--primary-blue); padding-bottom: 10px; color: var(--primary-blue); }
.sidebar ul { list-style: none; padding: 0; margin: 0; }
.sidebar li { margin-bottom: 8px; }
.sidebar a { text-decoration: none; color: var(--text-color); display: block; padding: 8px 10px; border-radius: 4px; transition: background 0.3s, color 0.3s; }
.sidebar a:hover { background: #e9ecef; color: var(--primary-blue); }
.sidebar a.attivo { background: var(--primary-orange); color: var(--white); font-weight: bold; }
.sub-cat { margin-left: 15px; font-size: 0.9em; border-left: 2px solid #eee; padding-left: 10px; }

/* =========================================================
   GRIGLIA PRODOTTI
   ========================================================= */
.main-content { flex: 3; }
.griglia-prodotti { display: grid; gap: 20px; } /* Gestito via PHP per il numero di colonne */
.card-prodotto { background: var(--white); border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); display: flex; flex-direction: column; transition: transform 0.2s, box-shadow 0.2s; border: 1px solid #eee; }
.card-prodotto:hover { transform: translateY(-5px); box-shadow: 0 5px 15px rgba(0,0,0,0.2); border-color: var(--primary-blue); }
.card-prodotto img { width: 100%; height: 200px; object-fit: cover; }
.dati-prodotto { padding: 15px; flex-grow: 1; display: flex; flex-direction: column; }
.dati-prodotto h4 { margin: 0 0 10px 0; font-size: 18px; color: var(--dark-blue); }
.categoria-badge { font-size: 12px; background: var(--bg-color); padding: 4px 8px; border-radius: 12px; display: inline-block; margin-bottom: 10px; color: #666; border: 1px solid #ccc; }
.descrizione { font-size: 14px; color: #555; flex-grow: 1; margin-bottom: 15px; }
.prezzo { font-size: 20px; font-weight: bold; color: var(--primary-orange); margin: 10px 0; }
.btn-dettagli { display: block; text-align: center; background: var(--primary-blue); color: var(--white); text-decoration: none; padding: 10px; border-radius: 4px; margin-top: auto; font-weight: bold; transition: background 0.3s; }
.btn-dettagli:hover { background: var(--dark-blue); }

/* =========================================================
   BOX INFORMAZIONI E MESSAGGI
   ========================================================= */
.info-box, .contact-form-container, .auth-box { background: var(--white); padding: 40px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); border: 1px solid #eee; width: 100%; box-sizing: border-box; }
.auth-box { max-width: 600px; margin: 40px auto; border-top: 5px solid var(--primary-orange); }
.auth-box h2 { color: var(--primary-blue); text-align: center; margin-top: 0; }
.alert-error { color: #dc3545; background: #f8d7da; padding: 10px; border-radius: 4px; margin-bottom: 15px; border: 1px solid #f5c6cb; }
.alert-success { color: #155724; background: #d4edda; padding: 10px; border-radius: 4px; margin-bottom: 15px; border: 1px solid #c3e6cb; }

/* =========================================================
   ALLINEAMENTO PERFETTO FORMULARI CON CSS GRID
   ========================================================= */
.form-grid { display: grid !important; grid-template-columns: 200px 1fr !important; gap: 20px 25px !important; align-items: center !important; width: 100% !important; margin: 0 !important; padding: 0 !important; }
.form-grid label { text-align: right !important; font-weight: bold !important; color: var(--dark-blue) !important; font-size: 15px !important; margin: 0 !important; display: block !important; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100% !important; padding: 12px !important; border: 1px solid #ccc !important; border-radius: 4px !important; box-sizing: border-box !important; font-family: inherit !important; font-size: 15px !important; background-color: #fafafa !important; margin: 0 !important; }
.form-grid textarea { min-height: 120px !important; resize: vertical !important; align-self: start !important; }
.form-grid textarea + label { align-self: start !important; margin-top: 12px !important; }
.form-grid input:focus, .form-grid textarea:focus, .form-grid select:focus { outline: none !important; border-color: var(--primary-orange) !important; background-color: #fff !important; }
.form-grid .btn-submit-grid { grid-column: 2 / 3 !important; background: var(--primary-orange) !important; color: var(--white) !important; border: none !important; border-radius: 4px !important; cursor: pointer !important; font-size: 16px !important; font-weight: bold !important; padding: 15px 25px !important; transition: background 0.3s !important; width: 100% !important; }
.form-grid .btn-submit-grid:hover { background: var(--dark-orange) !important; }

/* =========================================================
   FORM CONTATTI - INCOLONNATO IN VERTICALE
   ========================================================= */
.vertical-form { display: flex; flex-direction: column; gap: 20px; width: 100%; max-width: 600px; margin: 0 auto; }
.vertical-form .form-group { display: flex; flex-direction: column; width: 100%; }
.vertical-form label { font-weight: bold; color: var(--dark-blue); margin-bottom: 8px; font-size: 15px; }
.vertical-form input, .vertical-form textarea { width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; font-family: inherit; font-size: 15px; background-color: #fafafa; }
.vertical-form textarea { min-height: 120px; resize: vertical; }
.vertical-form input:focus, .vertical-form textarea:focus { outline: none; border-color: var(--primary-orange); background-color: #fff; }
.vertical-form .btn-submit { background: var(--primary-orange); color: var(--white); border: none; padding: 15px 25px; border-radius: 4px; cursor: pointer; font-size: 16px; font-weight: bold; transition: background 0.3s; width: 100%; }
.vertical-form .btn-submit:hover { background: var(--dark-orange); }

table { width: 100%; border-collapse: collapse; margin-top: 20px; background-color: var(--white); }
th, td { padding: 15px; text-align: left; border-bottom: 1px solid #eee; border-right: 1px solid #eee; }
th:first-child, td:first-child { border-left: 1px solid #eee; }
th { color: var(--dark-blue); font-weight: bold; background-color: var(--bg-color); border-top: 1px solid #eee; }
.btn-bearbeiten { padding: 8px 12px; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; font-size: 14px; background-color: #ffc107; color: #000; display: inline-block; text-decoration: none; text-align: center; }
.btn-bearbeiten:hover { background-color: #e0a800; }
.btn-loeschen { padding: 8px 12px; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; font-size: 14px; background-color: #dc3545; color: var(--white); display: inline-block; text-decoration: none; text-align: center; }
.btn-loeschen:hover { background-color: #c82333; }

/* =========================================================
   FOOTER FISSO (LINK A SINISTRA E TESTI BIANCHI)
   ========================================================= */
.site-footer { 
    position: fixed; 
    bottom: 0; 
    left: 0; 
    width: 100%; 
    background-color: var(--dark-blue) !important; 
    color: var(--white) !important; 
    padding: 15px 30px; 
    font-size: 14px; 
    border-top: 3px solid var(--primary-orange); 
    z-index: 9990; 
    box-sizing: border-box;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

.footer-links {
    display: flex !important;
    gap: 20px !important;
    flex-wrap: wrap;
    justify-content: flex-start !important; 
}

.footer-links a {
    color: var(--white) !important; 
    text-decoration: none !important;
    font-weight: bold;
    font-size: 13px;
    transition: color 0.3s;
    cursor: pointer;
}

.footer-links a:hover {
    color: var(--primary-orange) !important;
}

.footer-copyright {
    text-align: right !important;
    color: var(--white) !important;
}

/* =========================================================
   NUOVO PANNELLO PRIVACY (MODAL AVANZATO)
   ========================================================= */
.cookie-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.cookie-modal {
    background: white;
    width: 90%;
    max-width: 600px;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    max-height: 90vh;
    overflow-y: auto;
}

.cookie-modal h2 {
    margin-top: 0;
    font-size: 20px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.cookie-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.cookie-info {
    flex: 1;
    padding-right: 20px;
}

.cookie-name {
    font-weight: bold;
    color: #444;
    display: block;
}

.cookie-desc {
    font-size: 13px;
    color: #777;
    margin-top: 5px;
    display: block;
}

/* Switch Toggle (Stile iPhone) */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider { background-color: var(--teal); }
input:checked + .slider:before { transform: translateX(22px); }
input:disabled + .slider { background-color: #eee; cursor: not-allowed; }

/* Bottoni Pannello Privacy */
.cookie-buttons {
    display: flex;
    gap: 10px;
    margin-top: 25px;
    flex-wrap: wrap;
}
.btn-cookie-main {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    min-width: 150px;
}
.btn-accept-all { background: var(--teal); color: white; }
.btn-save-choice { background: #f4f4f4; color: #444; border: 1px solid #ccc; }
.btn-accept-all:hover { background: #00695c; }
.btn-save-choice:hover { background: #e0e0e0; }

/* =========================================================
   RESPONSIVE DESIGN (Media Queries per Cellulari)
   ========================================================= */
@media (max-width: 768px) {
    .container { flex-direction: column; padding: 0 10px; }
    .sidebar { width: auto; margin-bottom: 20px; }
    .griglia-prodotti { grid-template-columns: repeat(auto-fill, minmax(100%, 1fr)); }
    .top-bar { justify-content: center; flex-wrap: wrap; text-align: center; }
    
    header .logo-container { justify-content: center; text-align: center; }
    header .slogan-text { text-align: center; margin: 10px 0; width: 100%; }
    
    .site-footer { flex-direction: column; gap: 10px; text-align: center; height: auto; position: static; padding: 15px; }
    .footer-links { justify-content: center !important; }
    .footer-copyright { text-align: center !important; }
    
    nav.main-menu ul { flex-wrap: wrap !important; justify-content: center !important; gap: 10px !important; }
    nav.main-menu a { border-radius: 4px !important; margin-bottom: 5px !important; }

    .form-grid { grid-template-columns: 1fr !important; gap: 8px !important; }
    .form-grid label { text-align: left !important; margin-top: 15px !important; }
    .form-grid .btn-submit-grid { grid-column: 1 / -1 !important; margin-top: 15px !important; }

    .cookie-buttons { flex-direction: column; }
}