/* Base del Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    z-index: 9999;
}

.modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
}

.modal-container {
    position: relative;
    background: white;
    width: 90%;
    max-width: 600px;
    margin: 4vh auto;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease;
}
.modal-container.scrolled {
    box-shadow: 0 10px 30px rgba(0,0,0,0.2), 0 2px 15px rgba(0,0,0,0.1) inset;
}
/* Animaciones */
@keyframes modalEnter {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Partes del Modal */
.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.modal-title {
    margin: 0;
    font-size: 1.4rem;
    color: #2c3e50;
    padding-right: 2.5rem;
}
@media (max-width: 480px) {
    .modal-container {
        margin: 1rem auto;
        max-height: 85vh;
    }
    
    .modal-close {
        top: 0.5rem;
        right: 0.5rem;
    }
}
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #3498db #f8f9fa;
}
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.modal-body::-webkit-scrollbar-thumb {
    background-color: #3498db;
    border-radius: 3px;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #eee;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* Spinner de carga */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        margin: 1rem auto;
    }
}

.close-warning {
    text-align: center;
    padding: 2rem;
}

.close-warning h3 {
    color: #dc3545;
    margin-bottom: 1rem;
}

.warning-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.btn-cancel, .btn-confirm {
    padding: 0.75rem 2rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel {
    background: #6c757d;
    color: white;
    border: none;
}

.btn-confirm {
    background: #dc3545;
    color: white;
    border: none;
}

.btn-cancel:hover {
    background: #5a6268;
}

.btn-confirm:hover {
    background: #c82333;
}
/* Estilos específicos para formularios modales */
.modal-form {
    display: grid;
    gap: 1.5rem;
}

.form-group {
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.form-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-checkbox input[type="checkbox"] {
    width: 1.1em;
    height: 1.1em;
}

.form-hint {
    font-size: 0.85em;
    color: #6c757d;
    margin-top: 0.25rem;
}

.form-actions {
    margin-top: 1rem;
    text-align: right;
}

.form-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.form-disclaimer {
    font-size: 0.85em;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-link {
    color: #3498db;
    text-decoration: underline;
}

/* Validación */
.form-input:invalid:not(:focus):not(:placeholder-shown) {
    border-color: #dc3545;
    background: #fff5f5;
}

.form-input:invalid:not(:focus):not(:placeholder-shown) + .form-hint {
    color: #dc3545;
}

/* Loader del botón */
.btn-loader {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
    opacity: 0;
    vertical-align: middle;
    margin-right: 0.5em;
}

.is-loading .btn-loader {
    opacity: 1;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
/* Añadir al modal.css */

.modal-warning-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 12px;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
     z-index: 1000;
}

.warning-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    text-align: center;
}
.modal-warning-overlay {
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}
.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 20;
}

.modal-close::before,
.modal-close::after {
    content: '';
    position: absolute;
    width: 1.25rem;
    height: 2px;
    background: #6c757d;
    border-radius: 2px;
}

.modal-close::before { transform: rotate(45deg); }
.modal-close::after { transform: rotate(-45deg); }

.modal-close:hover {
    background: #f8f9fa;
}

.modal-close:hover::before,
.modal-close:hover::after {
    background: #dc3545;
}
@keyframes fadeIn {
    to { opacity: 1; }
}