/* ============================================
   GRUPPO ORSO - Delivery Admin Styles
   ============================================ */

/* ============================================
   DELIVERY VIEW - Layout principale
   ============================================ */

/* Usa lo stesso sistema delle altre view (classe active) */
#delivery-view {
    display: none;
    flex-direction: column;
    height: 100%;
    min-height: 0; /* Importante per flex scroll */
}

#delivery-view.active {
    display: flex;
}

.delivery-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.delivery-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border-light);
}

.delivery-header h2 {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.delivery-tabs {
    flex-shrink: 0;
    display: flex;
    gap: 4px;
    padding: 12px 24px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border-light);
    overflow-x: auto;
}

.delivery-tab {
    padding: 10px 20px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.delivery-tab:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text);
}

.delivery-tab.active {
    background: var(--color-primary);
    color: white;
}

#delivery-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 24px;
    background: var(--color-bg);
    min-height: 0; /* Importante per flex scroll */
}

/* Empty State */
.delivery-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--color-text-muted);
}

.delivery-empty-state svg {
    opacity: 0.4;
    margin-bottom: 16px;
}

/* ============================================
   ORDINI - Kanban Board
   ============================================ */

.delivery-ordini-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

/* Date Navigator */
.delivery-date-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.delivery-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.delivery-header-row:first-child {
    margin-bottom: 12px;
}

/* Search Box */
.delivery-search-box {
    flex: 1;
    min-width: 200px;
    max-width: 320px;
    position: relative;
    display: flex;
    align-items: center;
}

.delivery-search-box svg {
    position: absolute;
    left: 12px;
    color: var(--color-text-muted);
    pointer-events: none;
}

.delivery-search-box input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 14px;
}

.delivery-search-box input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.delivery-search-box .search-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
}

.delivery-search-box .search-clear:hover {
    color: var(--color-text);
}

/* Sound Toggle */
.sound-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    font-size: 18px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sound-toggle:hover {
    background: var(--color-bg-secondary);
}

.sound-toggle.active {
    background: #E8F5E9;
    border-color: #4CAF50;
}

/* Badge nota nella card */
.ordine-card-badges {
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge-nota {
    font-size: 14px;
    opacity: 0.8;
}

/* Note interne nel modal */
.ordine-detail-note-interne {
    margin-top: 20px;
    padding: 16px;
    background: #FFF8E1;
    border-radius: var(--radius-md);
    border-left: 4px solid #FFB300;
}

.ordine-detail-note-interne h4 {
    margin-bottom: 12px;
    font-size: 14px;
}

.ordine-detail-note-interne h4 small {
    font-weight: normal;
    color: var(--color-text-muted);
    font-size: 12px;
}

.ordine-detail-note-interne textarea {
    width: 100%;
    resize: vertical;
    min-height: 60px;
}

/* Note cliente nel modal */
.ordine-detail-note {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--color-primary);
}

.ordine-detail-note h4 {
    margin-bottom: 8px;
    font-size: 14px;
}

.delivery-date-nav .btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.delivery-date-nav .btn-icon:hover {
    background: var(--color-bg-secondary);
    border-color: var(--color-primary);
}

.delivery-date-picker {
    position: relative;
    display: flex;
    align-items: center;
}

.delivery-date-picker input[type="date"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 1;
}

.delivery-date-label {
    padding: 8px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    min-width: 140px;
    text-align: center;
    text-transform: capitalize;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.delivery-date-picker:hover .delivery-date-label {
    border-color: var(--color-primary);
    background: var(--color-primary-bg);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Empty state per nessun ordine */
.delivery-no-ordini {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
    text-align: center;
}

.delivery-no-ordini svg {
    opacity: 0.3;
    margin-bottom: 16px;
}

.delivery-no-ordini p {
    font-size: 15px;
}

.delivery-filters {
    display: flex;
    gap: 12px;
}

.delivery-filters .form-select {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--color-surface);
}

.delivery-stats-mini {
    display: flex;
    gap: 8px;
}

.stat-pill {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.stat-pill.nuovo {
    background: #FEF3E2;
    color: #F39C12;
}

.stat-pill.prep {
    background: #F5EEF8;
    color: #9B59B6;
}

.stat-pill.pronto {
    background: #E8F8F5;
    color: #1ABC9C;
}

.delivery-ordini-grid {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 20px;
    min-height: calc(100vh - 300px);
}

.delivery-column {
    flex: 1;
    min-width: 280px;
    max-width: 320px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.delivery-column-header {
    padding: 16px;
    border-bottom: 3px solid;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.delivery-column-header h3 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.delivery-column-header .count {
    background: var(--color-bg-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.delivery-column-content {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.no-ordini {
    color: var(--color-text-muted);
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

/* ============================================
   ORDINE CARD
   ============================================ */

.ordine-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    border: 1px solid var(--color-border-light);
    transition: all var(--transition-fast);
}

.ordine-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.ordine-card.nuovo {
    border-left: 4px solid #F39C12;
}

.ordine-card.confermato {
    border-left: 4px solid #3498DB;
}

.ordine-card.in_preparazione {
    border-left: 4px solid #9B59B6;
}

.ordine-card.pronto {
    border-left: 4px solid #1ABC9C;
}

.ordine-card.in_consegna {
    border-left: 4px solid #E67E22;
}

.ordine-card.consegnato {
    border-left: 4px solid #27AE60;
    opacity: 0.7;
}

.ordine-card.annullato {
    border-left: 4px solid #E74C3C;
    opacity: 0.5;
}

.ordine-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.ordine-numero {
    font-weight: 600;
    font-size: 14px;
}

.tempo-attesa {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: #FEF3E2;
    color: #F39C12;
}

.tempo-attesa.urgente {
    background: #FDEDEC;
    color: #E74C3C;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.ordine-card-cliente {
    margin-bottom: 8px;
}

.ordine-card-cliente strong {
    display: block;
    font-size: 14px;
}

.ordine-telefono {
    font-size: 12px;
    color: var(--color-primary);
    text-decoration: none;
}

.ordine-card-indirizzo {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
    padding: 8px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
}

.ordine-card-indirizzo small {
    color: var(--color-text-muted);
}

.ordine-card-prodotti {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 10px;
    line-height: 1.4;
}

.ordine-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--color-border-light);
}

.ordine-totale {
    font-weight: 600;
    font-size: 15px;
    color: var(--color-primary);
}

.ordine-orario {
    font-size: 12px;
    color: var(--color-text-muted);
}

.ordine-rider {
    margin-top: 8px;
    padding: 6px 10px;
    background: #E8F8F5;
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: #1ABC9C;
}

.ordine-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--color-border-light);
}

.btn-action {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-action.btn-confirm {
    background: #27AE60;
    color: white;
}

.btn-action.btn-confirm:hover {
    background: #219A52;
}

.btn-action.btn-reject {
    background: #E74C3C;
    color: white;
    flex: 0;
    padding: 8px 14px;
}

.btn-action.btn-prep {
    background: #9B59B6;
    color: white;
}

.btn-action.btn-ready {
    background: #1ABC9C;
    color: white;
}

.btn-action.btn-deliver {
    background: #E67E22;
    color: white;
}

.btn-action.btn-complete {
    background: #27AE60;
    color: white;
}

/* ============================================
   ORDINE DETAIL MODAL
   ============================================ */

.ordine-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.ordine-detail-section h4 {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ordine-detail-section p {
    margin: 4px 0;
    font-size: 14px;
}

.ordine-detail-prodotti {
    margin-bottom: 20px;
}

.ordine-prodotti-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.ordine-prodotti-table th,
.ordine-prodotti-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
}

.ordine-prodotti-table th {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 12px;
    text-transform: uppercase;
}

.ordine-prodotti-table small {
    color: var(--color-text-secondary);
}

.ordine-prodotti-table .note {
    color: var(--color-warning);
    font-size: 12px;
}

.ordine-prodotti-table tfoot tr {
    background: var(--color-bg);
}

.ordine-prodotti-table tfoot tr.totale {
    background: var(--color-primary-bg);
    font-size: 16px;
}

.ordine-detail-note {
    padding: 12px;
    background: #FEF9E7;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.ordine-detail-stato {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.stato-badge {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
}

.stato-badge.nuovo { background: #FEF3E2; color: #F39C12; }
.stato-badge.confermato { background: #EBF5FB; color: #3498DB; }
.stato-badge.in_preparazione { background: #F5EEF8; color: #9B59B6; }
.stato-badge.pronto { background: #E8F8F5; color: #1ABC9C; }
.stato-badge.in_consegna { background: #FEF5E7; color: #E67E22; }
.stato-badge.consegnato { background: #E8F8F0; color: #27AE60; }
.stato-badge.annullato { background: #FDEDEC; color: #E74C3C; }

/* ============================================
   MENU MANAGEMENT
   ============================================ */

.delivery-menu-header,
.delivery-riders-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.delivery-menu-header h3,
.delivery-riders-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.delivery-menu-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.menu-empty,
.riders-empty {
    text-align: center;
    padding: 40px;
    color: var(--color-text-muted);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
}

.menu-categoria {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.menu-categoria.disattiva {
    opacity: 0.6;
}

.categoria-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--color-primary-bg);
    border-bottom: 1px solid var(--color-border-light);
}

.categoria-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.categoria-nome {
    font-weight: 600;
    font-size: 16px;
}

.categoria-count {
    font-size: 12px;
    color: var(--color-text-muted);
}

.categoria-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    transition: background var(--transition-fast);
}

.btn-icon:hover {
    background: var(--color-bg-secondary);
}

.categoria-prodotti {
    padding: 12px;
}

.menu-prodotto {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}

.menu-prodotto:last-child {
    margin-bottom: 0;
}

.menu-prodotto.disattivo {
    opacity: 0.5;
}

.prodotto-info {
    flex: 1;
}

.prodotto-nome {
    font-weight: 500;
}

.prodotto-prezzo {
    margin-left: 12px;
    font-weight: 600;
    color: var(--color-primary);
}

.prodotto-desc {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

.prodotto-actions {
    display: flex;
    gap: 4px;
}

.prodotto-actions .btn-icon.active {
    color: #27AE60;
}

.no-prodotti {
    color: var(--color-text-muted);
    font-size: 13px;
    text-align: center;
    padding: 16px;
}

.badge-soldout {
    display: inline-block;
    padding: 2px 8px;
    background: #FDEDEC;
    color: #E74C3C;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

.badge-disattivo {
    display: inline-block;
    padding: 2px 8px;
    background: var(--color-bg-secondary);
    color: var(--color-text-muted);
    border-radius: var(--radius-sm);
    font-size: 11px;
    margin-left: 8px;
}

/* ============================================
   RIDERS
   ============================================ */

.riders-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.rider-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.rider-card.disattivo {
    opacity: 0.5;
}

.rider-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
}

.rider-info {
    flex: 1;
}

.rider-nome {
    display: block;
    font-weight: 600;
    font-size: 15px;
}

.rider-telefono {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.rider-actions {
    display: flex;
    gap: 4px;
}

/* ============================================
   CONFIG
   ============================================ */

.delivery-config-container {
    max-width: 700px;
}

.delivery-config-container h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.config-subtitle {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

/* Badge locale nell'header */
.locale-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--color-primary-bg);
    color: var(--color-primary);
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
}

.locale-badge::before {
    content: '📍';
}

.config-section {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.config-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border-light);
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.toggle-switch .slider {
    width: 50px;
    height: 26px;
    background: #ccc;
    border-radius: 26px;
    position: relative;
    transition: background var(--transition-base);
}

.toggle-switch .slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform var(--transition-base);
}

.toggle-switch input:checked + .slider {
    background: #27AE60;
}

.toggle-switch input:checked + .slider::before {
    transform: translateX(24px);
}

.toggle-switch .label {
    font-weight: 500;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.orari-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.orario-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.orario-row .giorno-check {
    min-width: 120px;
}

.orario-row input[type="time"] {
    width: 100px;
}

.orario-row input:disabled {
    opacity: 0.4;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.form-row .form-group.flex-1 {
    flex: 1;
}

.form-row .form-group.flex-2 {
    flex: 2;
}

.config-actions {
    margin-top: 24px;
    text-align: center;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
}

/* ============================================
   STATS
   ============================================ */

.delivery-stats-container h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 24px;
}

.delivery-stats-loading,
.delivery-stats-error {
    text-align: center;
    padding: 60px;
    color: var(--color-text-muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.stat-card.horizontal {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    padding: 16px 20px;
}

.stat-card.horizontal .stat-icon {
    font-size: 24px;
}

.stat-card.horizontal .stat-value {
    font-size: 22px;
}

.stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.stats-section {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
}

.stats-section h4 {
    margin-bottom: 16px;
    font-size: 15px;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
}

.stats-table th,
.stats-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
}

.stats-table th {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 600;
}

/* ============================================
   SIDEBAR BADGE
   ============================================ */

.nav-item .delivery-badge {
    background: #E74C3C;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
    min-width: 20px;
    text-align: center;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .delivery-ordini-grid {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .delivery-column {
        min-width: 260px;
    }
}

@media (max-width: 768px) {
    .delivery-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .delivery-tabs {
        overflow-x: auto;
        padding-bottom: 8px;
    }
    
    .delivery-ordini-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .delivery-header-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .delivery-header-row:first-child {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .delivery-date-nav {
        justify-content: center;
        flex: 1;
    }
    
    .delivery-search-box {
        max-width: none;
        order: 3;
        width: 100%;
    }
    
    .sound-toggle {
        order: 2;
    }
    
    .delivery-filters {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .delivery-filters .form-select:last-child {
        grid-column: span 2;
    }
    
    .delivery-stats-mini {
        justify-content: center;
        width: 100%;
    }
    
    .orario-row {
        flex-wrap: wrap;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .stats-row {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   ORDINI PROGRAMMATI (Domani/Futuro)
   ============================================ */

/* Badge "DOMANI" - arancione ben visibile */
.ordine-domani {
    display: inline-block;
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
    vertical-align: middle;
    animation: pulse-domani 2s ease-in-out infinite;
    box-shadow: 0 2px 4px rgba(255, 152, 0, 0.3);
}

@keyframes pulse-domani {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.85; 
        transform: scale(1.02);
    }
}

/* Badge data futura - blu */
.ordine-futuro {
    display: inline-block;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    margin-right: 4px;
    vertical-align: middle;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

/* Evidenzia card con ordini per domani */
.ordine-card:has(.ordine-domani) {
    border-left: 4px solid #ff9800 !important;
    background: linear-gradient(90deg, rgba(255, 152, 0, 0.05) 0%, var(--color-surface) 20%);
}

/* Evidenzia card con ordini futuri */
.ordine-card:has(.ordine-futuro) {
    border-left: 4px solid #3498db !important;
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.05) 0%, var(--color-surface) 20%);
}

/* Fallback per browser che non supportano :has() */
.ordine-card.ordine-programmato-domani {
    border-left: 4px solid #ff9800 !important;
    background: linear-gradient(90deg, rgba(255, 152, 0, 0.05) 0%, var(--color-surface) 20%);
}

.ordine-card.ordine-programmato-futuro {
    border-left: 4px solid #3498db !important;
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.05) 0%, var(--color-surface) 20%);
}

/* Migliora visibilità orario nella card */
.ordine-card .ordine-orario {
    font-weight: 600;
}

/* Dark mode support */
[data-theme="dark"] .ordine-domani {
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.4);
}

[data-theme="dark"] .ordine-futuro {
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.4);
}

[data-theme="dark"] .ordine-card:has(.ordine-domani),
[data-theme="dark"] .ordine-card.ordine-programmato-domani {
    background: linear-gradient(90deg, rgba(255, 152, 0, 0.1) 0%, var(--color-surface) 25%);
}

[data-theme="dark"] .ordine-card:has(.ordine-futuro),
[data-theme="dark"] .ordine-card.ordine-programmato-futuro {
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.1) 0%, var(--color-surface) 25%);
}

/* ============================================
   MENU CAMBIO STATO RAPIDO
   ============================================ */

.quick-state-menu {
    position: relative;
    display: inline-block;
}

.btn-action.btn-more {
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    padding: 4px 8px;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
    min-width: 32px;
}

.btn-action.btn-more:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.quick-state-dropdown {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 4px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
}

.quick-state-dropdown.open {
    display: block;
    animation: dropdownFadeIn 0.15s ease-out;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.quick-menu-header {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border-light);
}

.quick-state-option {
    display: block;
    width: 100%;
    padding: 10px 12px;
    text-align: left;
    background: none;
    border: none;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.quick-state-option:hover {
    background: var(--color-bg-secondary);
}

.quick-state-option.danger {
    color: #E74C3C;
}

.quick-state-option.danger:hover {
    background: #FDEDEC;
}

.quick-menu-divider {
    height: 1px;
    background: var(--color-border-light);
    margin: 4px 0;
}

/* Dark mode */
[data-theme="dark"] .quick-state-dropdown {
    background: var(--color-surface);
    border-color: var(--color-border);
}

[data-theme="dark"] .quick-state-option.danger:hover {
    background: rgba(231, 76, 60, 0.15);
}

/* Chiudi menu quando si clicca fuori */
.ordine-card-actions {
    position: relative;
}
