/* ════════════════════════════════════════
   modals.css
   ════════════════════════════════════════ */
.overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.55); z-index: 1000;
    align-items: center; justify-content: center;
    padding: 16px; backdrop-filter: blur(4px);
    /* Prevent overlay from causing page scroll */
    overflow: hidden;
}
.overlay.open { display: flex; }

.modal {
    background: white; border-radius: var(--radius-xl);
    width: 100%; max-width: 580px; max-height: 92vh;
    overflow-y: auto; overflow-x: hidden;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.3s cubic-bezier(.34,1.56,.64,1);
    /* Ensure modal never exceeds screen */
    max-width: min(580px, calc(100vw - 32px));
    box-sizing: border-box;
}
.modal-md { max-width: min(480px, calc(100vw - 32px)); }
.modal-lg { max-width: min(740px, calc(100vw - 32px)); }
.modal-xl { max-width: min(980px, calc(100vw - 32px)); }

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.94) translateY(12px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

.modal-head {
    padding: 18px 22px; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index:1;
}
.modal-head h4 { color: white; font-size: 1rem; font-weight: 700; }
.modal-x {
    background: rgba(255,255,255,.2); border: none;
    color: white; width: 32px; height: 32px; border-radius: 50%;
    cursor: pointer; font-size: 1.1rem;
    display: flex; align-items: center; justify-content: center;
    transition: var(--tr);
}
.modal-x:hover { background: rgba(255,255,255,.3); }
.modal-body { padding: 22px; }
.modal-foot {
    padding: 16px 22px; border-top: 1px solid var(--gray-200);
    display: flex; gap: 10px; justify-content: flex-end;
    position: sticky; bottom: 0; background: white; border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ── Custom Confirm Dialog ──────────────── */
#confirmDialog { z-index: 10000; }

.confirm-card {
    background: #fff;
    border-radius: 22px;
    max-width: 390px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 28px 70px rgba(0,0,0,.22), 0 4px 16px rgba(0,0,0,.08);
    animation: confirmIn .28s cubic-bezier(.34,1.56,.64,1);
}
.confirm-top {
    padding: 36px 28px 18px;
    text-align: center;
    background: linear-gradient(180deg, #fff7f7 0%, #fff 100%);
}
.confirm-icon-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    font-size: 2.5rem;
    position: relative;
}
.confirm-icon-ring::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid currentColor;
    opacity: 0.25;
    animation: confirmRing 1.6s ease-in-out infinite;
}
.confirm-icon-ring.type-danger  { background: #fee2e2; color: #dc2626; }
.confirm-icon-ring.type-warning { background: #fef9c3; color: #d97706; }
.confirm-icon-ring.type-info    { background: #dbeafe; color: #2563eb; }
.confirm-icon-ring.type-success { background: #d1fae5; color: #059669; }

.confirm-title {
    font-size: 1.12rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 10px;
    line-height: 1.4;
}
.confirm-msg {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.75;
    margin: 0;
    white-space: pre-line;
}
.confirm-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
    margin: 0 24px;
}
.confirm-btns {
    display: flex;
    gap: 10px;
    padding: 18px 24px 26px;
}
.confirm-btns .btn {
    flex: 1;
    height: 46px;
    font-size: 0.92rem;
    font-weight: 700;
    border-radius: 12px;
}

@keyframes confirmIn {
    from { opacity: 0; transform: scale(0.82) translateY(-16px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);     }
}
@keyframes confirmRing {
    0%, 100% { transform: scale(1);   opacity: 0.25; }
    50%       { transform: scale(1.2); opacity: 0.1;  }
}
