/**
 * Tema dark globale per modali Bootstrap (tutte le pagine ERP).
 * Opt-out: aggiungere class="modal-theme-light" sul .modal.
 */

.modal:not(.modal-theme-light) .modal-content {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
    border: 1px solid #444 !important;
    border-radius: 12px;
}

.modal:not(.modal-theme-light) .modal-header,
.modal:not(.modal-theme-light) .modal-footer {
    border-color: #333 !important;
    background-color: transparent;
}

.modal:not(.modal-theme-light) .modal-title,
.modal:not(.modal-theme-light) .modal-body,
.modal:not(.modal-theme-light) .modal-body label,
.modal:not(.modal-theme-light) .modal-body .form-label {
    color: #f5f5f5 !important;
}

.modal:not(.modal-theme-light) .text-muted,
.modal:not(.modal-theme-light) .form-text,
.modal:not(.modal-theme-light) small.text-muted {
    color: #aaa !important;
}

.modal:not(.modal-theme-light) .btn-close {
    filter: invert(1) grayscale(1);
    opacity: 0.9;
}

.modal:not(.modal-theme-light) .btn-close:hover {
    opacity: 1;
}

.modal:not(.modal-theme-light) .modal-footer .btn-secondary,
.modal:not(.modal-theme-light) .modal-footer .btn-outline-secondary,
.modal:not(.modal-theme-light) .modal-body .btn-secondary[data-bs-dismiss="modal"] {
    background-color: #444 !important;
    border-color: #555 !important;
    color: #fff !important;
}

.modal:not(.modal-theme-light) .modal-footer .btn-secondary:hover,
.modal:not(.modal-theme-light) .modal-footer .btn-outline-secondary:hover {
    background-color: #555 !important;
    color: #fff !important;
}

.modal:not(.modal-theme-light) .form-control,
.modal:not(.modal-theme-light) .form-select,
.modal:not(.modal-theme-light) textarea.form-control {
    background-color: #2a2a2a !important;
    border-color: #444 !important;
    color: #fff !important;
}

.modal:not(.modal-theme-light) .form-control::placeholder {
    color: #888 !important;
}

.modal:not(.modal-theme-light) .form-control:focus,
.modal:not(.modal-theme-light) .form-select:focus {
    background-color: #2a2a2a !important;
    color: #fff !important;
    border-color: #f59e0b;
    box-shadow: 0 0 0 0.2rem rgba(245, 158, 11, 0.2);
}

.modal:not(.modal-theme-light) .form-select option {
    background: #2a2a2a;
    color: #fff;
}

.modal:not(.modal-theme-light) .form-check-label {
    color: #e0e0e0 !important;
}

.modal:not(.modal-theme-light) .list-group-item {
    background-color: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}

.modal:not(.modal-theme-light) .list-group-item.active {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

.modal:not(.modal-theme-light) .table {
    color: #e8e8e8;
    --bs-table-bg: transparent;
    --bs-table-color: #e8e8e8;
    --bs-table-striped-color: #e8e8e8;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.06);
    --bs-table-hover-color: #ffffff;
    --bs-table-hover-bg: rgba(255, 255, 255, 0.1);
    --bs-table-border-color: #444;
}

.modal:not(.modal-theme-light) .table thead th {
    color: #ccc;
    border-color: #444;
}

.modal:not(.modal-theme-light) .table td,
.modal:not(.modal-theme-light) .table th {
    border-color: #333;
}

.modal:not(.modal-theme-light) .alert-info {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
    color: #bfdbfe;
}

.modal:not(.modal-theme-light) .alert-warning {
    background: rgba(245, 158, 11, 0.12);
    border-color: #f59e0b;
    color: #fde68a;
}

.modal:not(.modal-theme-light) .alert-danger {
    background: rgba(239, 68, 68, 0.12);
    border-color: #ef4444;
    color: #fecaca;
}

.modal:not(.modal-theme-light) .alert-success {
    background: rgba(16, 185, 129, 0.12);
    border-color: #10b981;
    color: #a7f3d0;
}

.modal:not(.modal-theme-light) hr {
    border-color: #333;
    opacity: 1;
}

.modal:not(.modal-theme-light) a:not(.btn) {
    color: #93c5fd;
}

.modal:not(.modal-theme-light) .spinner-border {
    color: #f59e0b;
}
