/* ============================================================================
   Admin Header Notifications — app-wide
   ----------------------------------------------------------------------------
   Styles for the shared Deadlines + Recent Activity badges and their dropdown
   panels (resources/views/components/header-notifications.blade.php).
   Loaded by BOTH admin layouts:
     - layouts/admin.blade.php          (module pages, white UIKit navbar)
     - admin/partials/head.blade.php    (dashboard "software-header")
   Behavior lives in /assets/js/admin-header.js.

   Design language: "Dispatch" tokens (see newsletter-shell.css) — ink text,
   indigo accent, paper tints, soft layered shadows. Both headers are light,
   so the buttons are ink-on-light with tinted hovers.

   All selectors are custom classes (no UIKit overrides), so the double-loaded
   uikit.min.css cannot shadow them.
   ============================================================================ */

.header-notifications {
  --hn-ink: #1e293b;
  --hn-ink-soft: #334155;
  --hn-muted: #64748b;
  --hn-faint: #94a3b8;
  --hn-line: #e6eaf1;
  --hn-surface: #ffffff;
  --hn-surface-2: #f6f8fc;
  --hn-indigo: #667eea;
  --hn-indigo-deep: #5461c8;
  --hn-indigo-tint: #eef0fd;
  --hn-green: #0ea472;
  --hn-green-tint: #e5f5ee;
  --hn-red: #dc4a4f;
  --hn-shadow-menu: 0 2px 6px rgba(30, 41, 59, 0.07), 0 18px 40px -14px rgba(30, 41, 59, 0.28);

  display: flex;
  align-items: center;
  gap: 4px;
}

/* ---------------------------------------------------------------------------
   Badge buttons
   --------------------------------------------------------------------------- */

.deadlines-badge-btn-container,
.activity-badge-btn-container {
  position: relative;
  display: inline-flex;
}

.deadlines-badge-btn,
.activity-badge-btn {
  appearance: none;
  background: none;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: var(--hn-ink-soft, #334155);
  cursor: pointer;
  position: relative;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.deadlines-badge-btn:hover,
.activity-badge-btn:hover,
.deadlines-badge-btn-container.open .deadlines-badge-btn,
.activity-badge-btn-container.open .activity-badge-btn {
  background: var(--hn-indigo-tint, #eef0fd);
  color: var(--hn-indigo-deep, #5461c8);
}

.deadlines-badge-btn:focus-visible,
.activity-badge-btn:focus-visible {
  outline: 2px solid var(--hn-indigo, #667eea);
  outline-offset: 2px;
}

.deadlines-count-badge,
.activity-count-badge {
  position: absolute;
  top: 2px;
  right: 1px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--hn-surface, #fff);
}

.deadlines-count-badge {
  background: var(--hn-red, #dc4a4f);
}

.activity-count-badge {
  background: var(--hn-green, #0ea472);
}

/* ---------------------------------------------------------------------------
   Dropdown panels (shared shell)
   --------------------------------------------------------------------------- */

.deadlines-menu,
.activity-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--hn-surface, #fff);
  border: 1px solid var(--hn-line, #e6eaf1);
  border-radius: 14px;
  box-shadow: var(--hn-shadow-menu);
  z-index: 1150;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  overflow: hidden;
  text-align: left;
}

.deadlines-menu {
  min-width: 330px;
  max-width: 390px;
}

.activity-menu {
  min-width: 370px;
  max-width: 430px;
}

.deadlines-badge-btn-container.open .deadlines-menu,
.activity-badge-btn-container.open .activity-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.deadlines-menu-header,
.activity-menu-header {
  padding: 13px 16px;
  background: var(--hn-surface-2, #f6f8fc);
  border-bottom: 1px solid var(--hn-line, #e6eaf1);
}

.activity-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.deadlines-menu-header h3,
.activity-menu-header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--hn-ink, #1e293b);
  display: flex;
  align-items: center;
  gap: 8px;
}

.deadlines-menu-header h3 i,
.activity-menu-header h3 i {
  color: var(--hn-indigo, #667eea);
  font-size: 13px;
}

.activity-mark-seen-btn {
  appearance: none;
  background: none;
  border: none;
  color: var(--hn-green, #0ea472);
  cursor: pointer;
  padding: 5px 7px;
  border-radius: 7px;
  font-size: 14px;
  line-height: 1;
  transition: background-color 0.15s ease;
}

.activity-mark-seen-btn:hover {
  background: var(--hn-green-tint, #e5f5ee);
}

/* The markup nests two elements with the same *-menu-content class: the outer
   one is the scroll region, the inner (#…MenuContent) holds the items. Scope
   padding to the inner so it isn't applied twice. */
.deadlines-menu-content,
.activity-menu-content {
  padding: 0;
  max-height: min(52vh, 380px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.deadlines-menu-content .deadlines-menu-content,
.activity-menu-content .activity-menu-content {
  max-height: none;
  overflow: visible;
  padding: 10px;
}

.deadlines-menu-empty,
.activity-menu-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--hn-muted, #64748b);
  padding: 26px 8px;
}

.deadlines-menu-empty i,
.activity-menu-empty i {
  color: var(--hn-green, #0ea472);
  font-size: 15px;
}

/* ---------------------------------------------------------------------------
   Deadlines panel
   --------------------------------------------------------------------------- */

.deadline-group-header {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--hn-faint, #94a3b8);
  margin: 4px 0 6px;
  padding: 4px 6px 0;
}

.deadlines-menu-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--hn-surface, #fff);
  border: 1px solid var(--hn-line, #e6eaf1);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.deadlines-menu-item:hover {
  background: var(--hn-indigo-tint, #eef0fd);
  border-color: rgba(102, 126, 234, 0.35);
}

.deadlines-menu-item:last-child {
  margin-bottom: 0;
}

.deadlines-menu-item .deadline-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--hn-ink, #1e293b);
  line-height: 1.35;
}

.deadline-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 11.5px;
  color: var(--hn-muted, #64748b);
}

.deadline-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--hn-indigo-tint, #eef0fd);
  color: var(--hn-indigo-deep, #5461c8);
  width: fit-content;
}

.deadline-type-badge.deadline-type-compliance {
  background: var(--hn-green-tint, #e5f5ee);
  color: #0c7d58;
}

.deadline-type-badge.deadline-type-board {
  background: #fbeceb;
  color: #b93a3f;
}

.deadline-days {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--hn-muted, #64748b);
}

.deadline-days.deadline-urgent {
  color: var(--hn-red, #dc4a4f);
  font-weight: 700;
}

.deadline-days.deadline-warning {
  color: #b7791f;
  font-weight: 700;
}

.deadline-date {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--hn-faint, #94a3b8);
}

.deadlines-menu-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--hn-line, #e6eaf1);
  background: var(--hn-surface-2, #f6f8fc);
  display: flex;
  justify-content: center;
  gap: 18px;
}

.deadlines-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--hn-indigo-deep, #5461c8);
  text-decoration: none;
}

.deadlines-footer-link:hover {
  color: var(--hn-indigo, #667eea);
  text-decoration: none;
}

/* ---------------------------------------------------------------------------
   Activity panel
   --------------------------------------------------------------------------- */

.activity-menu-filters {
  padding: 10px 12px;
  border-bottom: 1px solid var(--hn-line, #e6eaf1);
}

.activity-filter-group {
  flex: 1;
}

.activity-filter-select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--hn-line, #e6eaf1);
  border-radius: 8px;
  font-size: 12.5px;
  background: var(--hn-surface, #fff);
  color: var(--hn-ink-soft, #334155);
  cursor: pointer;
}

.activity-filter-select:focus {
  outline: none;
  border-color: var(--hn-indigo, #667eea);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.activity-date-group-header {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--hn-faint, #94a3b8);
  margin: 10px 0 6px;
  padding: 0 6px;
}

.activity-date-group-header:first-child {
  margin-top: 2px;
}

.activity-menu-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--hn-indigo-tint, #eef0fd);
  border: 1px solid rgba(102, 126, 234, 0.22);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  color: inherit;
}

.activity-menu-item:hover {
  border-color: rgba(102, 126, 234, 0.45);
}

.activity-menu-item.is-seen {
  background: var(--hn-surface, #fff);
  border-color: var(--hn-line, #e6eaf1);
}

.activity-menu-item.is-seen:hover {
  background: var(--hn-surface-2, #f6f8fc);
}

.activity-menu-item:last-child {
  margin-bottom: 0;
}

.activity-menu-item .activity-message,
.activity-menu-item:not(.is-seen) .activity-message {
  font-size: 13px;
  font-weight: 600;
  color: var(--hn-ink, #1e293b);
  line-height: 1.4;
}

.activity-menu-item.is-seen .activity-message {
  font-weight: 500;
  color: var(--hn-muted, #64748b);
}

.activity-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 11px;
  color: var(--hn-muted, #64748b);
}

.activity-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  width: fit-content;
}

.activity-type-badge.activity-type-form {
  background: #e7effc;
  color: #2458b3;
}

.activity-type-badge.activity-type-donation {
  background: var(--hn-green-tint, #e5f5ee);
  color: #0c7d58;
}

.activity-type-badge.activity-type-petition {
  background: var(--hn-indigo-tint, #eef0fd);
  color: var(--hn-indigo-deep, #5461c8);
}

.activity-type-badge.activity-type-meetpoll {
  background: #fbf0d6;
  color: #96650f;
}

.activity-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--hn-faint, #94a3b8);
}

.activity-optin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--hn-green-tint, #e5f5ee);
  color: var(--hn-green, #0ea472);
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 5px;
  margin-left: 6px;
  vertical-align: middle;
}

.activity-mark-item-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  appearance: none;
  background: none;
  border: none;
  color: var(--hn-faint, #94a3b8);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 12px;
  opacity: 0;
  z-index: 10;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.activity-menu-item:hover .activity-mark-item-btn {
  opacity: 1;
}

.activity-mark-item-btn:hover {
  background: var(--hn-green-tint, #e5f5ee);
  color: var(--hn-green, #0ea472);
}

.activity-load-more {
  padding: 10px 12px;
  text-align: center;
  border-top: 1px solid var(--hn-line, #e6eaf1);
}

.activity-load-more-btn {
  appearance: none;
  background: var(--hn-surface, #fff);
  border: 1px solid var(--hn-line, #e6eaf1);
  color: var(--hn-indigo-deep, #5461c8);
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.activity-load-more-btn:hover {
  background: var(--hn-indigo-tint, #eef0fd);
  border-color: rgba(102, 126, 234, 0.35);
}

.activity-load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------------------------------------------------------------------------
   Module navbar context: keep the badges tight next to the hamburger
   --------------------------------------------------------------------------- */

.uk-navbar-right .header-notifications {
  margin-right: 6px;
}

/* ---------------------------------------------------------------------------
   Mobile: panels become fixed sheets under the header + dim overlay
   --------------------------------------------------------------------------- */

@media (max-width: 640px) {

  .deadlines-badge-btn-container.open::before,
  .activity-badge-btn-container.open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(30, 41, 59, 0.35);
    z-index: 1140;
  }

  .deadlines-menu,
  .activity-menu {
    position: fixed;
    top: 68px;
    left: 10px;
    right: 10px;
    min-width: 0;
    max-width: none;
    z-index: 1150;
  }

  .deadlines-menu-content,
  .activity-menu-content {
    max-height: min(62vh, 460px);
  }
}

/* Touch devices: no hover-revealed controls */
@media (hover: none) and (pointer: coarse) {
  .activity-mark-item-btn {
    opacity: 1;
  }
}
