/**
 * MVD Notifications — v0.1.0
 *
 * Styles for the dashboard widget ([mvd_notifications_widget]) and the full
 * notification center ([mvd_notifications]). No outer card/border/shadow —
 * Kadence (or the page) supplies the wrapper, matching the established widget
 * philosophy. Priority drives badge/dot color; read state softens the row.
 */

/* ─── Shared list shell (widget + center) ───────────────────────────── */

.mvd-notif-widget,
.mvd-notif-center {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1d2327;
    font-size: 14px;
    line-height: 1.5;
}

.mvd-notif-list {
    display: flex;
    flex-direction: column;
}

.mvd-notif-empty {
    color: #64748b;
    margin: 0;
    padding: 14px 4px;
    text-align: center;
    font-size: 0.9rem;
}

/* ─── Grouped day sections (center) ─────────────────────────────────── */

.mvd-notif-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 14px;
}

.mvd-notif-group:last-child {
    margin-bottom: 0;
}

.mvd-notif-group__label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    padding: 2px 0 4px;
}

/* ─── Notification row ──────────────────────────────────────────────── */

.mvd-notif-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 8px;
    border-radius: 8px;
    border-bottom: 1px solid #f1f5f9;
    cursor: default;
    transition: background 0.12s ease;
    outline: none;
}

.mvd-notif-row:last-child {
    border-bottom: none;
}

.mvd-notif-row.is-unread {
    background: #f8fafc;
}

.mvd-notif-row.is-link {
    cursor: pointer;
}

.mvd-notif-row.is-link:hover,
.mvd-notif-row.is-link:focus-visible {
    background: #eef2f7;
}

/* Read rows are visually softer. */
.mvd-notif-row.is-read {
    opacity: 0.72;
}

/* Unread dot */
.mvd-notif-dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    margin-top: 7px;
    border-radius: 50%;
    background: transparent;
}

.mvd-notif-row.is-unread .mvd-notif-dot {
    background: #2271b1;
}

/* Priority tints the dot (unread only) — subtle, never garish. */
.mvd-notif-row.is-unread.prio-success .mvd-notif-dot { background: #16a34a; }
.mvd-notif-row.is-unread.prio-warning .mvd-notif-dot { background: #dba617; }
.mvd-notif-row.is-unread.prio-error   .mvd-notif-dot { background: #d63638; }

/* Module icon */
.mvd-notif-icon {
    flex: 0 0 auto;
    width: 18px;
    text-align: center;
    margin-top: 3px;
    color: #64748b;
    font-size: 0.95rem;
}

.mvd-notif-row.is-unread .mvd-notif-icon {
    color: #334155;
}

/* Body (title + message) */
.mvd-notif-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mvd-notif-title {
    font-weight: 600;
    color: #1d2327;
    font-size: 0.9rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.mvd-notif-msg {
    color: #50575e;
    font-size: 0.85rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

/* Time stamp */
.mvd-notif-time {
    flex: 0 0 auto;
    color: #94a3b8;
    font-size: 0.78rem;
    white-space: nowrap;
    margin-top: 2px;
}

/* ─── Widget (dashboard) tweaks ─────────────────────────────────────── */
/* The widget shares the row styles; just keep it compact and centered to
   sit alongside the other dashboard widgets. */
.mvd-notif-widget {
    max-width: 360px;
    margin: 0 auto;
}

/* ─── Center toolbar ────────────────────────────────────────────────── */

.mvd-notif-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.mvd-notif-filters {
    display: inline-flex;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}

.mvd-notif-filter {
    border: none;
    background: transparent;
    color: #50575e;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.mvd-notif-filter:hover {
    color: #1d2327;
}

.mvd-notif-filter.is-active {
    background: #fff;
    color: #1d2327;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.mvd-notif-markall {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.mvd-notif-markall:hover:not(:disabled) {
    background: #eef2f7;
    border-color: #94a3b8;
}

.mvd-notif-markall:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ─── Pager ─────────────────────────────────────────────────────────── */

.mvd-notif-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}

.mvd-notif-prev,
.mvd-notif-next {
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.mvd-notif-prev:hover:not(:disabled),
.mvd-notif-next:hover:not(:disabled) {
    background: #eef2f7;
    border-color: #94a3b8;
}

.mvd-notif-prev:disabled,
.mvd-notif-next:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.mvd-notif-pager-info {
    color: #64748b;
    font-size: 0.82rem;
}

/* ─── Responsive ────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .mvd-notif-widget,
    .mvd-notif-center {
        max-width: 100%;
    }

    .mvd-notif-row {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .mvd-notif-time {
        width: 100%;
        margin-top: 4px;
    }

    .mvd-notif-toolbar {
        align-items: stretch;
    }

    /* Floating bell dropdown goes full-width on small screens. Only the
       auto-injected (--floating) variant is pinned to the viewport edge,
       so an in-flow shortcode bell keeps its parent's layout. */
    .mvd-notif-bell--floating .mvd-notif-bell-panel {
        right: 8px !important;
        left: 8px !important;
        width: auto !important;
    }
}

/* ─── Notification bell component ─────────────────────────────────────
   A single reusable component rendered by [mvd_notifications_bell] (in-flow,
   position: relative — inherits parent placement like any other widget) and
   by the auto-injected footer bell (.mvd-notif-bell--floating → position:
   fixed). The dropdown panel anchors to .mvd-notif-bell in both modes.
   Reuses the shared .mvd-notif-* row/dot/icon typography from the widget/center. */

.mvd-notif-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    /* Defensive reset so theme/Kadence header styles don't bleed into the
       component — the bell owns its own box model. */
    margin: 0;
    padding: 0;
    line-height: 1;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Auto-injected (wp_footer) convenience variant: fixed top-right. Only this
   modifier fixes position; the base component always participates in normal
   layout so shortcodes can be placed in headers/sidebars/top bars. */
.mvd-notif-bell--floating {
    position: fixed;
    top: 14px;
    right: 16px;
    z-index: 99990;
}

.mvd-notif-bell-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #ffffff;
    color: #334155;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

/* Explicit hover/focus with high specificity so Kadence/ theme link/button
   colors never bleed into the bell. Keeps the interaction consistent with the
   rest of MVD (neutral surface + darker icon on hover). */
.mvd-notif-bell-btn:hover,
.mvd-notif-bell-btn:focus-visible,
.mvd-notif-bell:focus-within .mvd-notif-bell-btn {
    background: #f8fafc;
    color: #0f172a;
    border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}

.mvd-notif-bell-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.mvd-notif-bell.is-open .mvd-notif-bell-btn {
    background: #f1f5f9;
    color: #0f172a;
}

.mvd-notif-unread-count {
    position: absolute;
    top: -5px;
    right: -5px;
    box-sizing: border-box;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc2626;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    white-space: nowrap;
    /* Scales gracefully from 1 up to "99+" without overlapping the bell —
       the pill grows horizontally with the digit count. */
    box-shadow: 0 0 0 2px #ffffff;
}

.mvd-notif-bell-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    /* Cap to the viewport so the dropdown never clips or overflows on mobile,
       whether the bell is in a header, sidebar, or top bar. */
    width: min(360px, calc(100vw - 24px));
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
    overflow: hidden;
    color: #1d2327;
    font-size: 14px;
    line-height: 1.5;
}

.mvd-notif-bell-panel[hidden] {
    display: none;
}

.mvd-notif-bell-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid #eef2f7;
}

.mvd-notif-bell-title {
    font-weight: 600;
    color: #0f172a;
}

.mvd-notif-bell .mvd-notif-markall {
    border: none;
    background: transparent;
    color: #2563eb;
    font-size: 0.82rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 6px;
}

.mvd-notif-bell .mvd-notif-markall:hover {
    background: #eff6ff;
}

.mvd-notif-bell .mvd-notif-list {
    overflow-y: auto;
    padding: 6px 8px;
}

/* Reuse shared row styles but tighten for the compact dropdown. */
.mvd-notif-bell .mvd-notif-row {
    padding: 9px 10px;
}

.mvd-notif-bell-viewall {
    display: block;
    padding: 11px 14px;
    border-top: 1px solid #eef2f7;
    background: #f8fafc;
    color: #2563eb;
    font-size: 0.88rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}

.mvd-notif-bell-viewall:hover {
    background: #eff6ff;
    color: #1d4ed8;
}

.mvd-notif-bell-viewall i {
    margin-left: 4px;
    font-size: 0.78rem;
}
