/* ---------- Custom Toasts (replaces alert()) ---------- */

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    /* Deliberately far above every modal overlay anywhere in the app -
       toasts are meant to always be the topmost, most attention-grabbing
       layer. The Interactive Page Builder (and its own nested overlays,
       like the image-adjust dialog) use some of the highest z-indices in
       the app, up to 10004 - this needs enough headroom to clear all of
       them, plus room for anything added later, rather than just barely
       squeaking past today's highest value. */
    z-index: 10600;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 10px;
    background: #2d3748;
    color: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    font-size: 14px;
    line-height: 1.4;
    animation: toastIn 0.25s ease-out;
    border-left: 4px solid #4299e1;
}

.toast.success { border-left-color: #38a169; }
.toast.error   { border-left-color: #e53e3e; }
.toast.warning { border-left-color: #dd6b20; }
.toast.info    { border-left-color: #4299e1; }

.toast .toast-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.toast .toast-msg {
    flex: 1;
}

.toast .toast-close {
    cursor: pointer;
    opacity: 0.6;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}
.toast .toast-close:hover { opacity: 1; }

.toast.leaving {
    animation: toastOut 0.2s ease-in forwards;
}

@keyframes toastIn {
    from { transform: translateX(30px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(30px); opacity: 0; }
}

/* ---------- Custom Modal (replaces confirm()) ---------- */

#modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 24, 33, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    /* Same reasoning as #toast-container above - this confirm dialog can
       be triggered from INSIDE the Interactive Page Builder itself (e.g.
       a "delete this page?" confirmation), so it needs to sit above that
       builder's own overlay (z-index up to 10004), not just above normal
       page content. Kept just below the toast layer, so a toast and a
       confirm dialog would never visually compete if both were somehow
       open at once. */
    z-index: 10500;
    animation: overlayIn 0.15s ease-out;
}
#modal-overlay.open { display: flex; }

@keyframes overlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-box {
    background: #fff;
    border-radius: 14px;
    width: 90%;
    max-width: 420px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from { transform: translateY(-10px) scale(0.98); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-box h3 {
    margin: 0 0 10px;
    font-size: 18px;
    color: #1a202c;
}

.modal-box p {
    margin: 0 0 20px;
    color: #4a5568;
    font-size: 14px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-btn {
    padding: 9px 18px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.modal-btn:hover { opacity: 0.85; }

.modal-btn.cancel {
    background: #edf2f7;
    color: #2d3748;
}
.modal-btn.confirm {
    background: #e53e3e;
    color: #fff;
}
.modal-btn.confirm.primary {
    background: #3182ce;
}
