/* STILI PER MODALE META FIELDS OSPITE */

/* Badge conteggio accessi - Design moderno */
.access-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.5rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-top: 0.6rem;
    box-shadow:
        0 4px 15px rgba(102, 126, 234, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: badgeGlow 3s ease-in-out infinite;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.access-count-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: badgeShine 2s infinite;
}

.access-count-badge i {
    font-size: 0.85rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.access-count-badge span {
    position: relative;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

@keyframes badgeGlow {
    0%, 100% {
        box-shadow:
            0 4px 15px rgba(102, 126, 234, 0.4),
            0 2px 4px rgba(0, 0, 0, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    50% {
        box-shadow:
            0 6px 20px rgba(102, 126, 234, 0.6),
            0 3px 6px rgba(0, 0, 0, 0.15),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
}

@keyframes badgeShine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Riga nome e QR code */
.guest-name-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.guest-name-row h4 {
    margin: 0;
    flex: 1;
}

.guest-qr-inline {
    font-size: 0.75rem;
    color: var(--bs-primary, #6571ff);
    font-family: 'Courier New', monospace;
    background: rgba(101, 113, 255, 0.1);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid rgba(101, 113, 255, 0.2);
}

/* Stili per la label dell'ospite */
.guest-label {
    font-size: 0.8rem;
    color: var(--bs-gray-600, #7987a1);
    margin-bottom: 0.3rem;
    font-weight: 500;
    background: rgba(101, 113, 255, 0.1);
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
    display: inline-block;
    border-left: 3px solid var(--bs-primary, #6571ff);
}

.guest-meta-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    /* CORREZIONE: Transizione per x-show */
    transition: opacity 0.3s ease-in-out;
}

/* CORREZIONE: JavaScript vanilla gestisce la visibilità */
.guest-meta-modal {
    display: none;
}

.guest-meta-modal.modal-show {
    display: flex;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    /* max-width precedente: 600px */
    max-width: 760px; /* Più larghezza per ospitare 3 colonne di meta fields */
    width: 100%;
    max-height: 90vh; /* Aumentato per contenere tutto */
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
    /* AGGIUNTO: Layout flex per gestire correttamente header, body e footer */
    display: flex;
    flex-direction: column;
}

/* MODIFICATO: GuestMetaModal con layout flex corretto e larghezza aumentata */
/* PRECEDENTE: max-width: 760px */
/* MOTIVO: Allargare il modale per far stare tutto più comodo con layout a 2 colonne */
#guest-meta-modal .modal-content {
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    max-width: 900px; /* Aumentato da 760px per più spazio */
}

/* Vecchio: max-height 95vh rigido -> su tablet il contenuto poteva uscire */
/* Adeguiamo ulteriormente l'altezza per lasciare più margine alla UI del browser */
#accredit-confirm-modal .modal-content {
    /* max-height precedente: 92vh */
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e9ecef;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex-shrink: 0; /* Non si restringe */
}

/* MODIFICATO: Header per modale accredito - padding ridotto */
#accredit-confirm-modal .modal-header {
    padding: 16px 20px; /* Ridotto padding */
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

/* MODIFICATO: Rimuove scroll dal modal-body per GuestMetaModal */
/* PRECEDENTE: overflow-y: auto su tutto il modal-body */
/* MOTIVO: Lo scroll deve essere solo nella sezione Operations History */
#guest-meta-modal .modal-body {
    overflow-y: visible;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 24px;
}

/* Vecchio: overflow-y: visible senza limite -> su tablet parte del contenuto veniva tagliato */
#accredit-confirm-modal .modal-body {
    padding: 1rem 1.25rem; /* Ridotto padding per risparmiare spazio */
    overflow-y: auto; /* Riattiviamo scroll verticale quando serve */
    max-height: none;
    flex: 1; /* Occupa lo spazio disponibile tra header e footer */
    display: flex;
    flex-direction: column;
    min-height: 0; /* Permette al flex di funzionare correttamente */
}

.guest-meta-info {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.guest-basic-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

/* MIGLIORATO: Sezione informazioni base per modale meta */
.guest-basic-info-meta {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.1);
    margin-bottom: 1.5rem;
    flex-shrink: 0;
}

.guest-avatar-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    flex-shrink: 0;
}

.guest-details-large h4 {
    margin: 0 0 8px 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
}

.guest-details-large p {
    margin: 4px 0;
    color: #6c757d;
    font-size: 0.9rem;
}

.guest-qr {
    font-family: 'Courier New', monospace;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* AGGIUNTO: Wrapper per layout a due colonne */
/* PRECEDENTE: Sezioni separate verticalmente */
/* MOTIVO: Mettere Additional Information e Operations History su due colonne */
.guest-meta-sections-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
    align-items: flex-start;
    min-height: 0;
}

.guest-meta-section {
    margin-top: 0;
    flex-shrink: 0;
}

.guest-history-section {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    padding-left: 1.5rem;
    flex: 1;
    max-height: none;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

/* MODIFICATO: Se non ci sono meta fields, lo storico occupa tutta la larghezza */
.guest-history-section-full {
    grid-column: 1 / -1;
    border-left: none;
    padding-left: 0;
}

.meta-section-title {
    margin: 0 0 1.25rem 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid rgba(102, 126, 234, 0.1);
}

.meta-section-title i {
    color: #667eea;
    font-size: 1.2rem;
}

/* AGGIUNTO: Badge per conteggio operazioni */
/* PRECEDENTE: Nessun badge */
/* MOTIVO: Mostrare il numero totale di operazioni accanto al titolo */
.operations-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: #667eea;
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
    line-height: 1;
}

.meta-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.meta-field-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s;
}

.meta-field-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

/* NUOVO: Layout compatto per meta fields */
.meta-fields-compact {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid #e9ecef;
    max-height: 400px;
    overflow-y: auto;
}

/* 3 colonne per più spazio orizzontale alle Additional Information */
.accredit-meta-fields-compact-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    /* Altezza fissa: 2 righe (3+3) con card da 44px per ridurre scroll */
    min-height: calc(2 * 44px + 1 * 0.5rem);
    max-height: calc(2 * 44px + 1 * 0.5rem);
}

/* MODIFICATO: Layout a 2 colonne per Additional Information nel GuestMetaModal */
/* PRECEDENTE: 3 colonne (5 slot sempre) */
/* MOTIVO: Stringere lo spazio mostrando 2 campi per riga (sempre 5 slot = 3 righe) */
.guest-meta-fields-two-columns {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    /* Altezza fissa: 3 righe (2+2+1) con card da 42px */
    min-height: calc(3 * 42px + 2 * 0.5rem);
    max-height: calc(3 * 42px + 2 * 0.5rem);
}

/* MODIFICATO: Stili per i campi meta nel layout a 2 colonne */
.guest-meta-fields-two-columns .guest-meta-field-compact.guest-meta-field-vertical {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.18rem;
    font-size: 0.7rem;
    line-height: 1.22;
    padding: 0.38rem 0.5rem;
    background: #ffffff;
    border-radius: 8px;
    border: 1.5px solid rgba(99, 102, 241, 0.15);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.1);
    min-height: 42px;
    height: 42px;
    justify-content: center;
}

.guest-meta-fields-two-columns .guest-meta-field-compact.guest-meta-field-vertical:hover {
    background: #f8fafc;
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.15);
}

.guest-meta-fields-two-columns .meta-field-label-compact.meta-field-label-vertical {
    font-size: 0.64rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 0;
    line-height: 1.05;
    width: 100%;
}

.guest-meta-fields-two-columns .meta-field-label-compact.meta-field-label-vertical.meta-field-empty {
    background: transparent;
    border: none;
    padding: 0;
    min-height: 0;
    height: 0;
}

.guest-meta-fields-two-columns .meta-field-value-compact.meta-field-value-vertical {
    font-size: 0.75rem;
    color: #1f2937;
    font-weight: 500;
    line-height: 1.3;
    width: 100%;
    word-break: break-word;
}

.guest-meta-fields-two-columns .meta-field-value-compact.meta-field-value-vertical.meta-field-empty {
    background: transparent;
    border: none;
    padding: 0;
    min-height: 0;
    height: 0;
}

/* Vecchio: altezza 50px; riduciamo ancora per comprimere verticalmente */
.accredit-meta-fields-compact-list .guest-meta-field-compact.guest-meta-field-vertical {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.18rem;
    font-size: 0.7rem; /* ancora più compatto */
    line-height: 1.22;
    padding: 0.38rem 0.5rem; /* padding ridotto */
    background: #ffffff;
    border-radius: 8px;
    border: 1.5px solid rgba(99, 102, 241, 0.15);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.1);
    min-height: 42px;
    height: 42px;
    justify-content: center;
}

.accredit-meta-fields-compact-list .guest-meta-field-compact.guest-meta-field-vertical:hover {
    background: #f8fafc;
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.15);
}

/* Vecchio: font-size 0.6875rem; riduciamo per comprimere verticalmente */
.accredit-meta-fields-compact-list .meta-field-label-compact.meta-field-label-vertical {
    font-size: 0.64rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 0;
    line-height: 1.05;
    width: 100%;
}

/* AGGIUNTO: Segnaposto per label vuota (identico a WardrobeManage) */
.accredit-meta-fields-compact-list .meta-field-label-compact.meta-field-label-vertical.meta-field-empty {
    height: 16px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 3px;
}

/* Vecchio: font-size 0.8125rem; riduciamo per comprimere verticalmente */
.accredit-meta-fields-compact-list .meta-field-value-compact.meta-field-value-vertical {
    font-size: 0.76rem;
    color: #1e293b;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    margin-left: 0;
    line-height: 1.18;
    margin-top: 0;
}

/* AGGIUNTO: Segnaposto per value vuota (identico a WardrobeManage) */
.accredit-meta-fields-compact-list .meta-field-value-compact.meta-field-value-vertical.meta-field-empty {
    height: 20px;
    background: rgba(99, 102, 241, 0.03);
    border-radius: 3px;
    margin-top: 0.25rem;
}

.meta-fields-compact::-webkit-scrollbar {
    width: 6px;
}

.meta-fields-compact::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.meta-fields-compact::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 10px;
}

.meta-fields-compact::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

.meta-field-compact {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.meta-field-compact:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.02);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.1);
}

.meta-field-label-compact {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6c757d;
    min-width: 140px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    line-height: 1.4;
}

.meta-field-label-compact i {
    color: #667eea;
    opacity: 0.6;
}

.meta-field-value-compact {
    font-size: 0.9rem;
    color: #2d3748;
    font-weight: 500;
    word-break: break-word;
    line-height: 1.4;
    flex: 1;
    min-width: 0;
}

/* NUOVO: Stile per indicatore "altri campi disponibili" */
.meta-field-more-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    border: 1px dashed rgba(102, 126, 234, 0.3);
    color: #667eea;
    font-size: 0.85rem;
    font-weight: 500;
    font-style: italic;
    margin-top: 0.25rem;
}

.meta-field-more-info i {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* MODIFICATO: Sezione meta nel modale accredito - margini ottimizzati per evitare scroll */
.accredit-meta-section {
    margin-top: 0.75rem; /* Ridotto margin */
    margin-bottom: 0.75rem; /* Ridotto margin */
}

.accredit-meta-section .meta-section-title {
    margin: 0 0 0.75rem 0; /* Ridotto margin */
    font-size: 1rem; /* Ridotto font-size */
    padding-bottom: 0.5rem; /* Ridotto padding */
}

/* MANTENUTO: Card per meta field con icona (per altri usi) */
.meta-field-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.meta-field-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.meta-field-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667eea;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.meta-field-content {
    flex: 1;
    min-width: 0;
}

.meta-field-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: block;
}

.meta-field-value {
    font-size: 0.95rem;
    color: #2d3748;
    font-weight: 500;
    word-break: break-word;
    line-height: 1.5;
}

.no-meta-fields {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.no-meta-fields i {
    font-size: 2rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.no-meta-fields p {
    margin: 0;
    font-size: 1rem;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

/* MODIFICATO: Footer per GuestMetaModal */
/* PRECEDENTE: Nessuna modifica specifica */
/* MOTIVO: Assicurare che il footer non si sovrapponga al contenuto */
#guest-meta-modal .modal-footer {
    flex-shrink: 0;
    margin-top: auto;
}

/* NUOVO: Stili per pulsante chiudi grande e centrato */
.btn-close-large {
    background: #667eea;
    border: 1px solid #667eea;
    color: white;
    padding: 16px 32px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    min-width: 140px;
    justify-content: center;
    cursor: pointer;
}

.btn-close-large:hover {
    background: #5a6fd8;
    border-color: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-close-large:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2);
}

/* NUOVO: Stili per status "sistema pronto" */
.status-ready {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 12px 16px;
    border-radius: 6px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-ready::before {
    content: "✓";
    font-weight: bold;
    color: #28a745;
}

/* NUOVO: Stili per status "warning" (offline) */
.status-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    padding: 12px 16px;
    border-radius: 6px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-warning::before {
    content: "⚠";
    font-weight: bold;
    color: #f39c12;
}

/* Responsive */
@media (max-width: 768px) {
    /* Vecchio: max-height 90vh; riduciamo su tablet per evitare tagli con browser bars */
    .modal-content {
        margin: 10px;
        max-height: 88vh;
        max-width: 100%; /* Evita overflow orizzontale su mobile */
    }

    #guest-meta-modal .modal-content {
        max-width: 100%; /* Su mobile usa tutta la larghezza disponibile */
    }

    .modal-header {
        padding: 16px 20px;
    }

    /* Vecchio: padding 20px; ulteriore riduzione per recuperare spazio verticale */
    .modal-body {
        padding: 16px;
    }

    .guest-basic-info {
        flex-direction: column;
        text-align: center;
    }

    /* MIGLIORATO: Responsive per guest-basic-info-meta */
    .guest-basic-info-meta {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 1.25rem;
    }

    .guest-details-large h4 {
        font-size: 1.25rem;
    }

    .meta-fields-grid {
        grid-template-columns: 1fr;
    }

    /* MIGLIORATO: Responsive per meta fields compatti */
    .meta-fields-compact {
        max-height: 300px;
        padding: 0.75rem;
    }

    .meta-field-compact {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .meta-field-label-compact {
        min-width: auto;
        width: 100%;
    }

    .meta-field-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .meta-field-icon {
        margin: 0 auto;
    }

    .modal-footer {
        padding: 16px 20px;
    }

    .btn-close-large {
        padding: 18px 36px;
        font-size: 1.2rem;
        min-width: 160px;
    }
}

/* Animazioni - JavaScript vanilla gestisce la visibilità */

/* Scrollbar personalizzata */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* MODIFICATO: Rimuove scrollbar dal modal-body per GuestMetaModal */
/* PRECEDENTE: Scrollbar visibile su tutto il modal-body */
/* MOTIVO: Scrollbar solo nella sezione Operations History */
#guest-meta-modal .modal-body::-webkit-scrollbar {
    display: none;
}

/* ===== STILI PER MODALE ACCREDITO MIGLIORATO ===== */

/* Sezione informazioni ospite */
.accredit-guest-info {
    /* gap precedente: 1rem, padding precedente: 1rem */
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.1);
    margin-bottom: 0.85rem;
}

/* Nuovo layout a due colonne per info ospite (riduce altezza verticale) */
.accredit-guest-info.two-columns {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    align-items: center;
    gap: 0.75rem;
}

.accredit-guest-info.two-columns .agi-left {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.65rem;
    align-items: center;
}

.accredit-guest-info.two-columns .agi-right {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    justify-content: center;
}

.guest-qr-code.inline {
    margin: 0;
}

.previous-accesses-badge.compact {
    margin-top: 0;
}

.guest-details-large {
    flex: 1;
    min-width: 0;
}

.guest-details-large h4 {
    /* font-size precedente: 1.25rem */
    margin: 0 0 0.4rem 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #2d3748;
    line-height: 1.18;
}

.guest-email {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
    color: #4a5568;
    font-size: 0.95rem;
}

.guest-email i {
    color: #667eea;
    font-size: 0.9rem;
}

.guest-qr-code {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
    color: #4a5568;
    font-size: 0.95rem;
}

.guest-qr-code i {
    color: #667eea;
    font-size: 0.9rem;
}

.qr-code-value {
    font-family: 'Courier New', monospace;
    background: rgba(102, 126, 234, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.previous-accesses-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.4rem;
    padding: 0.35rem 0.7rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 18px;
    font-size: 0.78rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.previous-accesses-badge i {
    font-size: 0.9rem;
}

/* Warning migliorato */
.accredit-warning {
    /* gap precedente: 0.75rem; padding precedente: 0.75rem 1rem */
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.65rem 0.9rem;
    border-radius: 10px;
    margin-bottom: 0.75rem;
    border-left: 4px solid;
}

.accredit-warning.warning-new {
    background: rgba(255, 193, 7, 0.1);
    border-left-color: #ffc107;
    color: #856404;
}

.accredit-warning.warning-already-accredited {
    background: rgba(255, 87, 34, 0.1);
    border-left-color: #ff5722;
    color: #bf360c;
}

.warning-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.25rem;
}

.accredit-warning.warning-new .warning-icon {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

.accredit-warning.warning-already-accredited .warning-icon {
    background: rgba(255, 87, 34, 0.2);
    color: #ff5722;
}

.warning-content {
    flex: 1;
    min-width: 0;
}

.warning-content p {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.35;
}

/* Sezione note migliorata */
.accredit-notes-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 0.85rem; /* Ridotto ancora per comprimere */
    border: 1px solid #e9ecef;
}

.notes-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.45rem;
    font-weight: 600;
    color: #2d3748;
    font-size: 0.84rem;
}

.notes-label i {
    color: #667eea;
}

.notes-textarea {
    width: 100%;
    padding: 0.55rem; /* Ridotto padding */
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.84rem;
    resize: vertical;
    transition: all 0.2s ease;
    background: white;
    min-height: 56px; /* leggermente più bassa */
    max-height: 72px; /* ridotto per limitare altezza complessiva */
}

.notes-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.notes-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.35rem;
}

.notes-help {
    color: #6c757d;
    font-size: 0.82rem;
}

.notes-counter {
    color: #6c757d;
    font-size: 0.82rem;
    font-weight: 500;
}

.notes-textarea:focus + .notes-footer .notes-counter {
    color: #667eea;
}

/* Footer modale migliorato */
.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0; /* Non si restringe */
}

/* MODIFICATO: Footer per modale accredito - padding ridotto */
#accredit-confirm-modal .modal-footer {
    padding: 1rem 1.25rem; /* Ridotto padding */
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn i {
    font-size: 0.9rem;
}

/* Responsive per modale accredito */
@media (max-width: 768px) {
    .accredit-guest-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 1.25rem;
    }

    /* Stack verticale su mobile per due colonne */
    .accredit-guest-info.two-columns {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    .accredit-guest-info.two-columns .agi-left {
        grid-template-columns: auto 1fr;
        gap: 0.5rem;
        width: 100%;
        justify-content: center;
    }

    .accredit-guest-info.two-columns .agi-right {
        width: 100%;
        align-items: center;
    }

    .guest-details-large h4 {
        font-size: 1.25rem;
    }

    .accredit-warning {
        flex-direction: column;
        text-align: center;
    }

    .modal-footer {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    .btn {
        width: 100%;
    }
}

/* AGGIUNTO: Stili per sezione storico operazioni */
/* PRECEDENTE: Nessuno stile per storico */
/* MOTIVO: Stilizzare la sezione storico completo delle operazioni */

.guest-history-section .meta-section-title {
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.guest-history-section .meta-section-title i {
    color: #6571ff;
}

.history-loading {
    text-align: center;
    padding: 1.5rem;
    color: #666;
    font-size: 0.9rem;
}

.history-loading i {
    margin-right: 0.5rem;
    color: #6571ff;
}

.history-empty {
    text-align: center;
    padding: 1.5rem;
    color: #999;
    font-size: 0.9rem;
    font-style: italic;
}

.history-empty i {
    margin-right: 0.5rem;
    color: #999;
}

.operations-history-list {
    height: 100%;
    max-height: 450px;
    min-height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-right: 0.75rem;
    margin-right: -0.25rem;
    /* AGGIUNTO: Altezza fissa per garantire lo scroll */
    flex: 1;
    min-height: 0;
    /* AGGIUNTO: Assicura che lo scrollbar sia sempre visibile quando necessario */
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

.operations-history-list::-webkit-scrollbar {
    width: 8px;
}

.operations-history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.operations-history-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
    border: 1px solid #f1f1f1;
}

.operations-history-list::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.operation-history-item {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #6571ff;
    transition: all 0.2s ease;
}

.operation-history-item:hover {
    background: #e9ecef;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.operation-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.operation-details {
    flex: 1;
    min-width: 0;
}

.operation-header-compact {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.operation-type {
    font-weight: 600;
    font-size: 0.85rem;
    color: #333;
    white-space: nowrap;
}

.operation-checkpoint-compact {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #666;
    white-space: nowrap;
}

.operation-checkpoint-compact i {
    font-size: 0.7rem;
    color: #999;
}

.operation-operator-compact {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #666;
    white-space: nowrap;
}

.operation-operator-compact i {
    font-size: 0.7rem;
    color: #999;
}

.operation-time-compact {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #666;
    white-space: nowrap;
}

.operation-time-compact i {
    font-size: 0.7rem;
    color: #999;
}

.operation-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 0.65rem;
    margin-left: auto;
    flex-shrink: 0;
}

.operation-status.status-success {
    background: #d4edda;
    color: #155724;
}

.operation-status.status-error {
    background: #f8d7da;
    color: #721c24;
}

.operation-status i {
    font-size: 0.65rem;
}

/* Responsive per storico */
@media (max-width: 768px) {
    #guest-meta-modal .modal-content {
        max-height: 90vh;
    }

    .guest-meta-sections-wrapper {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .guest-history-section {
        border-left: none;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        padding-left: 0;
        padding-top: 1.5rem;
        margin-top: 1.5rem;
    }

    .operations-history-list {
        height: 200px;
        max-height: 200px;
        min-height: 150px;
    }

    .operation-history-item {
        padding: 0.5rem;
    }

    .operation-header-compact {
        gap: 0.5rem;
        font-size: 0.8rem;
    }

    .operation-type {
        font-size: 0.8rem;
    }

    /* PRECEDENTE: riduceva font-size solo per checkpoint e ora */
    /*
    .operation-checkpoint-compact,
    .operation-time-compact {
        font-size: 0.7rem;
    }
    */

    /* NUOVO: include anche l'operatore per mantenere coerenza visiva su mobile */
    .operation-checkpoint-compact,
    .operation-operator-compact,
    .operation-time-compact {
        font-size: 0.7rem;
    }
}
