/* ============================================
   SISTEMA DE MODALES Y TOASTS - REUTILIZABLE
   ============================================ */

:root {
    --ms-color-success: #25D366;
    --ms-color-error: #ff4757;
    --ms-color-warning: #ffa502;
    --ms-color-info: #3498db;
    --ms-color-bg: #25282c;
    --ms-color-card: #1D1E22;
    --ms-color-text: #ffffff;
    --ms-color-text-muted: #888888;
    --ms-color-border: rgba(255, 255, 255, 0.05);
}

/* Contenedor principal del sistema */
.modal-system {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10000;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: var(--ms-color-card);
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--ms-color-border);
    min-width: 300px;
    max-width: 400px;
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.hiding {
    transform: translateX(120%);
    opacity: 0;
}

.toast-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
}

.toast.success .toast-icon { background: var(--ms-color-success); }
.toast.error .toast-icon { background: var(--ms-color-error); }
.toast.warning .toast-icon { background: var(--ms-color-warning); }
.toast.info .toast-icon { background: var(--ms-color-info); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ms-color-text);
    margin-bottom: 4px;
}

.toast-message {
    font-size: 0.85rem;
    color: var(--ms-color-text-muted);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--ms-color-text-muted);
    cursor: pointer;
    padding: 5px;
    font-size: 1rem;
    transition: color 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--ms-color-text);
}

/* Toasts para móvil */
@media (max-width: 480px) {
    .toast-container {
        bottom: 100px;
        right: 15px;
        left: 15px;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
        width: 100%;
    }
}

/* ============================================
   MODAL CONFIRMACIÓN GENÉRICO
   ============================================ */
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.confirm-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.confirm-modal-content {
    background: var(--ms-color-bg);
    border-radius: 25px;
    padding: 40px;
    width: 90%;
    max-width: 400px;
    max-height: 95vh; /* Estandarizado: nunca supera el 95% del viewport */
    overflow: visible; /* Modified to allow close button to pop out */
    position: relative;
    text-align: center;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--ms-color-border);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

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

.confirm-modal-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    color: #fff;
    transition: all 0.3s ease;
}

.confirm-modal-icon.question { background: var(--ms-color-info); box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4); }
.confirm-modal-icon.success { background: var(--ms-color-success); box-shadow: 0 8px 25px rgba(37, 211, 102, 0.4); }
.confirm-modal-icon.error { background: var(--ms-color-error); box-shadow: 0 8px 25px rgba(255, 71, 87, 0.4); }
.confirm-modal-icon.warning { background: var(--ms-color-warning); box-shadow: 0 8px 25px rgba(255, 165, 2, 0.4); }

.confirm-modal-content h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ms-color-text);
    margin: 0 0 12px;
}

.confirm-modal-content p {
    color: var(--ms-color-text-muted);
    font-size: 0.95rem;
    margin: 0 0 30px;
    line-height: 1.5;
}

.confirm-modal-actions {
    display: flex;
    gap: 15px;
}

.confirm-btn {
    flex: 1;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.confirm-btn.cancel {
    background: rgba(255, 255, 255, 0.1);
    color: var(--ms-color-text-muted);
}

.confirm-btn.cancel:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--ms-color-text);
}

.confirm-btn.action {
    background: linear-gradient(135deg, var(--ms-color-info), #2980b9);
    color: #fff;
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.3);
}

.confirm-btn.action:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(52, 152, 219, 0.4);
}

.confirm-btn.action.success {
    background: linear-gradient(135deg, var(--ms-color-success), #1e8449);
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.3);
}

.confirm-btn.action.success:hover {
    box-shadow: 0 12px 35px rgba(37, 211, 102, 0.4);
}

.confirm-btn.action.error {
    background: linear-gradient(135deg, var(--ms-color-error), #c0392b);
    box-shadow: 0 8px 25px rgba(255, 71, 87, 0.3);
}

.confirm-btn.action.error:hover {
    box-shadow: 0 12px 35px rgba(255, 71, 87, 0.4);
}

.confirm-btn.action.warning {
    background: linear-gradient(135deg, var(--ms-color-warning), #e67e22);
    box-shadow: 0 8px 25px rgba(255, 165, 2, 0.3);
}

.confirm-btn.action.warning:hover {
    box-shadow: 0 12px 35px rgba(25, 165, 83, 0.4);
}

/* ============================================
   BOTÓN DE CERRAR NEOMÓRFICO GLOBAL (CYBER-TECH)
   ============================================ */
.btn-close-neomorphic {
    position: absolute;
    top: -22px;
    right: -22px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #0d0f12;
    border: 2px solid #19A553;
    color: #8BFF85;
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    box-shadow: 0 0 15px rgba(25, 165, 83, 0.35), inset 0 0 8px rgba(25, 165, 83, 0.3);
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 0;
    line-height: 1;
}

/* Anillo exterior discontinuo */
.btn-close-neomorphic::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1px dashed rgba(25, 165, 83, 0.35);
    pointer-events: none;
    transition: all 0.35s ease;
}

.btn-close-neomorphic:hover {
    background: #ff4757;
    border-color: #ff4757;
    color: #ffffff;
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 0 25px rgba(255, 71, 87, 0.8), inset 0 0 10px rgba(255, 71, 87, 0.4);
}

.btn-close-neomorphic:hover::before {
    border-color: rgba(255, 71, 87, 0.5);
    inset: -8px;
    transform: rotate(-90deg);
}

.btn-close-neomorphic:active {
    transform: scale(0.95);
}

/* Responsivo para móviles */
@media (max-width: 768px) {
    .btn-close-neomorphic {
        top: 12px !important;
        right: 12px !important;
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
        box-shadow: 0 4px 12px rgba(0,0,0,0.4), 0 0 10px rgba(25, 165, 83, 0.35);
        background: rgba(13, 15, 18, 0.85);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
    }
    
    .btn-close-neomorphic::before {
        inset: -4px;
        border-width: 1px;
    }
    
    .btn-close-neomorphic:hover::before {
        inset: -6px;
    }
}
