/* ==========================================================================
   NOTIFICATION CENTRE — header bell panel
   ==========================================================================
   Markup: js/components/header/NotificationCenter.js
   Behaviour: js/components/header/Header.js (initDropdowns)

   Previously every rule here lived as an inline style attribute inside three
   nested template literals. Moving it out is what makes hover, focus and
   reduced-motion states expressible at all — none of them can be written inline.
   ========================================================================== */

.nc-panel {
    width: min(420px, calc(100vw - 24px));
    display: flex;
    flex-direction: column;
    max-height: min(560px, calc(100vh - 120px));
    border-radius: 20px;
    overflow: hidden;
    /* A soft slate surface rather than page-white: the panel reads as its own
       layer, and the white cards inside it gain figure-ground contrast that a
       white-on-white stack cannot have. Tokens keep it honest in dark mode. */
    background: var(--bg-surface-2, #eef2f7);
    color: var(--text-main, var(--text-primary, #0f172a));
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.nc-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.1rem 0.85rem;
    border-bottom: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.07));
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.08), transparent), var(--bg-surface-1, #fff);
}
.nc-head-text { flex: 1; min-width: 0; }
.nc-head-text strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 850;
    letter-spacing: -0.02em;
}
.nc-head-text em {
    display: block;
    font-style: normal;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    margin-top: 1px;
}
.nc-head-actions { display: flex; align-items: center; gap: 0.4rem; flex: none; }

.nc-action {
    border: none;
    background: var(--primary-alpha, rgba(37, 99, 235, 0.1));
    color: var(--primary, #2563eb);
    font: inherit;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
}
.nc-action:hover { background: rgba(37, 99, 235, 0.18); transform: translateY(-1px); }

.nc-close {
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border: none; background: transparent;
    color: var(--text-muted, #64748b);
    border-radius: 9px; cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}
.nc-close:hover { background: var(--bg-surface-3, rgba(15, 23, 42, 0.07)); color: var(--text-main, var(--text-primary, #0f172a)); }

/* ── Section dividers ───────────────────────────────────────────────────── */
.nc-list { flex: 1; overflow-y: auto; padding: 0.5rem 0.55rem 0.65rem; }

.nc-section {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.75rem 0.55rem 0.4rem;
}
.nc-section-label {
    font-size: 0.62rem; font-weight: 900;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-muted, #64748b);
}
.nc-section-count {
    font-size: 0.6rem; font-weight: 800;
    min-width: 17px; height: 17px; padding: 0 5px;
    display: grid; place-items: center;
    border-radius: 999px;
    background: var(--bg-surface-3, rgba(15, 23, 42, 0.08));
    color: var(--text-muted, #64748b);
}
.nc-section::after {
    content: ''; flex: 1; height: 1px;
    background: linear-gradient(90deg, var(--border-color, rgba(15, 23, 42, 0.12)), transparent);
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.nc-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    width: 100%;
    text-align: left;
    padding: 0.8rem 0.85rem 0.8rem 1rem;
    margin-bottom: 0.4rem;
    border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.08));
    border-radius: 14px;
    background: var(--bg-surface-1, #fff);
    font: inherit;
    color: inherit;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.nc-card:hover {
    transform: translateY(-1px);
    border-color: var(--border-color, rgba(15, 23, 42, 0.14));
    box-shadow: 0 10px 22px -14px rgba(15, 23, 42, 0.45);
}
.nc-card:focus-visible {
    outline: 2px solid var(--primary, #2563eb);
    outline-offset: 2px;
}

/* The left accent is what makes an unread item scannable without colouring the
   whole row, which at this density reads as noise. */
.nc-card-accent { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 0 3px 3px 0; }
.nc-accent--emerald { background: #10b981; }
.nc-accent--indigo { background: #6366f1; }

.nc-card--ticket { background: linear-gradient(90deg, rgba(37, 99, 235, 0.07), transparent 60%), var(--bg-surface-1, #fff); }
.nc-card--enquiry { background: linear-gradient(90deg, rgba(16, 185, 129, 0.07), transparent 60%), var(--bg-surface-1, #fff); }
.nc-card--alert.is-read { background: var(--bg-surface-2, #f4f6fa); border-color: transparent; }
.nc-card--alert.is-read .nc-card-accent { background: rgba(15, 23, 42, 0.12); }
.nc-card--alert.is-read .nc-title { font-weight: 700; color: var(--text-muted, #64748b); }

.nc-icon {
    width: 32px; height: 32px; flex: none;
    display: grid; place-items: center;
    border-radius: 10px;
    font-size: 0.95rem;
}
.nc-icon--ticket { background: rgba(37, 99, 235, 0.12); color: #2563eb; }
.nc-icon--enquiry { background: rgba(16, 185, 129, 0.13); color: #059669; }
.nc-icon--alert { background: rgba(99, 102, 241, 0.12); color: #4f46e5; }

.nc-body { flex: 1; min-width: 0; display: block; }
.nc-title {
    display: block;
    font-size: 0.84rem; font-weight: 800;
    color: var(--text-main, var(--text-primary, #0f172a));
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nc-sub {
    display: block;
    font-size: 0.76rem; font-weight: 500; line-height: 1.45;
    color: var(--text-muted, #64748b);
    margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nc-sub--clamp {
    white-space: normal;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.nc-meta {
    display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap;
    margin-top: 0.45rem;
}
.nc-chip {
    font-size: 0.62rem; font-weight: 800;
    padding: 0.1rem 0.45rem; border-radius: 999px;
}
.nc-ref {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.64rem; font-weight: 700; color: #059669;
}
.nc-dim { font-size: 0.64rem; font-weight: 700; color: var(--text-light, #94a3b8); }

.nc-go { flex: none; color: var(--text-muted, rgba(15, 23, 42, 0.35)); opacity: 0.55; font-size: 0.85rem; margin-top: 0.5rem; transition: transform 0.18s ease, color 0.18s ease; }
.nc-card:hover .nc-go { color: var(--primary, #2563eb); transform: translateX(2px); }

.nc-tick {
    flex: none; width: 26px; height: 26px;
    display: grid; place-items: center;
    border: none; background: transparent;
    color: var(--primary, #2563eb);
    border-radius: 8px; cursor: pointer;
    transition: background 0.18s ease;
}
.nc-tick:hover { background: rgba(37, 99, 235, 0.1); }

/* ── Empty state ────────────────────────────────────────────────────────── */
.nc-empty { padding: 3rem 1.5rem; text-align: center; }
.nc-empty-ic {
    width: 52px; height: 52px; margin: 0 auto 1rem;
    display: grid; place-items: center;
    border-radius: 16px;
    background: var(--bg-surface-1, rgba(15, 23, 42, 0.04));
    color: var(--text-muted, #94a3b8);
    opacity: 0.65;
    font-size: 1.5rem;
}
.nc-empty strong { display: block; font-size: 0.88rem; font-weight: 800; }
.nc-empty p { margin: 0.4rem auto 0; max-width: 30ch; font-size: 0.76rem; color: var(--text-muted, #64748b); line-height: 1.55; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.nc-foot { padding: 0.6rem; border-top: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.07)); background: var(--bg-surface-1, #fff); }
.nc-viewall {
    width: 100%;
    display: flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.6rem;
    border: none; background: transparent;
    font: inherit; font-size: 0.74rem; font-weight: 800;
    color: var(--primary, #2563eb);
    border-radius: 11px; cursor: pointer;
    transition: background 0.18s ease;
}
.nc-viewall:hover { background: rgba(37, 99, 235, 0.07); }
.nc-viewall i { transition: transform 0.18s ease; }
.nc-viewall:hover i { transform: translateX(3px); }

/* ── Phones: a bottom sheet, which is the native idiom and puts the list
      within thumb reach rather than under the notch ────────────────────── */
@media (max-width: 768px) {
    .nc-panel {
        width: 100vw;
        max-height: 78vh;
        border-radius: 22px 22px 0 0;
    }
    .nc-card { padding: 0.85rem 0.8rem 0.85rem 1rem; }
    .nc-title { font-size: 0.88rem; }
    .nc-foot { padding-bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
    .nc-card, .nc-go, .nc-action, .nc-viewall i { transition: none; }
    .nc-card:hover { transform: none; }
}
