/* ========================================================================================== */
/* SISTEMA DE ALERTAS PERSONALIZADAS — Reemplaza alert() y confirm() nativos del navegador   */
/* ========================================================================================== */

/* --- OVERLAY DE FONDO --- */
#custom-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99998;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 0 env(safe-area-inset-bottom, 0px) 0;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

#custom-modal-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

/* --- CAJA DEL MODAL --- */
#custom-modal-box {
    background: #0d0d0d;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px 12px 0 0;
    width: 100%;
    max-width: 520px;
    padding: 28px 24px 32px 24px;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6);
    transform: translateY(30px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#custom-modal-overlay.visible #custom-modal-box {
    transform: translateY(0);
}

/* --- INDICADOR SUPERIOR (barra de arrastre visual) --- */
.modal-drag-bar {
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    margin: 0 auto -4px auto;
}

/* --- ÍCONO DEL TIPO --- */
.modal-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    font-size: 1.5rem;
    flex-shrink: 0;
    align-self: center;
}

.modal-icon-wrap.success {
    background: rgba(193, 255, 114, 0.1);
    border: 1px solid rgba(193, 255, 114, 0.2);
}

.modal-icon-wrap.error {
    background: rgba(255, 80, 80, 0.1);
    border: 1px solid rgba(255, 80, 80, 0.2);
}

.modal-icon-wrap.warning {
    background: rgba(255, 165, 0, 0.1);
    border: 1px solid rgba(255, 165, 0, 0.2);
}

.modal-icon-wrap.info {
    background: rgba(100, 180, 255, 0.1);
    border: 1px solid rgba(100, 180, 255, 0.2);
}

.modal-icon-wrap.confirm {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- MENSAJE --- */
#custom-modal-message {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: #e0e0e0;
    text-align: center;
    line-height: 1.55;
    white-space: pre-line; /* Respeta los \n del mensaje */
    padding: 0 4px;
}

/* --- BOTONES --- */
.modal-btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.modal-btn {
    width: 100%;
    padding: 16px;
    border-radius: 6px;
    border: none;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

/* Botón Aceptar principal */
.modal-btn-accept {
    background: #fff;
    color: #000;
}

.modal-btn-accept:active {
    transform: scale(0.97);
    background: #e0e0e0;
}

/* Variante éxito (verde neon) */
.modal-btn-accept.success {
    background: #C1FF72;
    color: #000;
}

/* Variante error (rojo) */
.modal-btn-accept.error {
    background: #FF5050;
    color: #fff;
}

/* Variante warning (naranja) */
.modal-btn-accept.warning {
    background: #FFA500;
    color: #000;
}

/* Botón Cancelar secundario */
.modal-btn-cancel {
    background: rgba(255, 255, 255, 0.06);
    color: #a1a1a6;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-btn-cancel:active {
    transform: scale(0.97);
    background: rgba(255, 255, 255, 0.1);
}

/* Botón de confirmación peligrosa */
.modal-btn-danger {
    background: rgba(255, 80, 80, 0.12);
    color: #FF5050;
    border: 1px solid rgba(255, 80, 80, 0.2);
}

.modal-btn-danger:active {
    transform: scale(0.97);
    background: rgba(255, 80, 80, 0.2);
}

/* ── INPUT de showPrompt ── */
.modal-prompt-input {
    display: none;
    width: 100%;
    box-sizing: border-box;
    margin: 12px 0 4px 0;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #fff;
    font-size: 1rem;
    font-family: 'Inter', system-ui, sans-serif;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.modal-prompt-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.modal-prompt-input:focus {
    border-color: rgba(193, 255, 114, 0.5);
    background: rgba(193, 255, 114, 0.04);
    box-shadow: 0 0 0 3px rgba(193, 255, 114, 0.08);
}
