    /* Regole specifiche per mobile sono definite nelle media query sottostanti */
/* ==========================================================================
   STILI RESPONSIVE PER IL PLUGIN BIGLIETTERIA
   Organizzati in ordine decrescente di dimensione viewport
   ========================================================================== */

/* Stili per dispositivi grandi (da 1200px in su)
   ========================================================================== */
@media screen and (min-width: 1200px) {
    /* Eventuali aggiustamenti specifici per dispositivi grandi che sovrascrivono gli stili di base */
}

/* Regole desktop spostate in bg-unified.css */

/* Stili responsive (fino a 1200px)
   ========================================================================== */
@media screen and (max-width: 1200px) {
    .bg-report-wrapper {
        grid-template-columns: 1fr;
    }
    .bg-report-main,
    .bg-report-sidebar {
        grid-column: 1;
        width: 100%;
    }
    .bg-report-sidebar {
        position: static;
        margin-top: 30px;
    }
}

/* Stili per desktop e dispositivi grandi (da 1025px a 1199px)
   ========================================================================== */
@media screen and (min-width: 1025px) and (max-width: 1199px) {
    /* Eventuali aggiustamenti specifici per desktop che sovrascrivono gli stili di base */
    .width-container-pro {
        width: 100% !important;
    }
}

/* Stili responsive (da 769px a 1024px)
   ========================================================================== */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    /* Aggiustamenti specifici per tablet di dimensioni maggiori */
    .width-container-pro {
        width: 100% !important;
    }
}

/* Stili per tablet (fino a 782px)
   ========================================================================== */
@media screen and (max-width: 782px) {
    .width-container-pro {
        width: 100% !important;
    }
    .wrap {
        clear: both;
        margin: 0;
    }
    .bg-summary-grid {
        grid-template-columns: 1fr;
    }
    .bg-summary-item {
        padding: 8px;
    }
}

/* Stili per tablet e schermi medi (fino a 768px)
   ========================================================================== */
@media screen and (max-width: 768px) {
    /* --- Inizio blocco per tablet --- */
    .postbox-container.full-width {
        width: 100%;
        padding: 10px 0;
        box-sizing: border-box;
    }
    .postbox-container.full-width .postbox {
        margin: 30px auto 30px;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 4px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        padding: 0px;
    }
    .tablenav.bottom {
    margin: 6px;
    min-height: 0px;
    }

    .postbox-container.full-width h2 {
        margin: 0;
        padding: 12px 15px;
        border-bottom: 1px solid #ddd;
        background: #f8f8f8;
        font-size: 14px;
        line-height: 1.4;
    }
    .report-by-event,
    .report-by-date,
    .email-purchasers {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    .postbox-container.full-width .form-field {
        margin-bottom: 15px;
    }
    .postbox-container.full-width label {
        display: block;
        margin-bottom: 5px;
        font-weight: 500;
    }
    .postbox-container.full-width select,
    .postbox-container.full-width input[type="text"],
    .postbox-container.full-width input[type="date"],
    .postbox-container.full-width input[type="email"] {
        width: 100%;
        padding: 8px;
        border: 1px solid #ddd;
        border-radius: 4px;
        background-color: #fff;
        box-shadow: inset 0 1px 2px rgba(0,0,0,0.07);
        margin-bottom: 10px;
    }
    .postbox-container.full-width .checkbox-container {
        display: flex;
        align-items: center;
        margin-bottom: 15px;
        padding: 10px;
        background: #f8f8f8;
        border: 1px solid #ddd;
        border-radius: 4px;
    }
    .postbox-container.full-width .checkbox-container input[type="checkbox"] {
        margin-right: 10px;
    }
    .postbox-container.full-width .button-primary,
    .postbox-container.full-width .button {
        width: 100%;
        text-align: center;
        padding: 10px;
        height: auto;
        margin-bottom: 10px;
    }
    .postbox-container.full-width .button-primary {
        background: #2271b1;
        border-color: #2271b1;
        color: #fff;
    }
    .bg-tabs {
        width: 100%;
        max-width: 100%;
        margin: 0;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 4px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        overflow: hidden;
    }
    .bg-tabs .tabs {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0;
        padding: 10px 10px 5px;
        background: #f8f8f8;
        border-bottom: 1px solid #ddd;
    }
    .bg-tabs .wptab {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px;
        background: #fff;
        position: relative;
    }
    .bg-sales-report {
        width: 100%;
        min-width: 600px;
        border-collapse: collapse;
        margin: 0;
    }
    .bg-sales-report th,
    .bg-sales-report td {
        white-space: nowrap;
        padding: 8px;
        border: 1px solid #ddd;
        text-align: left;
        font-size: 14px;
    }
    .bg-sales-report thead th {
        background: #f5f5f5;
        font-weight: bold;
        position: sticky;
        top: 0;
        z-index: 1;
    }
    .bg-sales-report tbody tr:nth-child(even) {
        background: #fafafa;
    }
    .wptab::before {
        content: "← Scorri →";
        display: block;
        text-align: center;
        padding: 5px;
        background: #f0f0f0;
        margin: -10px -10px 10px -10px;
        font-size: 14px;
        color: #666;
        border-bottom: 1px solid #ddd;
    }
    .bg-totals-container {
        margin: 15px 0;
        padding: 15px;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 4px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    .jcd-narrow,
    .jcd-wide {
        width: 100%;
    }
    .tablenav .tablenav-pages .button, 
    .tablenav .tablenav-pages .tablenav-pages-navspan {
        min-width: 44px;
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    .tablenav-pages .pagination-links {
        font-size: 16px;
        display: block ruby;
    }

    /* --- Aggiunta dal blocco "Responsive (max-width: 768px)" --- */
    .bg-thank-you-page {
        margin: 20px;
        padding: 20px;
    }
    .bg-thank-you-header {
        margin: -20px -20px 30px -20px;
        padding: 30px 20px;
    }
    .bg-thank-you-header h1 {
        font-size: 28px;
    }
    .bg-order-grid {
        grid-template-columns: 1fr;
    }
    .bg-detail-box {
        padding: 15px;
    }

    /* Popup di errore adattato per tablet */
    .bg-error-popup {
        width: 95%;
        max-width: none;
        top: 45%; /* Posiziona il popup leggermente più in alto per lasciare spazio al carrello */
    }
    
    /* Padding ridotto per il contenuto */
    .bg-error-popup-content {
        padding: 15px;
    }
    
    /* Timer leggermente più piccolo su tablet */
    .bg-countdown-timer .time {
        font-size: 36px;
    }
}

/* Media query combinata (tablet minori e alcuni smartphone fino a 760px)
   ========================================================================== */
@media only screen and (max-width: 760px),
       (min-device-width: 768px) and (max-device-width: 1024px) {
    /* Regole per tabelle responsive */
    .bg_cart table,
    .bg_cart thead,
    .bg_cart tbody,
    .bg_cart th,
    .bg_cart td,
    .bg_cart tr,
    .bg_cart caption {
        display: block;
    }
    
    .bg_cart thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .bg_cart tr {
        border: 1px solid #444;
        margin-bottom: 15px;
        border-radius: 5px;
        background-color: #373737;
        overflow: hidden;
    }
    
    .bg_cart td{
        border: none;
        border-bottom: 1px solid #444;
        position: relative;
        padding: 40px 10px 10px !important;
        text-align: center;
    }

    .bg_cart th {
        border: none;
        border-bottom: 1px solid #444;
        position: relative;
        padding: 40px 10px 10px !important;
        text-align: center;
    }
    
    .bg_cart td:before,
    .bg_cart th:before {
        position: absolute;
        top: 10px;
        left: 0;
        width: 100%;
        text-align: center;
        font-weight: bold;
        font-size: 13px;
        color: #aaa;
    }
    
    .bg_cart th:nth-of-type(1):before {
        content: "Evento";
    }
    
    .bg_cart td:nth-of-type(1):before {
        content: "Biglietti";
    }
    
    .bg_cart td:nth-of-type(2):before {
        content: "Aggiorna";
    }
    
    /* INIZIO NUOVE REGOLE TABLET RESPONSIVE */
    /* Miglioramento layout carrello per tablet */
    .bg_cart, .bg-after-cart, .bg-payment-form {
        width: 95%;
        margin: auto;
    }
    
    /* Miglioramento controlli quantità */
    .bg_cart .bg-controls {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 15px;
        padding: 10px 0;
    }
    
    .bg_cart .bg-controls button {
        width: 40px;
        height: 40px;
        font-size: 20px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: #515151;
        color: white;
        border: none;
        cursor: pointer;
    }
    
    .bg_cart td input[type="number"],
    .bg_cart td .input-text {
        width: 60px;
        height: 40px;
        font-size: 18px;
        text-align: center;
        border-radius: 4px;
        border: 1px solid #444;
        background-color: #2c2c2c;
        color: white;
    }
    
    /* Miglioramento elementi form per tablet */
    .info_extra {
        display: flex;
        flex-wrap: wrap;
        gap: 15px;
        margin-top: 20px;
    }
    
    .box_posti_vicino, 
    .box_additional, 
    .box_promo {
        padding: 15px;
        margin-bottom: 15px;
        box-sizing: border-box;
        width: 100%;
        border-radius: 4px;
    }
    
    /* Layout più fluido per i bottoni */
    .bg-cart-buttons {
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 15px;
        margin-top: 20px;
    }
    
    .bg-cart-buttons a.button,
    .bg-cart-buttons .bg-clear-cart-button,
    .bg-cart-buttons .bg-goto-cart-button {
        flex: 1 1 45%;
        min-width: 45%;
        max-width: none;
        margin: 5px;
        padding: 15px;
        border-radius: 4px;
        height: auto;
        font-size: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Miglioramento dei selettori di gateway per tablet */
    .gateway-selector ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
        padding: 0;
        margin: 15px 0;
        list-style: none;
    }
    
    .gateway-selector li {
        flex: 1 1 45%;
        min-width: 45%;
        margin: 5px;
    }
    
    .gateway-selector a {
        display: block;
        width: 100%;
        box-sizing: border-box;
        text-align: center;
        padding: 15px;
        font-size: 16px;
        border-radius: 4px;
    }
    
    /* Miglioramento campi input per tablet */
    #bg_promo {
        width: 100%;
        max-width: 300px;
        margin-bottom: 10px;
    }
    
    /* Miglioramento area promo */
    .box_promo #bg_promo_verifier {
        padding: 10px 15px;
        margin-top: 10px;
        width: auto;
        font-size: 14px;
        background-color: #515151;
        border: none;
        color: white;
        border-radius: 4px;
        cursor: pointer;
    }
    
    /* Stile per l'evento nel carrello */
    .bg_cart th[scope="row"] {
        padding: 40px 10px 15px !important;
        font-size: 18px;
        text-align: center;
        background-color: #222;
        color: white;
        border-bottom: 1px solid #444;
    }
    
    .bg_cart th .bg-datetime {
        display: block;
        margin-top: 5px;
        font-size: 14px;
        color: #aaa;
    }
    /* FINE NUOVE REGOLE TABLET RESPONSIVE */
}

/* Stili per smartphone standard (fino a 480px)
   ========================================================================== */
@media screen and (max-width: 480px) {
    /* Box della tabella: scroll orizzontale su mobile, verticale rimane della pagina */
    .biglietteria .table-container {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        touch-action: auto; /* consente swipe orizzontale e verticale */
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box;
        position: relative;
    }
    /* La tabella dentro al box è più larga per attivare lo scroll orizzontale */
    .biglietteria .table-container > table {
        width: auto !important;
        max-width: none !important;
        min-width: 1024px !important;
        display: inline-table !important;
        table-layout: auto !important;
        border-collapse: separate;
        border-spacing: 0;
    }
    .biglietteria .table-container > table th,
    .biglietteria .table-container > table td {
        white-space: nowrap !important;
        text-overflow: ellipsis;
        overflow: hidden;
    }
    /* Su smartphone: il box scorre SOLO in orizzontale; lo scroll verticale è della pagina */
    .biglietteria .table-container {
        overflow-y: visible !important;
        max-height: none !important;
        overscroll-behavior: auto !important;
    }
    /* Contenitori WP Admin: riduci spazi laterali per usare meglio lo schermo */
    #wpbody-content,
    .wrap {
        padding-left: 0px !important;
        padding-right: 0px !important;
        margin: 0 !important;
    }

    /* Sezione report: elimina margini superflui e usa tutta la larghezza */
    .bg-report-wrapper,
    .bg-report-main,
    .bg-report-sidebar,
    .bg-report-selector {
        margin: 0 !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    /* Tabella report: scorrimento orizzontale, niente testo verticale */
    .bg-sales-report {
        margin: 0 !important;
        width: auto !important;            /* consenti alla tabella di allargarsi */
        max-width: none !important;        /* non limitarla al box: il box scrolla */
        min-width: 900px !important;       /* larghezza minima più ampia per attivare lo scroll */
        border-collapse: separate;          /* evita che il bordo si "sporga" */
        border-spacing: 0;                  /* allinea bordi al contenitore */
        table-layout: auto !important;      /* lascia calcolare le larghezze naturali */
        display: inline-table !important;   /* larghezza in base al contenuto: abilita lo scroll del box */
    }
    /* Il contenitore (box) scorre orizzontalmente e contiene la tabella */
    .bg-report-wrapper,
    .bg-report-main,
    .bg-tabs .wptab,
    .report-by-event,
    .report-by-date {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        position: relative;
        overflow-x: auto !important;        /* SCORRIMENTO ORIZZONTALE QUI */
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin; /* Firefox */
        touch-action: auto; /* lascia libero scorrimento orizzontale e verticale */
        overscroll-behavior-x: contain; /* Evita cattura da container esterni */
        box-sizing: border-box;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    .bg-sales-report th,
    .bg-sales-report td {
        padding: 8px !important;
        white-space: nowrap !important;     /* mantieni le intestazioni orizzontali */
        overflow: hidden;                    /* previeni overflow visivo */
        text-overflow: ellipsis;             /* tronca se lo spazio è poco */
        font-size: 14px;
        background: #fff;                    /* necessario per sticky columns */
        box-sizing: border-box;              /* evita variazioni di larghezza con i bordi */
    }

    /* Colonne fisse a sinistra (ID e Acquirente) solo su mobile */
    .biglietteria .table-container { position: relative; }
    /* Prima colonna: ID */
    .bg-sales-report th.bg-id,
    .bg-sales-report td.bg-id,
    .bg-sales-report .bg-id { /* fallback */
        position: sticky !important;
        left: 0 !important;
        z-index: 5; /* sopra le altre celle */
        width: 52px !important;             /* 5-6 caratteri */
        min-width: 52px !important;
        max-width: 52px !important;
        border-right: 1px solid #e5e5e5;
        background: #fff !important;
    }
    /* Seconda colonna: Acquirente */
    .bg-sales-report th.bg-purchaser,
    .bg-sales-report td.bg-purchaser,
    .bg-sales-report .bg-purchaser { /* fallback */
        position: sticky !important;
        left: 52px !important; /* pari alla larghezza effettiva della colonna ID */
        z-index: 4;
        width: 210px !important;            /* blocca la larghezza per evitare "ritrazioni" */
        min-width: 200px !important;
        max-width: 240px !important;
        border-right: 1px solid #e5e5e5;
        background: #fff !important;
    }
    /* Piccola ombra per separare le colonne fisse dallo scroll orizzontale */
    .bg-sales-report th.bg-purchaser,
    .bg-sales-report td.bg-purchaser {
        box-shadow: 3px 0 4px -2px rgba(0,0,0,0.08);
    }

    /* 4a colonna: Prezzo totale più ampia su mobile */
    .bg-sales-report th.bg-price,
    .bg-sales-report td.bg-price {
        width: 90px !important;
        min-width: 90px !important;
        max-width: 90px !important;
    }

    /* Wrapper metabox WP del plugin: lo scroll orizzontale avviene qui (come nel report per ticket) */
    .biglietteria .postbox .inside,
    .biglietteria .postbox .inside .inside {
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding-left: 0 !important;
        padding-right: 0 !important;
        touch-action: auto; /* abilita swipe orizzontale e verticale dentro .inside */
    }
    .biglietteria .postbox {
        overflow: visible !important; /* evita clipping del contenuto scrollabile */
    }
    /* Tabelle WordPress standard dentro i box del plugin: larghe per attivare lo scroll */
    .biglietteria .postbox .inside table,
    .biglietteria .postbox .inside table.widefat {
        width: auto !important;
        max-width: none !important;
        min-width: 1024px !important; /* forza overflow nel box */
        display: inline-table !important;
        table-layout: auto !important;
        border-collapse: separate;
        border-spacing: 0;
    }

    /* Forza i metabox in una sola colonna su smartphone */
    .biglietteria .metabox-holder .postbox-container {
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
        display: block !important;
    }
    .biglietteria .metabox-holder.columns-2 .postbox-container,
    .biglietteria .metabox-holder.columns-3 .postbox-container {
        width: 100% !important;
        float: none !important;
        clear: both !important;
    }

    /* Su mobile disattiva sticky header per evitare blocchi allo scroll orizzontale in alcuni browser */
    .bg-sales-report thead th {
        position: static !important;
    }

    /* Riduci padding dei box sopra la tabella, se presenti */
    .report-by-date,
    .report-by-customer,
    .report-by-event {
        padding: 10px !important;
        margin: 6px 0 !important;
        width: 100% !important;            /* forza i blocchi a piena larghezza */
        max-width: 100% !important;
        flex: none !important;             /* rimuove comportamento a colonne affiancate */
    }
    .bg-report-selector {
        display: block !important;         /* una sola colonna */
        width: 100% !important;
        max-width: 100% !important;
        gap: 10px !important;
        grid-template-columns: 1fr !important; /* se qualche tema usa grid, forza 1 colonna */
        flex-direction: column !important;      /* se è flex, impila verticalmente */
    }

    /* La pagina non scrolla in orizzontale: lo fa solo il box del report */
    body, html, #wpcontent, #wpbody, #wpbody-content {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        overflow-y: auto !important; /* assicura scroll verticale pagina */
    }
    
    /* Ottimizzazione form per smartphone */
    .bg_cart_form {
        padding: 15px !important;
        border-radius: 4px !important;
        margin: 15px 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .bg_cart_form input, 
    .bg_cart_form textarea {
        width: 100% !important;
        padding: 12px !important;
        margin: 8px 0 15px !important;
        border-radius: 4px !important;
        font-size: 16px !important; /* Previene lo zoom su iOS */
    }
    
    .bg_cart_form label {
        display: block !important;
        margin-bottom: 4px !important;
        font-size: 14px !important;
    }
    
    /* Miglioramento layout carrello per smartphone */
    .bg_cart {
        margin: 10px 0 !important;
        padding: 0 !important;
        border-radius: 4px !important;
        overflow: hidden !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Miglioramento bottoni per smartphone */
    .bg-cart-buttons {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .bg-cart-buttons a.button,
    .bg-cart-buttons .bg-clear-cart-button,
    .bg-cart-buttons .bg-goto-cart-button {
        width: 100% !important;
        margin: 5px 0 !important;
        padding: 15px !important;
        text-align: center !important;
        font-size: 16px !important;
    }
    
    /* Migliore visualizzazione totali */
    .bg-tickets-container {
        margin-left: 0px;
        border-top: 1px solid #444444;
        padding-top: 10px;
        width: 100%;
    }

    .bg-update-buttons button {
        width: 60px;
        height: 60px;
        margin-left: 10px;
        font-size: 22px;
    }
    .bg_cart_form input[type="submit"] {
        height: 80px;
    }
    /* Layout sconto e totale per smartphone - uno sotto l'altro */
    .bg-discount-total-row {
        display: block !important;
        flex-direction: column !important;
        gap: 15px !important;
    }

    .bg-discount-field {
        width: 100% !important;
    }

    .bg-discount-field label {
        display: block !important;
        margin-bottom: 8px !important;
        font-weight: bold !important;
    }

    .bg-discount-field input {
        width: 100% !important;
        max-width: 200px !important;
        text-transform: uppercase !important;
    }

    .bg-cart-total {
        display: block !important;
        width: 100% !important;
        margin-top: 10px !important;
        text-align: center !important;
    }
    
    
    /* Miglioramento controlli quantità per smartphone */
    .bg_cart .bg-controls {
        margin: 10px 0 !important;
        gap: 10px !important;
    }
    
    .bg_cart .bg-controls button {
        width: 40px !important;
        height: 40px !important;
        font-size: 20px !important;
        border-radius: 50% !important;
    }
    
    .bg_cart td input[type="number"],
    .bg_cart td .input-text {
        width: 55px !important;
        height: 40px !important;
        font-size: 16px !important;
    }

    /* Miglioramento elementi form per smartphone */
    .info_extra {
        flex-direction: column !important;
        gap: 15px !important;
        margin-top: 20px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    #bg_posti_vicino, #bg_additional {
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .box_posti_vicino, .box_additional {
        max-width: 100% !important;
        margin-bottom: 0px !important;
        padding: 15px 15px 0px;
    }

    /* Stile per l'evento nel carrello */
    .bg_cart th[scope="row"] {
        font-size: 16px !important;
    }
    
    .bg_cart th .bg-datetime {
        display: block !important;
        margin-top: 5px !important;
        font-size: 14px !important;
        color: #aaa !important;
        width: 100% !important;
        box-sizing: border-box !important;
        word-wrap: break-word !important;
    }
    
    /* Assicura che il testo del carrello vuoto sia visibile */
    .empty-cart {
        color: white !important;
        background-color: #303030 !important;
        padding: 15px !important;
        margin: 15px 0 !important;
        text-align: center !important;
        border-radius: 4px !important;
        font-size: 16px !important;
    }
    
    /* Migliora visibilità per contenitori e testi generali */
    #bg-content-container {
        background-color: #202020 !important;
        color: white !important;
        padding: 15px !important;
        border-radius: 4px !important;
        margin: 15px 0 !important;
    }
    
    /* Forzare colore testo per elementi generici */
    .bg_cart_handling, .bg_ticket_handling {
        color: white !important;
        font-size: 12px;
      }

    
    /* Popup di errore adattato per smartphone */
    .bg-error-popup {
        width: 94%;
        top: 40%;
        border-radius: 4px; /* Bordi meno arrotondati per smartphone */
    }
    
    /* Header con padding ridotto */
    .bg-error-popup-header {
        padding: 10px;
    }
    
    /* Titolo più piccolo */
    .bg-error-popup-title {
        font-size: 1.1em;
    }
    
    /* Contenuto con padding ridotto */
    .bg-error-popup-content {
        padding: 5px;
    }
    
    /* Gateway di pagamento ottimizzati per mobile */
    .gateway-selector ul {
        display: flex !important;
        flex-direction: row !important;
        justify-content: center !important;
        gap: 5px !important;
        padding: 10px 5px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .gateway-selector li {
        flex: 1 !important;
        width: auto !important;
    }
    
    .gateway-selector li a {
        font-size: 14px !important;
        padding: 0 5px !important;
        width: 100% !important;
        display: block !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        box-sizing: border-box !important;
        line-height: 36px !important;
    }
    
    .payment-method-title {
        font-size: 16px !important;
        margin-bottom: 10px !important;
        text-align: center !important;
    }
}

/* Stili per smartphone molto piccoli (fino a 320px)
   ========================================================================== */
@media screen and (max-width: 320px) {
    /* Popup di errore ulteriormente ottimizzato per schermi molto piccoli */
    .bg-error-popup {
        width: 96%;
        top: 35%;
    }
    
    /* Titolo ancora più compatto */
    .bg-error-popup-title {
        font-size: 1em;
    }
    
    /* Testo più piccolo con interlinea ridotta */
    .bg-error-popup-content p {
        font-size: 0.9em;
        line-height: 1.4;
    }
    
    /* Timer ancora più compatto */
    .bg-countdown-timer {
        padding: 6px;
        max-width: 180px;
    }
    
    /* Tempo visualizzato più piccolo ma ancora leggibile */
    .bg-countdown-timer .time {
        font-size: 28px;
        padding: 5px;
    }
}

/* Stili di stampa (media print)
   ========================================================================== */
@media print {
    .bg-report-selector,
    .bg-email-purchasers,
    .print-button,
    .bg-back,
    button {
        display: none;
    }
    .bg-sales-report td,
    .bg-sales-report th {
        border: 1px solid #f0f0f0;
    }
    .bg-sales-report tr:nth-of-type(odd) {
        background: #fefefe;
    }
}

/* Migliorie responsive lato backend (tablet e smartphone) */
@media screen and (max-width: 960px) {
    /* Tabelle report: il table non gestisce lo scroll, lo fa il contenitore */
    .bg-sales-report {
        display: table;
        width: auto;
    }
    .report-by-event table,
    .report-by-date table {
        display: table;
        width: auto;
    }
    /* Media fluidi nelle schermate del plugin in admin */
    .biglietteria img,
    .biglietteria iframe {
        max-width: 100%;
        height: auto;
    }
}

@media screen and (max-width: 782px) {
    /* Controlli nelle tabelle admin più usabili al tocco */
    .widefat .bg-controls {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }
    .widefat .bg-controls .button {
        min-width: 44px;
        min-height: 44px;
    }
    /* Spaziatura più compatta nei riquadri dei report */
    .bg-report-selector {
        gap: 12px;
    }
    .report-by-date,
    .report-by-customer,
    .report-by-event {
        min-width: unset;
        padding: 15px;
    }
    /* Tabelle dei report: celle leggermente più compatte su smartphone */
    .bg-sales-report th,
    .bg-sales-report td {
        padding: 8px;
    }

     .auto-fold #wpcontent {
    padding-left: 0px;
  }
  .postbox .inside h2, .wrap [class$="icon32"] + h2, .wrap h1, .wrap > h2:first-child {
   margin: 0;
  padding: 9px 9px 4px;
  }
}
