/* ========================================
   MODAL STORICO CLIENTE (Separato)
======================================== */

#modal-storico-cliente {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;  /* Sopra il modal clienti */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;  /* Margine dai bordi */
}

#modal-storico-cliente.hidden {
    display: none;
}

.modal-storico-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 900px;  /* Larghezza massima */
    height: 80vh;
    max-height: 700px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 0 auto;  /* Centra orizzontalmente */
}

/* HEADER */
.modal-storico-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #71A894 0%, #5a8a77 100%);
    color: white;
    flex-shrink: 0;
}

.modal-storico-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

/* INFO CLIENTE */
.storico-info-section {
    padding: 24px;
    background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
    border-bottom: 2px solid #e0e0e0;
    flex-shrink: 0;
}

.cliente-info-header h3 {
    margin: 0 0 12px 0;
    font-size: 24px;
    color: #71A894;
    font-weight: 600;
}

.cliente-info-header p {
    margin: 6px 0;
    font-size: 15px;
    color: #666;
}

.cliente-stats-row {
    display: flex;
    gap: 24px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid #e0e0e0;
}

.cliente-stats-row span {
    font-size: 15px;
    color: #555;
    font-weight: 600;
    background: white;
    padding: 8px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* LISTA ORDINI */
.storico-lista-section {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    background: #f8f9fa;
}

.ordine-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.ordine-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.ordine-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.ordine-id {
    font-weight: 600;
    font-size: 16px;
    color: #71A894;
}

.ordine-data {
    font-size: 13px;
    color: #999;
}

.ordine-body {
    margin-bottom: 12px;
}

.ordine-tipo {
    font-size: 14px;
    font-weight: 500;
    color: #555;
    margin: 6px 0;
}

.ordine-prodotti {
    font-size: 13px;
    color: #666;
    margin: 6px 0;
    line-height: 1.5;
}

.ordine-note {
    font-size: 13px;
    color: #999;
    font-style: italic;
    margin: 6px 0;
}

.ordine-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

.ordine-stato {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.ordine-stato.in_preparazione,
.ordine-stato.in_attesa {
    background: #FFF4E6;
    color: #F4C063;
}

.ordine-stato.pronto {
    background: #E8F5E9;
    color: #4CAF50;
}

.ordine-stato.consegnato,
.ordine-stato.completato {
    background: #E3F2FD;
    color: #2196F3;
}

.ordine-stato.annullato {
    background: #FFEBEE;
    color: #EE6B6B;
}

.ordine-totale {
    font-size: 16px;
    font-weight: 600;
    color: #71A894;
}

.ordine-pagamento {
    font-size: 13px;
    color: #666;
}

/* FOOTER */
.modal-storico-footer {
    padding: 16px 24px;
    background: white;
    border-top: 2px solid #e0e0e0;
    flex-shrink: 0;
}

.btn-back-full {
    width: 100%;
    padding: 12px;
    background: #71A894;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-back-full:hover {
    background: #5a8a77;
    transform: translateY(-1px);
}

/* EMPTY STATE */
.empty-state-storico {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state-storico p {
    font-size: 16px;
    margin: 0;
}

/* LOADING */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #999;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #71A894;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .modal-storico-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }
}
