/* Stili generali */
body {
    font-family: Arial, sans-serif;
    background-color: #f2f2f2; /* Grigio chiaro di sfondo */
    color: #333;
    padding: 0;
    margin: 0;
    /* display: flex;*/
    justify-content: center; 
}

h1 {
    color: #444;
    margin-bottom: 20px;
}

/* Contenitore principale */
.container {
    text-align: center;
    max-width: 600px;
    margin: 20px auto;          /* Spazio in alto/basso */
    background-color: #fff;     /* Sfondo bianco */
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}


/* Divider sotto l'header */
.header-divider {
    border: 0;
    border-top: 1px solid #ccc;
    margin: 10px 0;
    width: 100%;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0; /* Aggiunto un po' di spazio verticale */
    position: relative;
}

/* Logo */
.logo {
    text-align: right;
}

.logo-img {
    max-width: 150px;
    height: auto;
}

/* Stile per pulsanti generali */
button {
    display: inline-block; /* Evita che occupino tutta la larghezza del contenitore */
    padding: 8px 16px; /* Riduce il padding interno */
    font-size: 14px; /* Dimensione del testo più piccola */
    line-height: 1.5; /* Spaziatura del testo */
    border: none; /* Rimuove il bordo */
    border-radius: 5px; /* Arrotondamento leggero */
    background-color: #d3c163; /* Colore di sfondo */
    color: #333; /* Colore del testo */
    cursor: pointer; /* Mostra il cursore a mano */
    transition: background-color 0.3s ease, box-shadow 0.3s ease; /* Aggiunge transizione */
    max-width: 150px; /* Imposta una larghezza massima */
    width: auto; /* Permette di adattarsi al contenuto */
    text-align: center; /* Centra il testo */
}

button:hover {
    background-color: #ffcd00; /* Colore più scuro al passaggio del mouse */
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); /* Effetto di ombra */
}

button:active {
    background-color: #ffb400; /* Colore più scuro al clic */
    box-shadow: inset 0px 2px 4px rgba(0, 0, 0, 0.2); /* Effetto di pressione */
}

/* Per bottoni più piccoli */
button.small {
    padding: 5px 10px;
    font-size: 12px;
    max-width: 100px; /* Riduce la larghezza massima */
}

/* Per bottoni più grandi */
button.large {
    padding: 12px 24px;
    font-size: 16px;
    max-width: 200px; /* Aumenta la larghezza massima */
    font-weight: bold; /* Grassetto */
    color: white; /* Colore del testo */
    background-color: #05661a; /* Colore di sfondo (blu, ad esempio) */
    border: none; /* Rimuove il bordo */
    border-radius: 8px; /* Angoli arrotondati */
    cursor: pointer; /* Cambia il cursore quando si passa sopra */
    transition: background-color 0.3s ease; /* Transizione sul colore di sfondo */
}

button.large:hover {
    background-color: #0056b3; /* Cambia colore dello sfondo al passaggio del mouse */
}


/* Pulsante "secondary" - grigio */
.btn-secondary {
    margin-top: 20px;
    display: inline-block;
    text-decoration: none;
    color: #fff;
    background-color: #6c757d;
    padding: 10px 15px;
    border-radius: 20px;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-back {
    display: inline-block;
    padding: 10px 20px;
    font-size: 16px;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    text-decoration: none; /* Rimuove la sottolineatura */
    transition: background-color 0.3s ease;
}

.btn-back:hover {
    background-color: #0056b3;
}

/* Form e input */
input {
    padding: 10px;
    margin: 10px 0;
    width: 100%;
    box-sizing: border-box;
    border-radius: 5px;  /* Arrotondati */
    border: 1px solid #ccc;
}
  
form {
    margin-bottom: 20px;
}

/* Stile dei messaggi di stato */
.status-alert {
    margin: 15px 0;
    padding: 15px;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
}

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

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

/* Pulsante "sandwich" dell’header */
.openbtn {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 35px;
    height: 30px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin: 0;
}

.openbtn span {
    display: block;
    width: 100%;
    height: 4px;
    background-color: #333;
    border-radius: 2px;
    transition: background-color 0.3s;
}

.openbtn:hover span {
    background-color: #ffd400; /* Diventa giallo al hover */
}

/* Menu laterale (sidebar) */
/* Sidebar */
.sidebar {
    height: 100%;
    width: 0;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    background-color: #f9f9f9;
    overflow: hidden; /* Evita che il contenuto esca */
    transition: width 0.3s;
    display: flex; /* Usa il flexbox */
    flex-direction: column; /* Organizza il contenuto in colonna */
    border-right: 1px solid #ddd;
}

/* Contenuto scorrevole della sidebar */
.sidebar-content {
    flex: 1; /* Occupa lo spazio rimanente */
    overflow-y: auto; /* Aggiungi lo scroll verticale */
}

/* Pulsante Logout */
.logout {
    background-color: #f0f0f0; /* Rosso per il pulsante di logout */
    color: white;
    text-align: center;
    padding: 10px;
    text-decoration: none;
    font-weight: bold;
    border-top: 1px solid #ddd; /* Separatore */
    transition: background-color 0.3s;
}

/* Chiudi Sidebar */
/* Pulsante Chiudi Sidebar (X) */
.sidebar .closebtn {
    position: absolute; /* Posizionamento relativo alla sidebar */
    top: 10px; /* Spazio dall'alto */
    left: 80%; /* Posiziona vicino al bordo destro della sidebar */
    transform: translateX(-50%); /* Corregge il posizionamento per il centro */
    font-size: 24px; /* Dimensione ridotta della X */
    color: #333; /* Colore scuro */
    cursor: pointer; /* Mostra il puntatore a mano */
    z-index: 1100; /* Rimane sopra al contenuto della sidebar */
    text-align: center; /* Allinea orizzontalmente */
    background-color: #f9f9f9; /* Sfondo della sidebar per maggiore chiarezza */
    padding: 5px; /* Un po' di spazio intorno */
    transition: color 0.3s ease;
}

/* Hover per la "X" */
.sidebar .closebtn:hover {
    color: #007bff; /* Cambia colore al passaggio del mouse */
    background-color: #e9f5ff; /* Sfondo leggermente colorato */
}



.sidebar hr {
    margin: 10px 0;
    border: none;
    border-top: 1px solid #ccc;
}

.sidebar a {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    text-decoration: none;
    color: #333;
    transition: background-color 0.3s;
    border-left: 4px solid transparent; /* Default no border */
}

/* Sezione attiva nel menu */
.sidebar a.active {
    border-left: 4px solid #007bff; /* Bordo blu per la sezione attiva */
    background-color: #e9f5ff; /* Sfondo blu chiaro */
    color: #05661a; /* Testo blu */
    font-weight: bold;
}


.sidebar a:hover {
    background-color: #f1f1f1;
}





/* Profilo nella sidebar */
/* Nome del profilo */
.profile-name {
    font-weight: bold;
    font-size: 16px; /* Dimensione leggermente più grande */
    color: #333;
}

/* Label "Profilo" */
.profile-label {
    font-weight: normal; /* Non in grassetto */
    font-size: 14px; /* Dimensione minore rispetto al nome */
    color: #666; /* Colore grigio per differenziarlo */
    display: block; /* Forza il testo su una nuova riga */
}


.profile-section {
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #f0f0f0;
    border-radius: 5px;
    margin-bottom: 10px;
}

.profile-section img {
    width: 30px;
    height: 30px;
    border-radius: 50%; /* Icona circolare */
}

.profile-section span {
    font-weight: bold;
    color: #333;
}

/* Icone */
.icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
}

/* Sidebar aperta */
.sidebar.active {
    width: 250px;
}

/* Contenuto principale con sidebar */
#main {
    margin-left: 0;
    transition: margin-left 0.3s;
}

#main.active {
    margin-left: 250px;
}


/* Contenitore della sezione */
.section {
    margin: 20px auto; /* Centra la sezione */
    padding: 15px;
    background-color: #fff; /* Colore di sfondo */
    border-radius: 8px; /* Angoli arrotondati */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Effetto ombra */
    display: flex; /* Contenitore flessibile */
    flex-direction: column; /* Elementi organizzati in colonna */
    justify-content: center; /* Allinea gli elementi orizzontalmente */
    align-items: center; /* Allinea gli elementi verticalmente */
    text-align: center; /* Centra il testo */
    margin-bottom: 20px; /* Spaziatura tra le sezioni */
}

/* Tabella responsiva */
.table-responsive {
    display: block;               /* Forza il blocco */
    width: 100%;                  /* Occupa tutta la larghezza del contenitore */
    overflow-x: auto;             /* Scroll orizzontale */
    border: 1px solid #ddd;       /* Bordo leggero */
    border-radius: 8px;           /* Angoli arrotondati */
    margin-bottom: 20px;
    max-width: 100%;
}

/* Stile delle tabelle */
table {
    width: 100%;                  /* La tabella si adatta al contenitore */
    border-collapse: collapse;    /* Rimuove spazi tra le celle */
    /*margin: 0;
    padding: 0;
    table-layout: fixed;          Uniforma la larghezza delle colonne */
    table-layout: auto;
}

/* Celle e intestazioni */
table th, table td {
    padding: 10px;
    text-align: left;             /* Allinea a sinistra */
    border: 1px solid #ddd;       /* Bordo leggero */
    white-space: nowrap;          /* Mantiene il testo su una riga */
    overflow: hidden;             /* Evita "sbordamenti" */
    text-overflow: ellipsis;      /* Mostra "..." per testi troppo lunghi */
    max-width: 400px;  
}
table td input {
    width: 100%; /* Adatta l'input alla cella */
    min-width: 300px; /* Imposta una larghezza minima per visibilità */
    max-width: none; /* Rimuove il limite di larghezza */
    box-sizing: border-box; /* Include padding e border nella larghezza */
}

/* Intestazioni della tabella */
table th {
    background-color: #f4f4f4;    /* Sfondo chiaro per le intestazioni */
    font-weight: bold;
}

/* Riga alternata */
table tr:nth-child(even) {
    background-color: #f9f9f9;    /* Sfondo alternato */
}

/* Testo */
h3, h4 {
    text-align: left;
    color: #444;
}

/* Spaziatura e margini */
h3 {
    margin-bottom: 15px;
}

h4 {
    margin: 10px 0;
}

#gateStatus {
    font-weight: bold;
    color: #333;
    margin: 15px 0;
}

/* Form "payment-form" */
.payment-form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 20px;
}

.payment-form .form-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.payment-form label {
    font-weight: bold;
    margin-bottom: 5px;
    color: #555;
}

.payment-form input {
    padding: 10px;
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 16px;
}

.payment-form input:focus {
    border-color: #ffd400;
    outline: none;
    box-shadow: 0 0 5px rgba(255, 212, 0, 0.5); /* Giallo tenue */
}

.payment-form .description {
    font-size: 14px;
    color: #666;
    margin-top: -5px;
    text-align: center;
}

/* Bottone della form payment */
.payment-form .btn {
    background-color: #ffd400;
    color: #333;
    padding: 10px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    text-align: center;
    font-size: 16px;
    transition: background-color 0.3s ease;
    font-weight: bold;
}

.payment-form .btn:hover {
    background-color: #ffcd00;
}

.payment-form .btn:active {
    background-color: #ffb400;
}

/* Incremental buttons (per i giorni) */
.incremental-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
    gap: 10px;
}

.incremental-buttons button {
    background-color: #ffd400;
    color: #333;
    padding: 10px 15px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 18px;
    transition: background-color 0.3s ease;
    font-weight: bold;
}

.incremental-buttons button:hover {
    background-color: #ffcd00;
}

.incremental-buttons input {
    width: 60px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 18px;
    margin: 0;
    padding: 5px;
    background-color: #f8f9fa;
}

.incremental-buttons button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.payment-form button[type="submit"] {
    margin-top: 20px;
}

.icon {
    width: 24px;
    height: 24px;
}

.incremental-buttons button {
    width: 30px; /* Larghezza del pulsante */
    height: 30px; /* Altezza del pulsante */
    font-size: 16px; /* Dimensione del testo */
    line-height: 1; /* Allineamento del testo */
    padding: 5px; /* Spaziatura interna */
    border-radius: 50%; /* Forma arrotondata */
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #ffd400; /* Colore di sfondo */
    color: #333; /* Colore del testo */
    border: none; /* Rimuove il bordo */
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.incremental-buttons button:hover {
    background-color: #ffcd00; /* Colore al passaggio del mouse */
}

.incremental-buttons button:active {
    background-color: #ffb400; /* Colore al clic */
}

.pagination-container {
    margin: 20px 0;
    text-align: center;
}

.pagination {
    display: inline-flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 10px;
}

.pagination li {
    display: inline;
}

.pagination li a {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #05661a;
    transition: background-color 0.3s, color 0.3s;
}

.pagination li a:hover {
    background-color: #007bff;
    color: #fff;
}

.pagination li.active a {
    background-color: #007bff;
    color: #fff;
    pointer-events: none;
}

.btn-register {
    display: block;
    margin: 20px auto;
    padding: 10px 20px;
    font-size: 16px;
    background-color: #28a745; /* Verde */
    color: white;
    border: none;
    border-radius: 5px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-register:hover {
    background-color: #218838; /* Verde scuro */
}

.register-container {
    text-align: center;
    margin-top: 20px;
}

.register-container p {
    margin-bottom: 10px;
    font-size: 14px;
    color: #555;
}

.links {
    margin-bottom: 20px; /* Spazio sotto i link */
    text-align: center; /* Centra i link */
}

.language-links {
    font-size: 0; /* Elimina gli spazi tra gli elementi inline */
}

.language-links img {
    font-size: initial; /* Ripristina la dimensione del font */
    width: 30px; /* Imposta la dimensione delle bandiere */
    margin-right: 20px; /* Margine tra le bandiere */
}

/* Stile per il testo "Remaining time" */
.remaining-time-label {
    font-size: 1.5rem; /* Ingrandisce il testo */
    font-weight: bold;
    color: #444; /* Colore leggermente più scuro per visibilità */
    text-align: center; /* Centra il testo */
    margin-bottom: 10px; /* Spazio sotto */
}

/* Stile per il cronometro */
.countdown-timer {
    font-size: 2.5rem; /* Testo molto grande per il cronometro */
    font-weight: bold;
    color: #05661a; /* Colore verde scuro */
    text-align: center; /* Centra il testo */
    display: block;
    margin-top: 10px; /* Spazio sopra */
}
.message {
    font-weight: bold;
    margin: 1em 0;
    padding: 12px 14px;
    border-radius: 8px;
    text-align: center;
}

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

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

.message.info {
    color: #0c5460;
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
}
.charge-box {
    border: 2px solid #28a745; /* un verde */
    background-color: #fafffa; /* un verde chiaro */
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.charge-box h3 {
    margin-top: 0;
    color: #28a745;
    font-size: 1.2rem;
}

.charge-box p {
    margin: 0.5rem 0;
    font-size: 1rem;
}

.charge-box strong {
    color: #333;
}

/* Scelta colonnina ricarica */
.charge-station-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 14px 0 18px;
}

.charge-station-card {
    position: relative;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.charge-station-card.is-available,
.charge-station-card.is-own-reserved {
    border-color: #86efac;
    background: #f0fdf4;
    cursor: pointer;
}

.charge-station-card.is-own-reserved {
    border-color: #facc15;
    background: #fffbeb;
}

.charge-station-card.is-available:hover,
.charge-station-card.is-available:focus-within,
.charge-station-card.is-available.selected,
.charge-station-card.is-own-reserved:hover,
.charge-station-card.is-own-reserved:focus-within,
.charge-station-card.is-own-reserved.selected {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22,163,74,.16);
}

.charge-station-card.is-reserved {
    border-color: #fde68a;
    background: #fffbeb;
}

.charge-station-card.is-occupied {
    border-color: #fecaca;
    background: #fef2f2;
}

.charge-station-visual {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 42px;
}

.charge-station-dot {
    position: absolute;
    top: -4px;
    left: -2px;
    font-size: 17px;
    line-height: 1;
}

.charge-station-image {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.charge-station-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.charge-station-info strong {
    color: #111827;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.charge-station-info span {
    color: #4b5563;
    font-size: .92rem;
}

.charge-station-radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.charge-station-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 112px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #ffd400;
    color: #333;
    font-weight: 700;
    font-size: .92rem;
    text-align: center;
}

.charge-station-card.selected .charge-station-action {
    background: #16a34a;
    color: #fff;
}

.charge-station-action.disabled {
    background: #e5e7eb;
    color: #6b7280;
}

.charge-station-required-message {
    font-weight: 700;
}

@media (max-width: 620px) {
    .charge-station-card {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .charge-station-action {
        grid-column: 1 / -1;
        width: 100%;
        box-sizing: border-box;
    }
}


/* Media query per dispositivi mobili */
@media (max-width: 600px) {
    .container {
        max-width: 90vw;
        margin: 20px auto;
        padding: 20px;
    }

    .openbtn {
        width: 30px;
        height: 25px;
    }

    .logo-img {
        max-width: 120px;
    }

    h1 {
        font-size: 1.5rem;
    }

    input, button {
        font-size: 1rem;
    }

    .sidebar.active {
        width: 100%;
    }

    #main.active {
        margin-left: 0;
    }
}


/* =========================================================
   SITE NAME / HEADERS / GDPR / ADMIN FIX
   ========================================================= */

.site-name {
    font-size: 22px;
    line-height: 1.2;
    font-weight: 700;
    margin-bottom: 6px;
    color: #2c3e50;
}

.page-title-block,
.login-title-block,
.admin-title-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.simple-page-header,
.user-header,
.admin-header,
.login-header-original-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.login-title-block h1,
.admin-title-block h1,
.simple-page-header h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.2;
}

.page-subtitle {
    font-size: 16px;
    color: #666;
}

.gdpr-page-container {
    max-width: 1000px;
}

.gdpr-content-open,
.standalone-gdpr-content {
    text-align: left;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 24px;
    line-height: 1.7;
}

.section-header-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

/* Admin full width solo in dashboard admin */
.admin-container {
    width: calc(100% - 40px) !important;
    max-width: none !important;
    margin: 20px !important;
    padding: 24px !important;
    box-sizing: border-box;
    text-align: left;
}

/* Tabella utenti: colonna Nome sempre a sinistra */
.users-table-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.users-table {
    min-width: 1400px;
    width: max-content;
    border-collapse: separate;
    border-spacing: 0;
}

.users-table th.sticky-user-col,
.users-table td.sticky-user-col {
    position: sticky;
    left: 0;
    min-width: 220px;
    width: 220px;
    z-index: 3;
    background: #ffffff;
    box-shadow: 1px 0 0 #ddd;
}

.users-table thead th.sticky-user-col {
    z-index: 4;
    background: #f4f4f4;
}

.users-table tbody tr:nth-child(even) td.sticky-user-col {
    background: #f9f9f9;
}

.users-table tbody tr:hover td.sticky-user-col {
    background: #eef6ff;
}

.users-table th:last-child,
.users-table td:last-child {
    min-width: 240px;
    white-space: nowrap;
}

.users-table td:last-child a,
.users-table td:last-child button {
    margin-right: 8px;
}

@media (max-width: 768px) {
    .site-name {
        font-size: 18px;
    }

    .login-title-block h1,
    .admin-title-block h1,
    .simple-page-header h1 {
        font-size: 24px;
    }

    .users-table th.sticky-user-col,
    .users-table td.sticky-user-col {
        min-width: 180px;
        width: 180px;
    }
}
/* =========================================================
   LOGIN - icone dentro i campi
   ========================================================= */

.login-form .form-group {
    margin-bottom: 15px;
}

.login-form .input-group {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.login-form .input-group .input-icon {
    position: absolute;
    left: 12px;
    width: 20px;
    height: 20px;
    pointer-events: none;
    opacity: 0.75;
}

.login-form .input-group input {
    width: 100%;
    padding: 12px 12px 12px 44px; /* spazio a sinistra per l’icona */
    margin: 0;
    box-sizing: border-box;
}

/* Se togli i label visibili, evita spazio inutile sopra */
.login-form label {
    display: none;
}

/* =========================================================
   ADMIN MOBILE FIX - iPhone / schermi stretti
   ========================================================= */

@media (max-width: 768px) {
    body {
        padding: 0;
        margin: 0;
    }

    .admin-container {
        width: calc(100% - 12px) !important;
        max-width: none !important;
        margin: 6px !important;
        padding: 12px !important;
        border-radius: 10px;
        box-sizing: border-box;
    }

    .header.admin-header {
        display: grid;
        grid-template-columns: 42px 1fr 96px;
        align-items: center;
        gap: 14px;
        padding: 4px 0 10px 0;
    }

    .admin-header .openbtn {
        position: static;
        width: 30px;
        height: 24px;
        margin-top: 0;
        align-self: center;
    }

    .admin-header .openbtn span {
        height: 3px;
    }

    .admin-title-block {
        padding-left: 0;
        width: 100%;
        text-align: left;
        align-items: flex-start;
        justify-content: center;
    }

    .site-name {
        font-size: 14px;
        line-height: 1.15;
        margin: 0 0 2px 0;
        font-weight: 700;
    }

    .admin-title-block h1 {
        font-size: 16px;
        line-height: 1.15;
        margin: 0;
        font-weight: 700;
    }

    .admin-header .logo {
        width: 96px;
        text-align: right;
        display: flex;
        justify-content: flex-end;
        align-items: center;
    }

    .admin-header .logo-img {
        max-width: 88px;
        width: 88px;
        height: auto;
    }

    .header-divider {
        margin: 8px 0 12px 0;
    }

    h2 {
        font-size: 20px;
        line-height: 1.25;
        margin: 0 0 12px 0;
    }

    h3 {
        font-size: 17px;
        line-height: 1.25;
        margin: 0 0 10px 0;
    }

    p,
    label,
    td,
    th,
    a,
    span,
    input,
    select,
    button {
        font-size: 14px;
    }

    .section {
        margin: 12px 0;
        padding: 14px;
        align-items: stretch;
        text-align: left;
    }

    .table-responsive,
    .users-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .users-table {
        min-width: 1050px;
    }

    .users-table th.sticky-user-col,
    .users-table td.sticky-user-col {
        min-width: 150px;
        width: 150px;
        left: 0;
    }

    form {
        margin-bottom: 16px;
    }

    form input,
    form select,
    form button,
    form .btn,
    form .btn-primary,
    form .btn-secondary {
        width: 100%;
        max-width: none;
        box-sizing: border-box;
    }

    .filter-form,
    .report-filters {
        display: flex;
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    button,
    .btn-primary,
    .btn-secondary {
        max-width: none;
    }

    .sidebar {
        z-index: 9999;
    }

    .sidebar.active {
        width: 100% !important;
    }

    #main.active {
        margin-left: 0 !important;
    }
}

/* =========================================================
   USER DASHBOARD MOBILE WIDTH FIX
   ========================================================= */
@media (max-width: 768px) {
    #main {
        margin-left: 0 !important;
        padding: 8px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    #main > .container {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 16px !important;
        box-sizing: border-box !important;
        border-radius: 12px !important;
    }

    #main > .container .dashboard,
    #main > .container .section,
    #main > .container .card,
    #main > .container .header.user-header {
        width: 100% !important;
        max-width: none !important;
        box-sizing: border-box !important;
    }
}

/* Calendario disponibilità nella prenotazione utente */
.booking-date-calendar-field {
    width: 100%;
}
.booking-date-calendar-intro {
    margin: 0 0 12px;
}
.booking-date-calendar {
    width: 100%;
    overflow: hidden;
    border: 1px solid #d7dde5;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .07);
}
.booking-date-calendar__toolbar {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid #e5e9ef;
    background: #f8fafc;
}
.booking-date-calendar__toolbar > div {
    min-width: 0;
    text-align: center;
}
.booking-date-calendar__toolbar strong {
    display: block;
    color: #1f2937;
    font-size: 18px;
    line-height: 1.2;
    text-transform: capitalize;
}
.booking-date-calendar__toolbar span {
    display: block;
    min-height: 17px;
    margin-top: 3px;
    color: #64748b;
    font-size: 12px;
}
.booking-date-calendar__toolbar span.is-error { color: #b42318; }
.booking-date-calendar__nav {
    width: 42px;
    height: 42px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #fff;
    color: #1f2937;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}
.booking-date-calendar__nav:hover:not(:disabled) { background: #eef5ff; border-color: #82aee8; }
.booking-date-calendar__nav:disabled { opacity: .35; cursor: not-allowed; }
.booking-date-calendar__weekdays,
.booking-date-calendar__grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}
.booking-date-calendar__weekdays {
    border-bottom: 1px solid #e5e9ef;
    background: #fff;
}
.booking-date-calendar__weekdays span {
    padding: 8px 2px;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
}
.booking-date-calendar__grid {
    background: #e5e9ef;
    gap: 1px;
}
.booking-date-calendar__day {
    position: relative;
    min-width: 0;
    min-height: 86px;
    padding: 7px 5px;
    border: 0;
    background: #fff;
    color: #334155;
    font: inherit;
    text-align: center;
    cursor: pointer;
}
.booking-date-calendar__day:hover:not(:disabled) { z-index: 1; box-shadow: inset 0 0 0 2px #3b82f6; }
.booking-date-calendar__day:disabled { cursor: not-allowed; }
.booking-date-calendar__day.is-outside-month { background: #f8fafc; opacity: .42; }
.booking-date-calendar__number {
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 900;
}
.booking-date-calendar__state,
.booking-date-calendar__detail {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.booking-date-calendar__state { margin-top: 3px; font-size: 10px; font-weight: 900; }
.booking-date-calendar__detail { margin-top: 3px; color: #64748b; font-size: 9px; }
.booking-date-calendar__day.is-available { background: #f0fdf4; }
.booking-date-calendar__day.is-available .booking-date-calendar__state { color: #16723a; }
.booking-date-calendar__day.is-limited { background: #fff8e6; }
.booking-date-calendar__day.is-limited .booking-date-calendar__state { color: #9a6700; }
.booking-date-calendar__day.is-full,
.booking-date-calendar__day.is-unavailable,
.booking-date-calendar__day.is-own_booking { background: #f8fafc; color: #94a3b8; }
.booking-date-calendar__day.is-full .booking-date-calendar__state,
.booking-date-calendar__day.is-unavailable .booking-date-calendar__state,
.booking-date-calendar__day.is-own_booking .booking-date-calendar__state { color: #64748b; }
.booking-date-calendar__day.is-closed { background: #fff1f2; color: #9f1239; }
.booking-date-calendar__day.is-closed .booking-date-calendar__state { color: #be123c; }
.booking-date-calendar__day.is-past,
.booking-date-calendar__day.is-pending { background: #f1f5f9; color: #94a3b8; }
.booking-date-calendar__day.is-today .booking-date-calendar__number { box-shadow: inset 0 0 0 2px #2563eb; color: #1d4ed8; }
.booking-date-calendar__day.is-selected { z-index: 2; box-shadow: inset 0 0 0 3px #1d4ed8; }
.booking-date-calendar__day.is-selected .booking-date-calendar__number { background: #1d4ed8; color: #fff; }
.booking-date-calendar__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-top: 1px solid #e5e9ef;
    background: #f8fafc;
}
.booking-date-calendar__today {
    border: 0;
    background: transparent;
    color: #1d4ed8;
    font-weight: 800;
    cursor: pointer;
}
.booking-date-calendar__legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 12px; color: #64748b; font-size: 10px; }
.booking-date-calendar__legend span { display: inline-flex; align-items: center; gap: 4px; }
.booking-date-calendar__legend i { width: 9px; height: 9px; border-radius: 50%; }
.booking-date-calendar__legend i.is-available { background: #22c55e; }
.booking-date-calendar__legend i.is-limited { background: #f59e0b; }
.booking-date-calendar__legend i.is-full { background: #94a3b8; }
.booking-date-calendar__legend i.is-closed { background: #e11d48; }
.booking-date-calendar.is-loading .booking-date-calendar__grid { opacity: .58; pointer-events: none; }
.booking-selected-date {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 9px;
    background: #eef5ff;
    color: #1e3a5f;
    font-size: 13px;
    font-weight: 800;
}
@media (max-width: 640px) {
    .booking-date-calendar__toolbar { grid-template-columns: 38px minmax(0, 1fr) 38px; padding: 9px 7px; }
    .booking-date-calendar__nav { width: 38px; height: 38px; }
    .booking-date-calendar__toolbar strong { font-size: 16px; }
    .booking-date-calendar__day { min-height: 62px; padding: 4px 2px; }
    .booking-date-calendar__number { width: 24px; height: 24px; font-size: 12px; }
    .booking-date-calendar__state { font-size: 8px; }
    .booking-date-calendar__detail { display: none; }
    .booking-date-calendar__footer { align-items: flex-start; flex-direction: column; }
    .booking-date-calendar__legend { justify-content: flex-start; }
}

/* =========================================================
   ENEA 2026-09-22 R4 - TELEFONO ADMIN MIRATO E CLICCABILE
   Ingrandisce solo il numero, mai email/righe/contenitori.
   ========================================================= */
.admin-phone {
    display: inline-block;
    max-width: 100%;
    font-size: 18px !important;
    line-height: 1.3 !important;
    font-weight: 850 !important;
    color: #0f3d78 !important;
    text-decoration: underline !important;
    text-decoration-thickness: 1px !important;
    text-underline-offset: 2px !important;
    white-space: nowrap !important;
    overflow: visible !important;
}
.admin-phone:hover,
.admin-phone:focus { color: #0b2f5d !important; }
.stay-contact-meta {
    display: inline;
    font-size: inherit !important;
    font-weight: 400 !important;
    color: inherit !important;
    overflow-wrap: anywhere;
}
.stay-contact-phone {
    display: inline-block;
    margin-top: 3px;
}
@media (max-width: 760px) {
    .admin-phone { font-size: 20px !important; }
}


/* ENEA dashboard layout CSS-only v4 */
@media screen {
.user-dashboard-page .user-header .site-name {
    font-size: clamp(1.4rem, 4vw, 2rem);
    line-height: 1.15;
    overflow-wrap: anywhere;
}
.user-dashboard-page .dashboard > h2 { text-align: left; font-size: 1.15rem; }
.user-dashboard-page .dashboard > .section {
    box-sizing: border-box;
    border-radius: 22px;
    padding: clamp(14px, 3vw, 24px);
}
.user-dashboard-page .section div:has(> div #instantBookingForm):has(> div > a[href="dashboard?section=bookings"]) {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)) !important;
}
.user-dashboard-page .section div:has(> #instantBookingForm),
.user-dashboard-page .section div:has(> div > h4):has(> a[href="dashboard?section=bookings"]) {
    border-radius: 18px !important;
    text-align: left;
}
.user-dashboard-page #instantBookingForm .form-group { align-items: stretch; }
.user-dashboard-page #instant_departure_time {
    min-height: 48px;
    width: 100%;
    box-sizing: border-box;
    border-radius: 12px;
    font-size: 1rem;
}
.user-dashboard-page #instantBookingForm .payment-choice-buttons { flex-direction: column; }
.user-dashboard-page #instantBookingForm .instantBookingSubmitButton {
    min-height: 48px;
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: 14px;
}
.admin-dashboard-page .ops-dashboard .ops-primary-actions .ops-primary-gate {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
    min-height: 56px;
    border-radius: 16px;
    font-size: 1.12rem;
}
.admin-dashboard-page .ops-dashboard .ops-secondary-nav {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 110px), 1fr)) !important;
    gap: 8px;
}
.admin-dashboard-page .ops-dashboard .ops-secondary-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    box-sizing: border-box;
    padding: 12px 6px;
    min-width: 0;
    border-radius: 14px;
    overflow-wrap: anywhere;
}
.admin-dashboard-page .ops-dashboard .stay-mini-summary a {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px;
    border-radius: 14px;
}
.admin-dashboard-page .ops-dashboard .stay-mini-summary strong { font-size: 1.6rem; }

/* Sosta in corso e dopo la scadenza */
.user-dashboard-page .stay-user-card {
    text-align: left;
    padding: clamp(16px, 3vw, 28px);
    border-radius: 24px;
}
.user-dashboard-page .stay-user-head h3 {
    font-size: clamp(1.45rem, 4vw, 2rem);
    line-height: 1.15;
}
.user-dashboard-page .stay-user-head .stay-note { margin: 6px 0; }
.user-dashboard-page .stay-user-status { padding: 8px 14px; }
.user-dashboard-page .stay-user-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "expiry remaining" "plate start";
    gap: 10px;
    margin-block: 18px;
}
.user-dashboard-page .stay-user-item { border-radius: 16px; padding: 12px; }
.user-dashboard-page .stay-user-item:nth-child(1) { grid-area: plate; }
.user-dashboard-page .stay-user-item:nth-child(2) { grid-area: start; }
.user-dashboard-page .stay-user-item:nth-child(3) { grid-area: expiry; }
.user-dashboard-page .stay-user-item:nth-child(4) { grid-area: remaining; }
.user-dashboard-page .stay-user-item:nth-child(n+3) {
    padding: clamp(12px, 2.6vw, 22px);
    border-top: 3px solid;
    border-top-color: #e2e8f0;
}
.user-dashboard-page .stay-user-item:nth-child(n+3) strong {
    display: block;
    margin-top: 6px;
    font-size: clamp(1.2rem, 4.3vw, 2rem);
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}
.user-dashboard-page .stay-action-card,
.user-dashboard-page .stay-box,
.user-dashboard-page .stay-decision-card { padding: 16px; border-radius: 18px; }
.user-dashboard-page .stay-action-card h4 {
    font-size: 1.1rem;
    text-transform: none;
    letter-spacing: normal;
}
.user-dashboard-page .stay-user-card .btn { border-radius: 13px; }
.user-dashboard-page .stay-grace-line,
.user-dashboard-page .stay-alert-line { padding: 14px; border-radius: 14px; }
.user-dashboard-page .stay-user-card details > summary { padding-block: 10px; }

/* La scheda compare soltanto per le ricariche che il gestionale indica come attive. */
.user-dashboard-page .charge-box {
    box-sizing: border-box;
    width: 100%;
    padding: clamp(14px, 3vw, 22px);
    border-radius: 20px;
    text-align: left;
}
.user-dashboard-page .charge-box > p {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin: 0;
    padding-block: 10px;
    border-bottom: 1px solid #ddd;
}
.user-dashboard-page .charge-countdown {
    font-size: clamp(1.25rem, 4vw, 1.75rem);
    font-variant-numeric: tabular-nums;
}
.user-dashboard-page .charge-box summary { padding-block: 10px; }
@media (max-width: 360px) {
    .user-dashboard-page .stay-user-card { padding: 12px; }
    .user-dashboard-page .stay-user-grid { gap: 6px; }
}

}
/* Dashboard di arrivo e prenotazione futura */
@media screen {
.user-dashboard-page #main > .container {
    box-sizing: border-box;
    max-width: 760px;
    /* Conserva sfondo e ombra del contenitore del sito. */
}
.user-dashboard-page #main .user-header {
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-dashboard-page .user-header .logo { order: -1; flex: none; }
.user-dashboard-page .user-header .logo-img {
    display: block;
    object-fit: contain;
    width: 62px;
    height: 62px;
    padding: 4px;
    box-sizing: border-box;
    background: white;
    border: 2px solid #ffd400;
    border-radius: 50%;
}
.user-dashboard-page .user-header .openbtn {
    order: 3;
    margin-left: auto;
    flex: none;
    width: 44px;
    height: 44px;
    padding: 13px 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 50%;
}
.user-dashboard-page #main .dashboard > h2 {
    margin: 16px 0 12px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    text-align: left;
    font-size: clamp(1.35rem, 4vw, 2rem);
    line-height: 1.2;
}
.user-dashboard-page #main .dashboard > h2 .username { color: inherit; font-size: inherit; }
.user-dashboard-page #main .arrival-choices {
    background: #f2f2f2;
    padding: 5px;
    border-radius: 16px;
}
.user-dashboard-page #main .arrival-choice {
    min-height: 52px;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    padding: 10px;
}
.user-dashboard-page #main .arrival-choice img { width: 20px; height: 20px; }
.user-dashboard-page #main :is(#instantBookingForm, #bookingForm) {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    text-align: left;
}
.user-dashboard-page #main #bookingForm {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: clamp(12px, 3vw, 24px);
    border: 1px solid #ddd;
    border-radius: 22px;
    background: white;
}
.user-dashboard-page #bookingForm > .form-group {
    grid-column: 1 / -1;
    min-width: 0;
    align-items: stretch;
    margin: 0;
}
.user-dashboard-page #bookingForm > .form-group:has(> :is(#guests, #booking_license_plate)) { grid-column: span 1; }
.user-dashboard-page #main :is(#instantBookingForm, #bookingForm) label[for] {
    font-size: .94rem;
    text-align: left;
    line-height: 1.3;
    margin: 0;
    font-weight: 700;
}
.user-dashboard-page #bookingForm label:is([for="booking_arrival_date"],[for="booking_arrival_time"],[for="booking_departure_time"])::before {
    display: inline-grid;
    place-items: center;
    width: 1.55rem;
    height: 1.55rem;
    margin-right: .45rem;
    border-radius: 50%;
    background: #f2f2f2;
    color: inherit;
    font-size: .82rem;
}
.user-dashboard-page #bookingForm label[for="booking_arrival_date"]::before { content: "1"; }
.user-dashboard-page #bookingForm label[for="booking_arrival_time"]::before { content: "2"; }
.user-dashboard-page #bookingForm label[for="booking_departure_time"]::before { content: "3"; }
.user-dashboard-page #main :is(#booking_arrival_time, #booking_arrival_date, #booking_departure_time, #instant_departure_time, #bookingForm #guests, #booking_license_plate, #booking_notes) {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 12px;
    background-color: #f9f9f9;
    font: inherit;
}
.user-dashboard-page #main :is(#bookingForm, #instantBookingForm) select:disabled { opacity: .7; }
.user-dashboard-page #main :is(#bookingForm, #instantBookingForm) :focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}
.user-dashboard-page #main :is(#bookingSummary, #instantBookingSummary):not(:empty) {
    padding: 16px;
    border-radius: 16px;
    background: #f2f2f2;
    color: inherit;
    text-align: left;
    line-height: 1.45;
    font-size: 1.1rem !important;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.user-dashboard-page #main :is(#instantBookingForm, #bookingForm) .payment-choice-buttons { flex-direction: column; }
.user-dashboard-page #main :is(#instantBookingForm, #bookingForm) button[name="payment_provider"] {
    width: 100%;
    max-width: none;
    min-height: 50px;
    margin: 0;
    padding: 12px;
    border-radius: 14px;
    font-size: 1.05rem;
}
@media (max-width: 430px) {
    .user-dashboard-page #main #bookingForm { grid-template-columns: minmax(0, 1fr); }
    .user-dashboard-page #main .user-header .logo-img { width: 52px; height: 52px; }
}
}
@media screen {
.user-dashboard-page #main .dashboard-language[open] > div {
    width: max-content;
    min-width: 10.5rem;
    max-width: calc(100vw - 32px);
}
.user-dashboard-page #main .dashboard-language button[lang] {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: none;
    padding: 10px 12px;
    min-height: 44px;
    text-align: left;
}
.user-dashboard-page .dashboard-language button[lang]::before {
    content: "";
    flex: 0 0 24px;
    height: 18px;
    background: var(--enea-language-flag) center / contain no-repeat;
}
.user-dashboard-page .dashboard-language button[lang="it"] { --enea-language-flag: url("/assets/flags/it.png"); }
.user-dashboard-page .dashboard-language button[lang="en"] { --enea-language-flag: url("/assets/flags/en.png"); }
.user-dashboard-page .dashboard-language button[lang="fr"] { --enea-language-flag: url("/assets/flags/fr.png"); }
.user-dashboard-page .dashboard-language button[lang="es"] { --enea-language-flag: url("/assets/flags/es.png"); }
.user-dashboard-page .dashboard-language button[lang="de"] { --enea-language-flag: url("/assets/flags/de.png"); }
}
@media screen {
/* Il logo mantiene intere anche le firme orizzontali. */
body .container .header .logo,
body #main .header .logo { flex: 0 0 auto; }
body .container .header:not(.login-header-original-right) .logo .logo-img,
body #main .user-header .logo .logo-img {
    display: block;
    width: clamp(96px, 22vw, 140px);
    height: clamp(80px, 19vw, 116px);
    max-width: 100%;
    object-fit: contain;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}
body .container .header :is(.login-title-block,.page-title-block,.admin-title-block) { min-width: 0; overflow-wrap: anywhere; }
body .container:has(.language-links) { border-radius: 20px; }
body .language-links:has(> img[onclick]) {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}
body .language-links > img[onclick] {
    box-sizing: content-box;
    width: 25px !important;
    height: 22px;
    object-fit: contain;
    padding: 10px 66px 10px 9px;
    margin: 0 !important;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: white var(--enea-language-caption) right 5px center / 58px 20px no-repeat;
}
.admin-dashboard-page .admin-language-box .admin-language-switch { display: grid; grid-template-columns: 1fr; }
.admin-dashboard-page .admin-language-switch .admin-language-button { min-height: 42px; width: 100%; justify-content: flex-start; gap: 8px; }
.admin-dashboard-page .admin-language-switch .admin-language-button img { width: 22px; height: 16px; object-fit: contain; }
.admin-dashboard-page .admin-language-switch .admin-language-button span { font-size: 0; }
.admin-dashboard-page .admin-language-switch .admin-language-button span::after { content: var(--enea-language-name); font-size: .92rem; }
.language-links > img[src$="/it.png"] { --enea-language-caption: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2258%22%20height%3D%2220%22%3E%3Ctext%20x%3D%220%22%20y%3D%2215%22%20fill%3D%22%23333%22%20font-family%3D%22Arial%2Csans-serif%22%20font-size%3D%2213%22%3EItaliano%3C%2Ftext%3E%3C%2Fsvg%3E"); }
.admin-language-button[value="it"] { --enea-language-name: "Italiano"; }
.language-links > img[src$="/en.png"] { --enea-language-caption: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2258%22%20height%3D%2220%22%3E%3Ctext%20x%3D%220%22%20y%3D%2215%22%20fill%3D%22%23333%22%20font-family%3D%22Arial%2Csans-serif%22%20font-size%3D%2213%22%3EEnglish%3C%2Ftext%3E%3C%2Fsvg%3E"); }
.admin-language-button[value="en"] { --enea-language-name: "English"; }
.language-links > img[src$="/fr.png"] { --enea-language-caption: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2258%22%20height%3D%2220%22%3E%3Ctext%20x%3D%220%22%20y%3D%2215%22%20fill%3D%22%23333%22%20font-family%3D%22Arial%2Csans-serif%22%20font-size%3D%2213%22%3EFran%C3%A7ais%3C%2Ftext%3E%3C%2Fsvg%3E"); }
.admin-language-button[value="fr"] { --enea-language-name: "Français"; }
.language-links > img[src$="/es.png"] { --enea-language-caption: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2258%22%20height%3D%2220%22%3E%3Ctext%20x%3D%220%22%20y%3D%2215%22%20fill%3D%22%23333%22%20font-family%3D%22Arial%2Csans-serif%22%20font-size%3D%2213%22%3EEspa%C3%B1ol%3C%2Ftext%3E%3C%2Fsvg%3E"); }
.admin-language-button[value="es"] { --enea-language-name: "Español"; }
.language-links > img[src$="/de.png"] { --enea-language-caption: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2258%22%20height%3D%2220%22%3E%3Ctext%20x%3D%220%22%20y%3D%2215%22%20fill%3D%22%23333%22%20font-family%3D%22Arial%2Csans-serif%22%20font-size%3D%2213%22%3EDeutsch%3C%2Ftext%3E%3C%2Fsvg%3E"); }
.admin-language-button[value="de"] { --enea-language-name: "Deutsch"; }
}
/* END ENEA dashboard layout CSS-only v4 */

.container:has(.login-language-picker) { border-radius: 20px; }
.login-language-picker { width: fit-content; max-width: 100%; margin: 8px 0 16px auto; }
.login-language-picker summary, .login-language-picker button {
    display: flex; align-items: center; gap: 8px; min-height: 44px;
    padding: 8px 12px; box-sizing: border-box; cursor: pointer;
}
.login-language-picker summary {
    width: fit-content; margin-left: auto; list-style: none; border-radius: 24px;
    background: #fff; border: 1px solid #ccc;
}
.login-language-picker summary::-webkit-details-marker { display: none; }
.login-language-picker img { width: 24px; height: 18px; object-fit: contain; }
.login-language-picker[open] summary > span { transform: rotate(180deg); }
.login-language-options { width: 10rem; max-width: 100%; margin-top: 6px; padding: 4px; border: 1px solid #ddd; border-radius: 12px; }
.login-language-picker button { width: 100%; max-width: none; border: 0; text-align: left; border-radius: 8px; }
.login-language-picker button[aria-current] { font-weight: 700; box-shadow: inset 3px 0 currentColor; }
.login-language-picker :focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* Selettore lingua tra il titolo del login e il logo dell'area. */
.container .login-header-original-right {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: clamp(6px, 2vw, 16px);
}
.login-header-original-right .login-language-picker {
    position: relative;
    margin: 0;
}
.login-header-original-right .login-language-options {
    position: absolute;
    z-index: 5;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 10rem;
    max-width: calc(100vw - 24px);
    box-sizing: border-box;
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
@media (max-width: 430px) {
    .login-header-original-right .login-language-picker summary {
        padding-inline: 5px;
        gap: 3px;
    }
    .login-header-original-right .login-language-picker summary img { width: 19px; }
}

/* Visualizza lo stato solo accanto al comando di accesso pertinente. */
.user-dashboard-page .dashboard > .section:not(:has(#openGateButton)) > #gateStatus {
    display: none;
}
/* Dashboard utente: logo leggibile, con spazio dedicato anche su telefono. */
body.user-dashboard-page #main .header.user-header .logo .logo-img {
    width: clamp(150px, 32vw, 220px);
    height: auto;
    max-height: 176px;
    object-fit: contain;
    padding: 0;
    border: 0;
    border-radius: 0;
}
@media (max-width: 600px) {
    body.user-dashboard-page #main .header.user-header {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }
    body.user-dashboard-page #main .user-header .page-title-block {
        order: 4;
        flex: 1 0 100%;
    }
    body.user-dashboard-page #main .header.user-header .logo .logo-img {
        width: clamp(138px, 43vw, 172px);
        max-height: 148px;
    }
}

/* Unico selettore nella testata delle pagine utente. */
.login-language-picker { position: relative; z-index: 5; }
.login-language-picker .login-language-options {
    position: absolute; top: 100%; right: 0; margin-top: 6px;
    width: 10rem; max-width: calc(100vw - 24px); box-sizing: border-box;
    background: white; box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.container .simple-page-header:has(.login-language-picker) {
    display: grid; grid-template-columns: minmax(0,1fr) auto auto;
    align-items: center; gap: clamp(6px,2vw,16px);
}
.header .login-language-picker { margin: 0; flex: none; }
.header .login-language-picker .login-language-options { right: auto; left: 50%; transform: translateX(-50%); }
.user-dashboard-page #main .user-header .logo { order: 2; }
.user-dashboard-page #main .user-header .openbtn { order: -1; margin-left: 0; }
.user-dashboard-page #main .user-header .login-language-picker { order: 1; margin-left: auto; }
@media (max-width:600px) {
    .header .login-language-picker summary { gap: 3px; padding-inline: 5px; }
    .header .login-language-picker summary img { width: 19px; }
}

/* La misura si applica solo alle bandiere del selettore. */
details.login-language-picker :is(summary, button) > img {
    width: 24px;
    height: 16px;
    max-width: 24px;
    flex: 0 0 24px;
    object-fit: contain;
}
details.login-language-picker > summary::marker { content: ""; }
details.login-language-picker > summary::-webkit-details-marker { display: none; }

/* Dashboard admin desktop: larghezza del comando proporzionata al testo. */
@media (min-width: 769px) {
    .admin-dashboard-page .ops-dashboard .ops-primary-actions > #openGateButton.ops-primary-gate {
        justify-self: start;
        width: fit-content;
        max-width: 100%;
        min-height: 44px;
        padding: 10px 18px;
    }
}

.user-dashboard-page .stay-user-grid.stay-checkout-times {
    grid-template-areas: "expiry expiry" "plate start";
    grid-template-columns: repeat(2,minmax(0,1fr));
}

body.user-dashboard-page #main .header.user-header {
    display: grid;
    grid-template-columns: auto minmax(0,1fr) auto auto;
    gap: clamp(8px, 1.5vw, 16px);
    align-items: center;
}
body.user-dashboard-page #main .user-header > :is(.openbtn,.page-title-block,.login-language-picker,.logo) { order: 0; margin: 0; }
body.user-dashboard-page #main .user-header .site-name { margin: 0; overflow-wrap: anywhere; }
body.user-dashboard-page #main .header.user-header .logo .logo-img {
    display: block; width: clamp(156px, 17vw, 196px); height: auto; max-height: 176px; object-fit: contain;
}
@media (max-width: 620px) {
    body.user-dashboard-page #main .header.user-header { grid-template-columns: auto minmax(0,1fr) auto; }
    body.user-dashboard-page #main .user-header .page-title-block { grid-row: 1; grid-column: 1 / 3; }
    body.user-dashboard-page #main .user-header .openbtn { grid-row: 2; grid-column: 1; }
    body.user-dashboard-page #main .user-header .login-language-picker { grid-row: 2; grid-column: 2; justify-self: start; }
    body.user-dashboard-page #main .user-header .login-language-options { left: 0; right: auto; transform: none; }
    body.user-dashboard-page #main .user-header .logo { grid-column: 3; grid-row: 1 / 3; }
    body.user-dashboard-page #main .header.user-header .logo .logo-img { width: clamp(120px,35vw,152px); }
}
