/* ========================================
   MODALS.CSS - Modali e Overlay
   ======================================== */

/* MODAL BASE */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999 !important;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none !important;
}

.modal-container {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

.modal-header {
    background: linear-gradient(135deg, #71a894 0%, #5a8c79 100%);
    color: white;
    padding: 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-close {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* OVERLAY BASE */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-overlay.hidden {
    display: none;
}

/* MODAL ALERT CUSTOM */
.modal-alert-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 30px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    text-align: center;
    animation: modalSlideIn 0.3s ease;
}

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

.modal-alert-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.modal-alert-message {
    font-size: 1.1em;
    color: var(--text-primary);
    margin-bottom: 25px;
    line-height: 1.6;
}

.modal-alert-actions {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
}

.btn-modal-alert {
    padding: 12px 40px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary-color);
    color: var(--text-white);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-modal-alert:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-modal-alert:active {
    transform: scale(0.95);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .modal-alert-content {
        max-width: 90%;
        padding: 25px;
    }
    
    .modal-alert-icon {
        font-size: 2.5em;
    }
    
    .modal-alert-message {
        font-size: 1em;
    }
}

/* ============================================
   FIX MODAL IMPASTI - Sfondo Tabella
   Aggiungi questo al tuo modals.css o crea un file separato
   ============================================ */

/* Container tabella - Sfondo bianco solido */
#modal-carico-impasti .modal-body {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

/* Tabella impasti - Assicura sfondo bianco */
#modal-carico-impasti table {
    background: #ffffff;
    width: 100%;
    border-collapse: collapse;
}

/* Header tabella - Sfondo verde */
#modal-carico-impasti thead {
    background: var(--color-primary, #71a894);
    color: white;
}

#modal-carico-impasti thead th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

/* Righe tabella - Sfondo bianco alternato */
#modal-carico-impasti tbody tr {
    background: #ffffff;
    border-bottom: 1px solid #ecdbbc;
}

#modal-carico-impasti tbody tr:nth-child(even) {
    background: #f9f9f9;
}

#modal-carico-impasti tbody tr:hover {
    background: #f0f0f0;
}

#modal-carico-impasti tbody td {
    padding: 12px;
}

/* Sezione Note - Sfondo bianco */
#modal-carico-impasti .note-section {
    background: #ffffff;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
}

/* Bottoni - Sfondo bianco */
#modal-carico-impasti .modal-footer {
    background: #ffffff;
    padding: 15px;
    border-radius: 0 0 8px 8px;
}

/* Alert Info giallo - Assicura sfondo */
#modal-carico-impasti .alert-info {
    background: #fff3cd;
    border: 1px solid #ffc107;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
}

/* Badge stato - Assicura leggibilità */
#modal-carico-impasti .badge-stato {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

#modal-carico-impasti .badge-stato.ok {
    background: #d4edda;
    color: #155724;
}

#modal-carico-impasti .badge-stato.basso {
    background: #fff3cd;
    color: #856404;
}

#modal-carico-impasti .badge-stato.esaurito {
    background: #f8d7da;
    color: #721c24;
}

/* Input quantità - Sfondo bianco */
#modal-carico-impasti .input-qty-carico {
    background: #ffffff;
    border: 2px solid #71a894;
    padding: 8px;
    border-radius: 6px;
    width: 80px;
    text-align: center;
    font-size: 1em;
    font-weight: 600;
}

#modal-carico-impasti .input-qty-carico:focus {
    outline: none;
    border-color: #5a8c79;
    box-shadow: 0 0 0 3px rgba(113, 168, 148, 0.1);
}

/* Overlay modal - Semi-trasparente */
#modal-carico-impasti {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

/* Contenuto principale modal - Sfondo bianco */
#modal-carico-impasti .modal-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    margin: auto;
}

/* Header modal - Verde con sfondo solido */
#modal-carico-impasti .modal-header {
    background: linear-gradient(135deg, #71a894 0%, #5a8c79 100%);
    color: white;
    padding: 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#modal-carico-impasti .modal-title {
    font-size: 1.5em;
    font-weight: 700;
    margin: 0;
}

/* Bottone chiudi (X) */
#modal-carico-impasti .btn-close {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#modal-carico-impasti .btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Bottoni Modal Base */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
}

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

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

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
