/**
 * Sistema de Modales
 * 
 * Estilos completos para el sistema de modales reutilizable
 */

/* ============================================
   CONTENEDOR PRINCIPAL
   ============================================ */

.modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
}

/* ============================================
   OVERLAY
   ============================================ */

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

/* ============================================
   DIALOG
   ============================================ */

.modal-dialog {
    position: relative;
    z-index: 10;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

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

/* Tamaños */
.modal-small {
    max-width: 400px;
    width: 90%;
}

.modal-medium {
    max-width: 600px;
    width: 90%;
}

.modal-large {
    max-width: 900px;
    width: 90%;
}

/* ============================================
   CONTENIDO
   ============================================ */

.modal-content {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    position: relative;
}

/* ============================================
   BOTÓN CERRAR
   ============================================ */

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 44px;
    color: #999;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close:hover {
    background-color: #f0f0f0;
    color: #333;
    transform: rotate(90deg);
}

/* ============================================
   HEADER
   ============================================ */

.modal-header {
    padding: 25px 30px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-icon {
    font-size: 44px;
    line-height: 1;
}

.modal-title {
    margin: 0;
    font-size: 44px;
    font-weight: 600;
    color: #333;

    font-family: 'Alfa Slab One', cursive;}

/* ============================================
   BODY
   ============================================ */

.modal-body {
    padding: 30px;
    color: #666;
    line-height: 1.6;
}

.modal-body p {
    margin: 0 0 15px 0;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

/* ============================================
   FOOTER
   ============================================ */

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-footer .button {
    min-width: 120px;
}

/* ============================================
   LOADING STATE
   ============================================ */

.modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    min-height: 200px;
}

.modal-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.modal-loading p {
    margin: 0;
    color: #666;
    font-size: 19px;
}

/* ============================================
   TIPOS DE MODAL
   ============================================ */

/* Info */
.modal-info .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-info .modal-title {
    color: white;

    font-family: 'Alfa Slab One', cursive;}

/* Success */
.modal-success .modal-header {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-success .modal-title {
    color: white;

    font-family: 'Alfa Slab One', cursive;}

/* Warning */
.modal-warning .modal-header {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-warning .modal-title {
    color: white;

    font-family: 'Alfa Slab One', cursive;}

/* Danger */
.modal-danger .modal-header {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-danger .modal-title {
    color: white;

    font-family: 'Alfa Slab One', cursive;}

.modal-danger .modal-icon {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* Error */
.modal-error .modal-header {
    background: linear-gradient(135deg, #ff6b6b 0%, #c92a2a 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-error .modal-title {
    color: white;

    font-family: 'Alfa Slab One', cursive;}

/* Confirm */
.modal-confirm .modal-header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-confirm .modal-title {
    color: white;

    font-family: 'Alfa Slab One', cursive;}

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

@media (max-width: 768px) {
    .modal-dialog {
        max-height: 95vh;
    }

    .modal-small,
    .modal-medium,
    .modal-large {
        width: 95%;
        max-width: none;
    }

    .modal-header {
        padding: 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-footer {
        padding: 15px 20px;
        flex-direction: column;
    }

    .modal-footer .button {
        width: 100%;
    }

    .modal-title {
        font-size: 44px;
    
    font-family: 'Alfa Slab One', cursive;}

    .modal-icon {
        font-size: 44px;
    }
}

/* ============================================
   ANIMACIONES ADICIONALES
   ============================================ */

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalScaleIn {
    from {
        transform: scale(0.7);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Efecto de shake para errores */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.modal-error.shake .modal-dialog {
    animation: shake 0.5s;
}

/* ============================================
   UTILIDADES
   ============================================ */

.modal-text-center {
    text-align: center;
}

.modal-text-left {
    text-align: left;
}

.modal-text-right {
    text-align: right;
}