/**
 * Header panels — the shared visual language for the three small
 * anchored-dropdown-on-desktop / bottom-sheet-on-mobile panels hanging
 * off the site header: the Quick Access menu (#headerMenuDropdown —
 * Dashboard/Admin Panel/Theme/Live connection), the Notification panel
 * (#notificationPanel — reminders), and the User/Profile menu (#userMenu).
 *
 * Quick Access's own open/close (the hamburger<->X icon swap, the theme-
 * swatch accordion) lives in index.html's inline script and is untouched;
 * Notification's and Profile's open/close both go through the shared
 * utils/header-panel.js controller. All three just apply the same .hp-*
 * classes below — visual/layout only, nothing here drives behavior.
 *
 * Desktop/tablet (>=768px): anchored dropdown, right-aligned below its
 * trigger button — glass background, 20px rounded corners, a soft two-tone
 * cyan/purple glow (the app's own logo gradient) instead of a flat border,
 * scale+fade entrance.
 *
 * Mobile (<768px): the same element becomes a bottom sheet — fixed, full
 * width, slides up from the bottom edge with a scrim behind it and a drag
 * handle for swipe-to-dismiss. Comfortable full-width row spacing instead
 * of the narrow anchored card's tighter padding.
 */

/* ── Scrim (mobile only) ──────────────────────────────────────────────── */
.hp-scrim {
  display: none;
}
@media (max-width: 767.98px) {
  .hp-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.65);
    z-index: 199; /* below the sheet (200) */
    opacity: 0;
    pointer-events: none;
    transition: opacity 250ms ease;
  }
  .hp-scrim.hp-scrim-visible {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ── The dropdown/sheet itself ────────────────────────────────────────── */
.hp-dropdown {
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 1.25rem; /* 20px */
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.18),
    0 0 24px rgba(34, 211, 238, 0.16),
    0 0 40px rgba(168, 85, 247, 0.14),
    0 20px 44px rgba(0, 0, 0, 0.55);
  transform-origin: top right;
  transform: scale(0.94) translateY(-4px);
  opacity: 0;
  transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.15s ease;
}
.hp-dropdown.menu-visible {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.hp-section-label {
  background: linear-gradient(to right, rgba(148, 163, 184, 0.08), transparent);
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}
.hp-section-divider {
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

/* ── Menu item rows — hover/focus background + inset glow ring. ──────── */
.hp-row {
  position: relative;
}
.hp-row:hover,
.hp-row:focus-visible {
  background: rgba(148, 163, 184, 0.1);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.1);
}
.hp-row:focus-visible {
  outline: 2px solid var(--accent, #22d3ee);
  outline-offset: -2px;
}

/* Icon badges — soft colored glow at rest, brighter on the row's hover.
   Cyan/amber (Dashboard/Admin Panel) preserved exactly; the rest are new,
   for the Profile menu's own rows. */
.hp-badge {
  transition: box-shadow 150ms ease, background-color 150ms ease, border-color 150ms ease;
}
.hp-badge--cyan   { box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.12),  0 0 14px rgba(34, 211, 238, 0.18); }
.hp-badge--amber  { box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.12),  0 0 14px rgba(245, 158, 11, 0.18); }
.hp-badge--blue   { box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.12),  0 0 14px rgba(96, 165, 250, 0.18); }
.hp-badge--purple { box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.12),  0 0 14px rgba(168, 85, 247, 0.18); }
.hp-badge--red    { box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.12), 0 0 14px rgba(248, 113, 113, 0.18); }
.hp-badge--green  { box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.12),  0 0 14px rgba(74, 222, 128, 0.18); }
.hp-row:hover .hp-badge--cyan,   .hp-row:focus-visible .hp-badge--cyan   { box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.3),  0 0 20px rgba(34, 211, 238, 0.4); }
.hp-row:hover .hp-badge--amber,  .hp-row:focus-visible .hp-badge--amber  { box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.3),  0 0 20px rgba(245, 158, 11, 0.4); }
.hp-row:hover .hp-badge--blue,   .hp-row:focus-visible .hp-badge--blue   { box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.3),  0 0 20px rgba(96, 165, 250, 0.4); }
.hp-row:hover .hp-badge--purple, .hp-row:focus-visible .hp-badge--purple { box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.3),  0 0 20px rgba(168, 85, 247, 0.4); }
.hp-row:hover .hp-badge--red,    .hp-row:focus-visible .hp-badge--red    { box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.3), 0 0 20px rgba(248, 113, 113, 0.4); }
.hp-row:hover .hp-badge--green,  .hp-row:focus-visible .hp-badge--green  { box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.3),  0 0 20px rgba(74, 222, 128, 0.4); }

/* ── Theme swatches (Quick Access only) — hover glow + a ring around
   whichever swatch matches the CURRENTLY-applied theme, driven purely by
   the data-theme attribute setTheme() already sets on <html>. ─────────── */
.theme-swatch {
  border-radius: 0.625rem;
}
.theme-swatch:hover,
.theme-swatch:focus-visible {
  background: rgba(148, 163, 184, 0.12);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.18);
}
.theme-swatch:focus-visible {
  outline: 2px solid var(--accent, #22d3ee);
  outline-offset: -2px;
}
html[data-theme="elite"] [data-theme-btn="elite"],
html[data-theme="obsidian"] [data-theme-btn="obsidian"],
html[data-theme="midnight-gold"] [data-theme-btn="midnight-gold"],
html[data-theme="pearl"] [data-theme-btn="pearl"] {
  background: rgba(34, 211, 238, 0.1);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.45), 0 0 14px rgba(34, 211, 238, 0.25);
}
html[data-theme="elite"] [data-theme-btn="elite"] span,
html[data-theme="obsidian"] [data-theme-btn="obsidian"] span,
html[data-theme="midnight-gold"] [data-theme-btn="midnight-gold"] span,
html[data-theme="pearl"] [data-theme-btn="pearl"] span {
  color: #fff;
}

/* ── Notification rows — same card language, plus a read/unread state.
   A read notification stays in the list (see main.js's
   renderNotificationsList()/markNotificationRead()) but dims slightly and
   loses its hover lift, so the eye goes to what's still unread first. ─── */
.hp-notif-row:hover {
  background: rgba(148, 163, 184, 0.08);
}
.hp-notif-row.hp-notif-read {
  opacity: 0.6;
}
.hp-notif-row.hp-notif-read:hover {
  opacity: 0.85;
}
.hp-read-btn {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.25);
  font-size: 0.6875rem;
  transition: all 150ms ease;
}
.hp-read-btn:hover,
.hp-read-btn:focus-visible {
  color: #22d3ee;
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.3);
}

/* ── Drag handle — mobile-only grab area, first child of the sheet. ──── */
.hp-drag-handle {
  display: none;
}

/* ══════════════════════════════════════════════════════════════════════
   MOBILE: bottom sheet
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 767.98px) {
  .hp-dropdown {
    /* !important throughout: the notification panel and user menu each
       still carry their own Tailwind positioning/sizing classes in the
       HTML for the desktop dropdown (absolute right-0 top-full mt-2
       w-72 sm:w-80 max-h-96 / absolute right-0 mt-2 w-60 overflow-hidden)
       — every one of those is equal specificity to this single class
       selector, so without !important on each conflicting property the
       result depends on unpredictable load-order tie-breaks rather than
       this mobile override reliably winning. Confirmed necessary: without
       it the notification panel measured 388px wide (not full-bleed) and
       stopped short of the viewport bottom instead of behaving like a
       sheet at all. */
    position: fixed !important;
    inset: auto 0 0 0 !important;
    top: auto !important;
    right: auto !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 82dvh !important;
    display: flex !important;
    flex-direction: column;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    border-radius: 1.5rem 1.5rem 0 0 !important;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    z-index: 200; /* above .hp-scrim (199) */
    transform: translateY(100%);
    opacity: 1;
    transition: transform 280ms cubic-bezier(0.32, 0.72, 0, 1);
  }
  .hp-dropdown.menu-visible {
    transform: translateY(0);
  }

  .hp-drag-handle {
    display: flex;
    justify-content: center;
    padding: 0.625rem 0 0.375rem;
    flex-shrink: 0;
    touch-action: none;
    cursor: grab;
  }
  .hp-drag-handle span {
    width: 2.75rem;
    height: 0.25rem;
    border-radius: 9999px;
    background: rgba(148, 163, 184, 0.4);
  }

  /* Comfortable full-width spacing instead of the narrow anchored card's
     tighter padding. */
  .hp-row {
    padding: 1rem 1.25rem !important;
  }
  .hp-section-label,
  .hp-section-divider {
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
  }
  #themeSwatchesGrid {
    gap: 0.625rem !important;
  }
  .theme-swatch {
    padding: 0.625rem !important;
  }
  .hp-notif-row {
    padding: 1rem 1.25rem !important;
  }
}
