/* ==========================================================================
   SweetAlert-style popup (alert.js)
   ========================================================================== */
.alert-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--color-overlay);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 180ms var(--ease), visibility 180ms;
}
.alert-overlay.is-open { opacity: 1; visibility: visible; }

.alert-box {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 32px 28px 24px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    background: var(--color-surface);
    box-shadow: var(--shadow-lg);
    text-align: center;
    overflow: hidden;
    transform: scale(.7);
    opacity: 0;
    transition: transform 320ms cubic-bezier(.26, 1.36, .5, 1), opacity 200ms var(--ease);
}
.alert-overlay.is-open .alert-box { transform: scale(1); opacity: 1; }
.alert-overlay.is-closing .alert-box { transform: scale(.9); opacity: 0; transition-duration: 150ms; }
.alert-box.is-shaking { animation: alert-shake 360ms var(--ease); }

.alert-box__close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--color-muted);
    font-size: 22px;
    line-height: 1;
    transition: background var(--transition), color var(--transition);
}
.alert-box__close:hover { background: var(--color-danger-soft); color: var(--color-danger); }

/* Animated icons */
.alert-icon { width: 84px; height: 84px; margin: 0 auto 18px; }
.alert-icon svg { width: 100%; height: 100%; overflow: visible; }
.alert-icon__ring { fill: none; stroke-width: 3; stroke-dasharray: 151; stroke-dashoffset: 151; stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; animation: alert-draw 520ms var(--ease) forwards; }
.alert-icon__fill { opacity: .12; }
.alert-icon__mark { fill: none; stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: alert-draw 360ms var(--ease) 380ms forwards; }

.alert-icon--success { color: var(--color-success); }
.alert-icon--error { color: var(--color-danger); }
.alert-icon--warning { color: var(--color-warning); }
.alert-icon--info { color: var(--color-info); }
.alert-icon--question { color: var(--color-muted); }
.alert-icon svg { stroke: currentColor; }
.alert-icon__fill { fill: currentColor; stroke: none; }
.alert-icon--warning svg, .alert-icon--error svg { animation: alert-pulse 600ms var(--ease) 520ms; }

.alert-box__title { margin-bottom: 8px; font-size: 21px; font-weight: 700; letter-spacing: -.01em; color: var(--color-text); }
.alert-box__text { color: var(--color-muted); font-size: 14.5px; line-height: 1.6; }
.alert-box__html { margin-top: 8px; color: var(--color-text-2); }

.alert-box__input { margin-top: 18px; text-align: left; }

.alert-box__validation {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 16px -28px 0;
    padding: 10px 16px;
    background: var(--color-danger-soft);
    color: var(--color-danger);
    font-size: 13.5px;
    font-weight: 500;
}
.alert-box__validation.is-visible { display: flex; animation: fade-down 160ms var(--ease); }

.alert-box__actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.alert-box__actions .btn { min-width: 110px; }

.alert-box__timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--color-primary); transform-origin: left; animation: alert-timer linear forwards; }

@keyframes alert-draw { to { stroke-dashoffset: 0; } }
@keyframes alert-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes alert-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes alert-shake {
    0%, 100% { transform: none; }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

body.has-alert { overflow: hidden; }
