/* ==========================================================================
   In-app notices — the one popup (static/js/notices.js renders the markup).
   Loaded by templates/index.html AND templates/admin_notices.html, so the
   admin preview is the real thing. Design: docs/design-notices.html.
   Colors are Tailwind v2 in-palette hexes (static CDN build — no JIT).
   ========================================================================== */

/* One spot for everything: fixed, horizontally centered, just under the 56px
   header. Mounted at the Alpine ROOT — #leftPanel/#rightPanel carry
   contain:layout, which would trap a position:fixed descendant.
   z-index 45: above the header (z-40), UNDER anything the user opens
   (content modals 50, account panel 100, dialogs 200). No backdrop, no focus
   trap — the page stays fully usable around it. */
.notice-float {
    position: fixed;
    top: 68px;
    left: 50%;
    transform: translateX(-50%);
    width: min(520px, calc(100vw - 24px));
    z-index: 45;
    display: flex;
    justify-content: center;
}
.notice-float:empty { display: none; }

/* color → three variables. Closed palette (notices.COLORS). */
.notice--purple { --notice-accent: #8b5cf6; --notice-tint: #ede9fe; --notice-ink: #6d28d9; }
.notice--blue   { --notice-accent: #3b82f6; --notice-tint: #dbeafe; --notice-ink: #1d4ed8; }
.notice--green  { --notice-accent: #10b981; --notice-tint: #d1fae5; --notice-ink: #047857; }
.notice--yellow { --notice-accent: #f59e0b; --notice-tint: #fef3c7; --notice-ink: #b45309; }
.notice--red    { --notice-accent: #ef4444; --notice-tint: #fee2e2; --notice-ink: #b91c1c; }
.notice--gray   { --notice-accent: #9ca3af; --notice-tint: #f3f4f6; --notice-ink: #374151; }

.notice {
    width: 100%;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-left: 4px solid var(--notice-accent);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 12px 14px;
    box-sizing: border-box;
}
.notice-head { display: flex; align-items: flex-start; gap: 10px; }
/* tone → glyph, so meaning never rides on color alone */
.notice-glyph {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 9999px;
    background: var(--notice-tint);
    color: var(--notice-ink);
    display: flex;
    align-items: center;
    justify-content: center;
}
.notice-title {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    line-height: 1.35;
    padding-top: 3px;
    overflow-wrap: anywhere;
}
.notice-body {
    margin: 4px 0 0 36px;
    max-height: 40vh;
    overflow-y: auto;
    color: #374151;
    overflow-wrap: anywhere;
}
.notice-body > :first-child { margin-top: 0; }
.notice-body > :last-child { margin-bottom: 0; }
.notice-body p, .notice-body ul, .notice-body ol { margin-top: 0.5em; margin-bottom: 0.5em; }
.notice-body h3, .notice-body h4 { margin-top: 0.9em; margin-bottom: 0.3em; font-size: 13px; }
.notice-foot { display: flex; align-items: center; gap: 8px; margin: 10px 0 0 36px; }
.notice-meta { flex: 1; min-width: 0; font-size: 12px; color: #9ca3af; }
/* A question's "answers go with your name" line — never hidden, unlike .notice-meta. */
.notice-privacy { flex: 1; min-width: 0; font-size: 12px; color: #6b7280; }
.notice-btn {
    flex-shrink: 0;
    padding: 5px 14px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
    background: #111827;
    color: #fff;
    border: 1px solid #111827;
    cursor: pointer;
}
.notice-btn:hover { background: #1f2937; }
.notice-btn:disabled { background: #e5e7eb; border-color: #e5e7eb; color: #9ca3af; cursor: not-allowed; }
.notice-btn--ghost { background: #fff; color: #374151; border-color: #d1d5db; }
.notice-btn--ghost:hover { background: #f9fafb; border-color: #6b7280; }
.notice-pager { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: #6b7280; flex-shrink: 0; }
.notice-pager button {
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    color: #6b7280;
    background: transparent;
    border: none;
    cursor: pointer;
}
.notice-pager button:hover { background: #f3f4f6; color: #111827; }
/* No body and no question → a one-liner: the button moves up onto the title row. */
.notice--compact .notice-head { align-items: center; }
.notice--compact .notice-title { padding-top: 0; }

/* ---- One-question surveys (the notice's title is the question). ---- */
.notice-q { margin: 10px 0 0 36px; }
/* ≤ 6 short choices → one-tap pills in a row; otherwise a list. Chosen by
   static/js/notices.js (isRowLayout) — there is no layout field. */
.notice-choices-row { display: flex; flex-wrap: wrap; gap: 6px; }
.notice-choices-list { display: flex; flex-direction: column; gap: 4px; }
.notice-choice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    border-radius: 9999px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}
.notice-choice:hover { background: #f9fafb; border-color: #6b7280; }
.notice-choice.is-on { background: #111827; border-color: #111827; color: #fff; }
/* List rows read as options in a menu, not buttons: rounded rectangle, tinted when chosen. */
.notice-choices-list .notice-choice { width: 100%; border-radius: 10px; padding: 7px 12px; text-align: left; }
.notice-choices-list .notice-choice.is-on { background: var(--notice-tint); border-color: var(--notice-accent); color: #111827; }
.notice-choice-mark { flex-shrink: 0; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid #9ca3af; background: #fff; }
.notice-choice-mark.is-square { border-radius: 4px; }
.is-on .notice-choice-mark { border-color: var(--notice-ink); background: var(--notice-ink); box-shadow: inset 0 0 0 2px #fff; }
.notice-text {
    display: block;
    width: 100%;
    margin-top: 8px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 13px;
    line-height: 1.45;
    color: #111827;
    resize: vertical;
    min-height: 40px;
    font-family: inherit;
    box-sizing: border-box;
}
.notice-text:focus { outline: none; border-color: #6b7280; }
.notice-thanks-summary {
    font-size: 12px;
    font-weight: 400;
    color: #6b7280;
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* minimize_on_dismiss: the same spot, shrunk to a pill until the notice ends. */
.notice-mini {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 5px 6px 5px 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    cursor: pointer;
}
.notice-mini:hover { border-color: #9ca3af; }
.notice-mini-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--notice-accent); flex-shrink: 0; }
.notice-mini-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice-mini-show { flex-shrink: 0; font-size: 12px; color: #4b5563; background: #f3f4f6; padding: 2px 9px; border-radius: 9999px; }

/* Arrival only (same family as the .notif-card slide-in); no exit animation. */
.notice-enter { animation: noticeDrop 0.18s ease-out both; }
@keyframes noticeDrop {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .notice-enter { animation: none; }
}

@media (max-width: 768px) {
    .notice-float { top: 64px; }
    .notice-body, .notice-foot { margin-left: 0; }
    .notice-body { max-height: 35vh; }
    .notice-meta { display: none; }
    .notice-q { margin-left: 0; }
    .notice-text { font-size: 16px; }  /* iOS Safari zooms the page on focus below 16px */
}
