/* Theme Name: Totem Piandimeleto Professional
Description: Ottimizzato per Schermi 46" Verticali (1080x1920) - Fix Allineamento e Proporzioni
Author: Gemini Developer
Version: 1.3
*/

:root {
    --kiosk-primary: #0f3d7a;
    --kiosk-accent: #cfab2d;
    --kiosk-bg: #f0f4f8;
    --kiosk-card-bg: rgba(255, 255, 255, 0.85);
    --font-main: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    
    --border-radius-lg: 40px;
    --safe-padding: 60px; /* Ridotto leggermente per dare più spazio al contenuto */
    --shadow-soft: 0 15px 50px -15px rgba(0,0,0,0.15);
}

/* RESET E LAYOUT FISSO 1080x1920 */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    -webkit-user-callout: none;
}

body.is-kiosk-mode {
    background-color: #05162e;
    width: 1080px;
    height: 1920px;
    font-family: var(--font-main);
    user-select: none;
    -webkit-user-select: none;
    color: #1a1a1a;
}

#page {
    display: flex;
    flex-direction: column;
    height: 1920px;
    width: 1080px;
    position: relative;
}

/* SFONDO ANIMATO */
.animated-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    background: var(--kiosk-bg);
}

.bg-sphere {
    position: absolute;
    filter: blur(120px);
    border-radius: 50%;
    opacity: 0.6;
    animation: moveAround 25s infinite alternate ease-in-out;
}

.sphere-1 { width: 900px; height: 900px; background: #2a6bc0; top: -200px; right: -200px; }
.sphere-2 { width: 800px; height: 800px; background: #cfab2d; bottom: -100px; left: -200px; animation-delay: -5s; }

@keyframes moveAround {
    0% { transform: translate(0, 0); }
    100% { transform: translate(100px, 150px); }
}

/* HEADER - FIX ALLINEAMENTO */
.kiosk-header {
    flex-shrink: 0; /* Impedisce all'header di rimpicciolirsi */
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(25px);
    padding: 40px var(--safe-padding);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid rgba(255,255,255,0.3);
    height: 180px; /* Altezza fissa per consistenza */
    box-sizing: border-box;
}

.kiosk-logo-area {
    display: flex;
    align-items: center;
    gap: 30px;
    flex: 1;
}

.kiosk-logo-placeholder {
    flex-shrink: 0; /* Lo stemma non deve rimpicciolirsi */
    width: 100px; height: 100px;
    background: white; border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; color: var(--kiosk-primary);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.kiosk-header-text {
    white-space: nowrap; /* Forza il testo su una riga se c'è spazio */
}

.kiosk-header-text h1 { margin: 0; font-size: 2.8rem; color: var(--kiosk-primary); font-weight: 800; line-height: 1; }
.kiosk-header-text p { margin: 8px 0 0 0; font-size: 1.3rem; color: #444; text-transform: uppercase; letter-spacing: 2px; }


 .status-icon { font-size: 120px; margin-bottom: 30px; display: block; }

/* CONTENT AREA - ADATTAMENTO VERTICALE */
#content {
    flex: 1; /* Occupa tutto lo spazio tra header e footer */
    padding: 40px var(--safe-padding);
    overflow-y: auto; /* Permette lo scroll solo qui se necessario */
    display: flex;
    flex-direction: column;
}

.kiosk-page-title {
    flex-shrink: 0;
    font-size: 4.8rem;
    font-weight: 900;
    color: #05162e;
    text-align: center;
    margin: 40px 0 60px 0;
    line-height: 1.1;
}

/* GRID - FIX PROPORZIONI */
.kiosk-action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
    flex: 1; /* Prova a espandersi per riempire lo spazio */
    align-content: start; /* Allinea le card all'inizio */
}

.kiosk-action-card {
    background: var(--kiosk-card-bg);
    backdrop-filter: blur(20px);
    padding: 60px 40px;
    border-radius: var(--border-radius-lg);
    text-align: center;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255,255,255,0.5);
    height: 480px; /* Altezza bilanciata per 1920px di altezza totale */
    text-decoration: none;
}

.kiosk-action-icon {
    width: 150px; height: 150px;
    background: white; color: var(--kiosk-primary);
    border-radius: 40px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 40px;
    box-shadow: 0 12px 35px rgba(15, 61, 122, 0.15);
}

.icon-svg { 
    width: 80px; height: 80px; 
    fill: none; stroke: currentColor; stroke-width: 2.5; 
    display: block; /* Fix per la sparizione icone */
}

.kiosk-action-card h3 { font-size: 2.8rem; margin: 0 0 15px 0; color: #05162e; font-weight: 800; }
.kiosk-action-card p { font-size: 1.5rem; color: #4a5568; line-height: 1.4; margin: 0; }

/* FOOTER */
.kiosk-footer {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.85);
    padding: 40px var(--safe-padding) 60px var(--safe-padding);
    display: flex; gap: 40px;
    border-top: 2px solid rgba(255,255,255,0.3);
    height: 220px;
    box-sizing: border-box;
}

.kiosk-nav-button {
    flex: 1; height: 110px;
    display: flex; align-items: center; justify-content: center; gap: 25px;
    background: white; border-radius: 30px; font-size: 2rem; font-weight: 800;
    border: 2px solid rgba(0,0,0,0.05);
    text-decoration: none;
}

.kiosk-nav-button.primary {
    background: linear-gradient(135deg, var(--kiosk-primary) 0%, #2a6bc0 100%);
    color: white; border: none;
}

/* STILI PERCORSI CICLABILI */
.bike-routes-grid {
    display: grid;
    grid-template-columns: 1fr; /* Colonna singola per leggibilità verticale */
    gap: 30px;
}

.route-card {
    background: white;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.route-header {
    background: #f8fafc;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #edf2f7;
}

.route-difficulty {
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 1.1rem;
}

.route-difficulty.easy { background: #c6f6d5; color: #22543d; }
.route-difficulty.medium { background: #feebc8; color: #744210; }
.route-difficulty.hard { background: #fed7d7; color: #822727; }

.route-distance {
    font-weight: 800;
    color: var(--kiosk-primary);
    font-size: 1.4rem;
}

.route-body {
    padding: 40px;
}

.route-body h3 {
    font-size: 2.4rem;
    margin: 0 0 15px 0;
    color: #1a202c;
}

.route-body p {
    font-size: 1.6rem;
    color: #4a5568;
    line-height: 1.5;
    margin-bottom: 25px;
}

.route-details {
    display: flex;
    gap: 30px;
    border-top: 1px dashed #e2e8f0;
    padding-top: 20px;
}

.route-details span {
    font-size: 1.3rem;
    color: #718096;
}

.route-details strong {
    color: #2d3748;
}

/* STILI CONTATTI UFFICI */
.contacts-grid {
    display: grid;
    grid-template-columns: 1fr; /* Ottimizzato per 1080px di larghezza */
    gap: 25px;
}

.office-card {
    background: white;
    border-radius: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    border-left: 10px solid var(--kiosk-primary);
    padding: 35px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.office-name h3 {
    margin: 0;
    font-size: 2.4rem;
    color: var(--kiosk-primary);
    font-weight: 800;
}

.office-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.info-item {
    font-size: 1.5rem;
    color: #2d3748;
}

.info-item strong {
    display: block;
    color: #718096;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.office-hours {
    grid-column: span 2;
    background: #f7fafc;
    padding: 20px;
    border-radius: 20px;
    font-size: 1.4rem;
    color: #4a5568;
    margin-top: 10px;
    line-height: 1.4em;
}

.office-hours strong {
    color: var(--kiosk-primary);
}

/* Fix responsivo se necessario */
@media (max-width: 600px) {
    .office-info { grid-template-columns: 1fr; }
    .office-hours { grid-column: span 1; }
}

/* --- STILI TEMPLATE LUOGHI (Punti di Interesse) --- */

.places-grid {
    display: flex;
    flex-direction: column;
    gap: 40px;
    margin-top: 20px;
}

.place-card {
    background: white;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column; /* Cambiato in colonna per gestire il QR in basso */
    height: auto; /* Altezza dinamica per adattarsi al contenuto */
    min-height: 500px;
    border: 1px solid rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

/* Area Superiore: Immagine e Testo */
.place-top-section {
    display: flex;
    flex: 1;
    height: 350px; /* Altezza fissa per l'area immagine/testo */
}

.place-image {
    width: 400px;
    height: auto;
    background-size: cover;
    background-position: center;
    flex-shrink: 0
}

.place-content {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #ffffff;
}

.place-text h3 {
    font-size: 3rem;
    color: var(--kiosk-primary);
    margin: 0 0 15px 0;
    font-weight: 800;
    line-height: 1.2;
}

.place-text p {
    font-size: 1.7rem;
    color: #4a5568;
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Area Inferiore: QR Code */
.place-footer-qr {
    background: #f8fafc;
    border-top: 2px dashed #e2e8f0;
    padding: 25px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.place-qr-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.place-qr-container {
    width: 100px;
    height: 100px;
    background: white;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.place-qr-container img, 
.place-qr-container svg {
    max-width: 100%;
    height: auto;
}

.place-qr-label {
    display: flex;
    flex-direction: column;
}

.place-qr-label span:first-child {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--kiosk-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.place-qr-label span:last-child {
    font-size: 1.1rem;
    color: #718096;
}

/* Ottimizzazione per il tocco */
.place-card:active {
    transform: scale(0.98);
}

/* Eventi Totem - Specific Styles */
.event-date-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--kiosk-accent);
    color: #05162e;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    text-transform: uppercase;
}

.info-tag {
    background: rgba(15, 61, 122, 0.05);
    padding: 10px 25px;
    border-radius: 50px;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--kiosk-primary);
    border: 1px solid rgba(15, 61, 122, 0.1);
}

.event-card {
    transition: transform 0.3s ease;
    overflow: hidden;
}

.event-card:active {
    transform: scale(0.98);
}

.event-content-area p {
    background-color: #fff;
    padding: 2rem;
    border-radius: 28px;
}

/* Responsive adjustment per il layout a due colonne del dettaglio */
@media (max-width: 1000px) {
    .event-main-layout {
        grid-template-columns: 1fr !important;
    }
    .event-sidebar {
        order: 2;
    }
}

/* --- STILI SPECIFICI PER TEMPLATE ORARI AUTOBUS --- */

.bus-schedule-container {
    max-width: 1200px;
    margin: 0 auto;
}

.bus-accordion-item {
    background: white;
    border-radius: 20px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.05);
}

.bus-accordion-header {
    background-color: var(--kiosk-primary);
    color: white;
    padding: 25px 35px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.bus-header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.bus-line-badge {
    background: var(--kiosk-accent);
    color: #05162e;
    font-weight: 800;
    padding: 8px 15px;
    border-radius: 12px;
    font-size: 1.4rem;
}

.bus-route-name {
    font-weight: 600;
    font-size: 1.8rem;
}

.bus-header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.bus-direction {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(255,255,255,0.15);
    padding: 5px 12px;
    border-radius: 8px;
}

.bus-arrow {
    transition: transform 0.4s ease;
    font-size: 1.2rem;
}

.bus-accordion-content {
    /*display: none;*/
    padding: 40px;
    border-top: 1px solid #eee;
    touch-action: pan-x pan-y;
}

.bus-accordion-item.active .bus-accordion-content {
    display: block;
}

.bus-accordion-item.active .bus-arrow {
    transform: rotate(180deg);
}

/* Tabella Orari */
.bus-table-wrapper {
    overflow-x: auto;
    border: 1px solid #eee;
    border-radius: 15px;
    margin-bottom: 25px;
}

.bus-table-wrapper table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.3rem; /* Ottimizzato per Totem */
    min-width: 1000px;
}

.bus-table-wrapper th, .bus-table-wrapper td {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #eee;
    border-right: 1px solid #eee;
}

.bus-row-label {
    text-align: left !important;
    background-color: #f8fafc;
    font-weight: 700;
    position: sticky;
    left: 0;
    width: 280px;
    z-index: 2;
    box-shadow: 4px 0 10px -5px rgba(0,0,0,0.1);
}

.bus-feriale-header {
    background-color: var(--kiosk-accent);
    color: #05162e;
    font-weight: 900;
    text-transform: uppercase;
}

.bus-meta-row {
    background-color: #fff;
    color: #718096;
    font-size: 1.1rem;
}

.bus-accordion-content tr:nth-child(even) {
    background-color: rgba(15, 61, 122, 0.02);
}

.bus-validita-section {
    padding: 25px;
    background-color: #fffdec;
    border-left: 6px solid var(--kiosk-accent);
    font-size: 1.2rem;
    border-radius: 0 15px 15px 0;
}

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

/* Ottimizzazione Mobile per QR Code */
.is-mobile-mode .bus-route-name { font-size: 1.2rem; }
.is-mobile-mode .bus-accordion-content { padding: 15px; }
.is-mobile-mode .bus-table-wrapper table { font-size: 1rem; }

/* ================================================================
   SISTEMA KIOSK - AGGIORNAMENTI STILI FRONT PAGE E SERVIZI
================================================================
*/

/* 1. FRONT PAGE - LAYOUT NO-SCROLL (FORZA 100% ALTEZZA) */

h1.kiosk-main-title {
    font-size: 3.5em;
    margin-top: 0;
}

.is-kiosk-mode .kiosk-home-fixed {
    height: 100vh;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Fondamentale: impedisce la comparsa della barra di scorrimento */
    padding: 40px 60px;
    box-sizing: border-box;
}

.is-kiosk-mode .kiosk-home-header {
    flex: 0 0 auto;
    margin-bottom: 30px;
    text-align: center;
}

.is-kiosk-mode .kiosk-grid-wrapper {
    flex: 1 1 auto;
    display: flex;
    align-items: stretch;
    min-height: 0;
}

.is-kiosk-mode .kiosk-6-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(3, 1fr); /* Divide l'altezza in 3 righe esatte */
    gap: 25px;
    width: 100%;
}

/* 2. CARD FRONT PAGE CON IMMAGINE E OVERLAY */
.is-kiosk-mode .kiosk-card-home {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    transition: transform 0.2s ease;
    border: 1px solid rgba(0,0,0,0.1);
}

.is-kiosk-mode .kiosk-card-home:active {
    transform: scale(0.97); /* Feedback visivo al tocco sul totem */
}

.is-kiosk-mode .kiosk-card-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-color: #0f3d7a; /* Colore di fallback se l'immagine manca */
}

.is-kiosk-mode .kiosk-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Gradiente scuro per rendere leggibile il testo bianco sulle immagini */
    background: linear-gradient(0deg, rgba(5, 22, 46, 0.95) 0%, rgba(5, 22, 46, 0.2) 70%);
    display: flex;
    align-items: flex-end;
    padding: 35px;
    box-sizing: border-box;
}

.is-kiosk-mode .kiosk-card-info h3 {
    color: var(--kiosk-accent); /* Di solito il giallo del tema */
    font-size: 2.8rem;
    margin: 0 0 5px 0;
    text-transform: uppercase;
    font-weight: 800;
}

.is-kiosk-mode .kiosk-card-info p {
    color: white;
    font-size: 1.5rem;
    margin: 0;
    opacity: 0.9;
}

/* 3. ADATTAMENTI PER MOBILE (RIPRISTINA LO SCROLLING SU CELLULARE) */
.is-mobile-mode .kiosk-home-fixed {
    height: auto;
    max-height: none;
    overflow: visible;
}

.is-mobile-mode .kiosk-6-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 15px;
    padding: 15px;
}

.is-mobile-mode .kiosk-card-home {
    height: 220px;
}

.is-mobile-mode .kiosk-card-info h3 {
    font-size: 1.8rem;
}

/* --- LAYOUT GENERALE (KIOSK MODE) --- */
.kiosk-home-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    /*padding: 30px;
    background-color: #f8fafd;  Un grigio azzurrino leggerissimo per far risaltare il bianco */
    box-sizing: border-box;
}

/* --- GRIGLIA --- */
.kiosk-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 30px;
    flex-grow: 1;
}

/* --- STILE CARD (Coerente con schede interne) --- */
.kiosk-card {
    background: #ffffff;
    border-radius: var(--border-radius-lg);
    border: 1px solid #e2e8f0; /* Bordo sottile tipico delle interfacce moderne */
    text-decoration: none;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: transform 0.15s ease-in-out;
}

.kiosk-card:active {
    transform: scale(0.97);
    background-color: #f1f5f9;
}

.card-image {
    height: 60%;
    background-size: cover;
    background-position: center;
}

.card-content {
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

.card-content h3 {
    margin: 0;
    color: var(--kiosk-primary);
    font-size: 3rem;
    font-weight: 700;
}

.card-desc {
    font-size: 0.95rem;
    color: #64748b;
    margin: 5px 0 0 0;
}

.btn-discover {
    display: inline-block;
    margin-top: 12px;
    color: #2563eb; /* Blu standard link istituzionali */
    font-weight: 600;
    font-size: 1.6rem;
    text-transform: uppercase;
}

/* --- FOOTER INFO --- */
.kiosk-footer-extras {
    margin-top: 30px;
    height: 100px;
    background: #ffffff;
    border-radius: var(--border-radius-lg);
    border: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.footer-section {
    display: flex;
    gap: 20px;
    color: #475569;
}

.sensor-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sensor-item .label { font-size: 0.75rem; text-transform: uppercase; color: #94a3b8; }
.sensor-item .value { font-weight: 700; font-size: 1.2rem; }
.value.green { color: #10b981; }

.active-lang { font-weight: 800; color: #1e293b; border-bottom: 2px solid #2563eb; }

.extra-item {
    font-size: 1.1rem;
    color: #666;
}

/* --- ADATTAMENTO MOBILE --- */
body.is-mobile-mode .kiosk-grid {
    grid-template-columns: 1fr; /* Una colonna su mobile per leggibilità */
    grid-template-rows: auto;
    overflow-y: auto;
}

body.is-mobile-mode .kiosk-home-container {
    height: auto;
    overflow: visible;
}