/* ═══════════════════════════════════════════════════════════════════
   EverAfter — Unified Modal System — Glass/Glossy Design
   ═══════════════════════════════════════════════════════════════════ */

/* ── Entry animation ───────────────────────────────────────────── */
@keyframes ea-modal-in {
    from { opacity: 0; transform: translateY(-12px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Overlay backdrop ──────────────────────────────────────────── */
.ea-modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(10, 18, 10, 0.55);
    backdrop-filter: blur(12px) saturate(1.4);
    -webkit-backdrop-filter: blur(12px) saturate(1.4);
    display: flex; align-items: center; justify-content: center;
    padding: 1.5rem;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .25s ease-out, visibility 0s .25s;
}

html:not(.dark-mode) .ea-modal-overlay {
    background: rgba(200, 210, 210, 0.45);
}

.ea-modal-overlay.is-open {
    opacity: 1; visibility: visible; pointer-events: auto;
    transition: opacity .25s ease-out;
}

/* ── Full-page modal wrapper ────────────────────────────────────── */
.ea-modal-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 60vh;
    padding: 2.5rem 1.5rem;
}

/* ── Modal box — glass card ────────────────────────────────────── */
.ea-modal {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    padding: 2.5rem 2.25rem;
    max-width: 440px; width: 100%;
    text-align: center;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.04),
        0 12px 40px rgba(0, 0, 0, 0.10),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    animation: ea-modal-in .22s cubic-bezier(0.22, 1, 0.36, 1);
}

html.dark-mode .ea-modal {
    background: rgba(15, 26, 15, 0.82);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.3),
        0 20px 60px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Danger / Warning variants */
.ea-modal--danger {
    background: rgba(255, 248, 248, 0.92);
    border-color: rgba(212, 99, 92, 0.22);
}
html.dark-mode .ea-modal--danger {
    background: rgba(30, 10, 10, 0.88);
    border-color: rgba(212, 99, 92, 0.22);
}

.ea-modal--warning {
    background: rgba(255, 253, 245, 0.92);
    border-color: var(--at-25);
}
html.dark-mode .ea-modal--warning {
    background: rgba(20, 16, 5, 0.88);
    border-color: var(--at-25);
}

/* ── Icon circle ───────────────────────────────────────────────── */
.ea-modal__icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.35rem;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.06);
    color: var(--light-text);
}
html.dark-mode .ea-modal__icon {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.06);
}
.ea-modal__icon--danger  { background: rgba(212, 99, 92, 0.1); border-color: rgba(212, 99, 92, 0.15); color: var(--error); }
.ea-modal__icon--warning { background: var(--at-10); border-color: var(--at-20); color: var(--accent); }
.ea-modal__icon .icon-svg { width: 22px; height: 22px; }

/* ── Title ─────────────────────────────────────────────────────── */
.ea-modal__title {
    font-family: var(--font-display);
    font-size: 1.4rem; font-weight: 400;
    color: var(--dark-text);
    margin: 0 0 .75rem;
    line-height: 1.25;
}
.ea-modal--danger  .ea-modal__title { color: var(--error); }
.ea-modal--warning .ea-modal__title { color: var(--accent); }

/* ── Body text ─────────────────────────────────────────────────── */
.ea-modal__body {
    color: var(--light-text);
    font-size: .9rem; line-height: 1.65;
    margin: 0 0 1.5rem;
}

/* ── Detail rows ────────────────────────────────────────────────── */
.ea-modal__details {
    background: rgba(0, 0, 0, 0.025);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    padding: .75rem 1rem;
    margin-bottom: 1.5rem;
    text-align: left;
}
html.dark-mode .ea-modal__details {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.07);
}
.ea-modal__detail-row {
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; padding: .32rem 0;
}
.ea-modal__detail-row + .ea-modal__detail-row {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}
html.dark-mode .ea-modal__detail-row + .ea-modal__detail-row {
    border-top-color: rgba(255, 255, 255, 0.04);
}
.ea-modal__detail-label { font-size: .78rem; color: var(--muted-text); }
.ea-modal__detail-value { font-size: .82rem; color: var(--dark-text); font-weight: 500; }

/* ── Actions row ────────────────────────────────────────────────── */
.ea-modal__actions {
    display: flex; gap: .75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.75rem;
}
.ea-modal__actions form { display: contents; }
.ea-modal__actions .btn,
.ea-modal__actions .btn-danger,
.ea-modal__actions .btn-secondary {
    flex: 1; min-width: 120px; max-width: 200px;
}

/* ── Countdown lock ─────────────────────────────────────────────── */
.ea-modal__countdown-hint {
    font-size: .78rem; color: var(--muted-text);
    margin-bottom: 1.5rem; margin-top: -.5rem;
    line-height: 1.55;
}
.ea-modal__submit[disabled] { opacity: .45; cursor: not-allowed; }
.ea-modal__submit-timer {
    display: inline-block; min-width: 1.8em;
    font-size: .78rem; opacity: .65;
    font-variant-numeric: tabular-nums;
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 520px) {
    .ea-modal { padding: 2rem 1.4rem; border-radius: 16px; }
    .ea-modal__title { font-size: 1.2rem; }
    .ea-modal__actions { flex-direction: column; align-items: stretch; }
    .ea-modal__actions .btn,
    .ea-modal__actions .btn-danger,
    .ea-modal__actions .btn-secondary { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .ea-modal-overlay, .ea-modal {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
