/* notify.css
   ---------------------------------------------------------------------------
   Styling for the Notify module (notify.js). Two surfaces:
     • .notify-toast       — corner-stacked, transient, color-coded
     • .notify-modal       — centered, acknowledgment-required
   Severity palette aligns with the existing app chrome (orange = cancel,
   yellow/green = positive, red = destructive).  No external dependencies. */

#notify-root {
    /* The container is a body-level positional anchor; individual surfaces
       paint themselves with their own fixed positioning so the root never
       blocks pointer events on the rest of the page. */
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100000;
}

/* ============================== TOAST ================================== */

.notify-toast-stack {
    /* Position is set inline by anchorStack() — it spawns near the user's
       most recent pointerdown so the eye doesn't have to travel.  The
       transform varies (translate(-50%, -100%) for "above click", or
       translate(-50%, 0) when flipped below for clicks near the top edge). */
    position: fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    max-width: min(480px, calc(100vw - 32px));
    width: max-content;
    z-index: 100001;
}

.notify-toast {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    background: white;
    color: #212529;
    font-size: 14px;
    line-height: 1.4;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    overflow: hidden;                /* keep header corners inside the radius */
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    width: 100%;
    min-width: 240px;
    /* Fade + scale entrance — feels native to an overlay-style notification. */
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 180ms ease, transform 180ms ease;
}

.notify-toast--visible { opacity: 1; transform: scale(1); }
.notify-toast--leaving { opacity: 0; transform: scale(0.96); }

/* ── Colored title bar ── matches the dialog/modal header convention:
   solid severity color, white text, dismiss button on the right. */
.notify-toast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.2;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.notify-toast--info    .notify-toast-header { background-color: #0d6efd; }
.notify-toast--success .notify-toast-header { background-color: #198754; }
.notify-toast--warning .notify-toast-header { background-color: #ff8c00; }
.notify-toast--error   .notify-toast-header { background-color: #dc3545; }

.notify-toast-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notify-toast-close {
    flex-shrink: 0;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.85);
    font-size: 22px;
    line-height: 1;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.notify-toast-close:hover {
    background: rgba(0, 0, 0, 0.18);
    color: white;
}

/* ── Body ── */
.notify-toast-body {
    padding: 12px 14px;
    word-break: break-word;
    white-space: pre-line;            /* honor \n in localized messages */
}

/* ── Optional action row (e.g. "Retry") ── */
.notify-toast-action-row {
    padding: 0 14px 12px;
    display: flex;
    justify-content: flex-end;
}

.notify-toast-action {
    background: transparent;
    border: 1px solid #6c757d;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    color: #495057;
    font-size: 13px;
    font-weight: 600;
}

.notify-toast-action:hover { background: #e9ecef; }

/* On narrow viewports tighten the max-width so the toast still fits
   alongside the click anchor without overflowing the screen edge. */
@media (max-width: 600px) {
    .notify-toast-stack {
        max-width: calc(100vw - 16px);
    }
}

/* ============================== MODAL ================================== */

.notify-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    pointer-events: auto;          /* backdrop catches clicks */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 160ms ease;
}

.notify-modal-backdrop--visible {
    opacity: 1;
}

.notify-modal-backdrop--leaving {
    opacity: 0;
}

.notify-modal {
    background: white;
    border-radius: 8px;
    width: min(440px, 100%);
    max-height: calc(100vh - 32px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    transform: scale(0.96);
    transition: transform 160ms ease;
}

.notify-modal-backdrop--visible .notify-modal {
    transform: scale(1);
}

.notify-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #dee2e6;
    color: white;
}

.notify-modal--info    .notify-modal-header { background-color: #0d6efd; }
.notify-modal--success .notify-modal-header { background-color: #198754; }
.notify-modal--warning .notify-modal-header { background-color: #ff8c00; }
.notify-modal--error   .notify-modal-header { background-color: #dc3545; }

.notify-modal-title {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.notify-modal-close {
    flex: 0 0 auto;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.85);
    font-size: 24px;
    line-height: 1;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.notify-modal-close:hover,
.notify-modal-close:focus-visible {
    background: rgba(0, 0, 0, 0.18);
    color: white;
    outline: none;
}

.notify-modal-body {
    padding: 16px 18px;
    font-size: 14px;
    line-height: 1.5;
    color: #212529;
    overflow-y: auto;
    word-break: break-word;
}

.notify-modal-footer {
    padding: 12px 18px;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 8px;
}

.notify-modal-btn {
    padding: 8px 16px;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    background: white;
    color: #495057;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.notify-modal-btn--secondary {
    border-color: #6c757d;
    color: #495057;
}
.notify-modal-btn--secondary:hover { background: #e9ecef; }

.notify-modal-btn--primary {
    background: #0d6efd;
    border-color: #0d6efd;
    color: white;
}
.notify-modal-btn--primary:hover { background: #0b5ed7; border-color: #0a58ca; }

.notify-modal-btn--danger {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
}
.notify-modal-btn--danger:hover { background: #c82333; border-color: #bd2130; }

/* Sensitive payload (e.g. generated password) — hidden until Reveal */

.notify-modal-sensitive {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 16px;
    padding: 8px 12px;
    background: #f1f3f5;
    border: 1px solid #ced4da;
    border-radius: 4px;
    margin-bottom: 8px;
    user-select: all;
    word-break: break-all;
}

.notify-modal-sensitive-ctrls {
    display: flex;
    gap: 6px;
}

.notify-modal-reveal-btn,
.notify-modal-copy-btn {
    padding: 4px 10px;
    border: 1px solid #6c757d;
    border-radius: 4px;
    background: white;
    color: #495057;
    font-size: 13px;
    cursor: pointer;
}

.notify-modal-reveal-btn:hover,
.notify-modal-copy-btn:hover {
    background: #e9ecef;
}
