/* Modal System - Rainify Premium */

:root {
    --modal-backdrop: rgba(0, 0, 0, 0.7);
    --modal-bg: rgba(15, 23, 42, 0.95);
    --modal-border: rgba(255, 255, 255, 0.1);
}

#modal-root {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    pointer-events: none;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-backdrop);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: all;
}

.modal-backdrop.modal-show {
    opacity: 1;
}

.modal-backdrop.modal-exit {
    opacity: 0;
}

.modal-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 20px;
}

.modal {
    background: var(--modal-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--modal-border);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 450px;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Outfit', sans-serif;
    overflow: hidden;
}

.modal-show .modal {
    transform: scale(1);
    opacity: 1;
}

.modal-exit .modal {
    transform: scale(0.9);
    opacity: 0;
}

/* Header */
.modal-header {
    padding: 30px 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    text-align: center;
}

.modal-icon {
    font-size: 3rem;
    color: #3b82f6;
}

.modal.confirm .modal-icon {
    color: #f59e0b;
}

.modal.alert .modal-icon {
    color: #3b82f6;
}

.modal.prompt .modal-icon {
    color: #22c55e;
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 0;
    line-height: 1.3;
}

/* Body */
.modal-body {
    padding: 0 30px 25px;
}

.modal-message {
    color: #cbd5e1;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 20px 0;
    text-align: center;
}

.modal-input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--modal-border);
    border-radius: 12px;
    color: #f8fafc;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    outline: none;
    transition: all 0.3s;
}

.modal-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal-input::placeholder {
    color: #64748b;
}

/* Footer */
.modal-footer {
    padding: 20px 30px 30px;
    display: flex;
    gap: 12px;
}

.modal-btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.modal-btn:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.modal-btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
    border: 1px solid var(--modal-border);
}

.modal-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    transform: translateY(-1px);
}

.modal-btn-cancel:active {
    transform: translateY(0);
}

.modal-btn-confirm {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.modal-btn-confirm:hover {
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.modal-btn-confirm:active {
    transform: translateY(0);
}

/* Botón solo (alert) */
.modal-btn-solo {
    flex: none;
    width: 100%;
}

/* Variantes de botón confirm según tipo */
.modal.confirm .modal-btn-confirm {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.modal.confirm .modal-btn-confirm:hover {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.modal.prompt .modal-btn-confirm {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.modal.prompt .modal-btn-confirm:hover {
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

/* Responsive */
@media (max-width: 640px) {
    .modal {
        max-width: 100%;
        border-radius: 16px;
        margin: 0 10px;
    }

    .modal-header {
        padding: 25px 20px 15px;
    }

    .modal-icon {
        font-size: 2.5rem;
    }

    .modal-title {
        font-size: 1.2rem;
    }

    .modal-body {
        padding: 0 20px 20px;
    }

    .modal-message {
        font-size: 0.9rem;
    }

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

    .modal-btn {
        width: 100%;
    }
}

/* Animación de entrada personalizada */
@keyframes modalSlideIn {
    from {
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-show .modal {
    animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}


/* ==========================================
   LIGHT MODE ADJUSTMENTS - MODAL
   Copiar AL FINAL de modal.css
   ========================================== */

/* Backdrop más oscuro en light mode */
body.light-mode .modal-backdrop {
    background: rgba(0, 0, 0, 0.6);
}

/* Modal container con fondo claro */
body.light-mode .modal {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.25),
        0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Header */
body.light-mode .modal-header {
    /* Ya funciona con variables, no necesita cambios específicos */
}

/* Iconos del modal */
body.light-mode .modal-icon {
    /* Los colores ya están bien definidos y se ven en light mode */
}

/* Título */
body.light-mode .modal-title {
    color: var(--text-primary); /* Ya se adapta automáticamente */
}

/* Mensaje */
body.light-mode .modal-message {
    color: var(--text-secondary); /* Ya se adapta */
}

/* Input del modal (prompt) */
body.light-mode .modal-input {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: var(--text-primary);
}

body.light-mode .modal-input:focus {
    background: rgba(0, 0, 0, 0.06);
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

body.light-mode .modal-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Botón cancelar */
body.light-mode .modal-btn-cancel {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(0, 0, 0, 0.15);
}

body.light-mode .modal-btn-cancel:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.2);
}

/* Botón confirmar - Los gradientes se mantienen iguales en ambos modos */
body.light-mode .modal-btn-confirm {
    /* Los gradientes de colores funcionan bien en ambos modos */
    box-shadow: 
        0 4px 15px rgba(59, 130, 246, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.1);
}

body.light-mode .modal-btn-confirm:hover {
    box-shadow: 
        0 6px 20px rgba(59, 130, 246, 0.4),
        0 3px 6px rgba(0, 0, 0, 0.15);
}

/* Focus states más visibles */
body.light-mode .modal-btn:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}