/* Header chrome: badges, notification panel, dropdown overrides.
   Extracted from templates/base.html in Phase 1. */

/* ── Notification Badge ───────────────────────────────────────── */
.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, #F472B6 0%, #EC4899 100%);
  color: white;
  font-size: 0.6875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(244, 114, 182, 0.4);
  animation: notificationPulse 2s ease-in-out infinite;
}

.notification-badge.hidden { display: none; }

@keyframes notificationPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ── Points Badge ─────────────────────────────────────────────── */
.points-badge {
  margin-left: var(--space-2);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: white;
  font-size: 0.6875rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
  animation: pointsPulse 2s ease-in-out infinite;
}

.points-badge.hidden { display: none; }

@keyframes pointsPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ── Support Badge ────────────────────────────────────────────── */
.support-badge {
  margin-left: var(--space-2);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  color: white;
  font-size: 0.6875rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
  animation: supportPulse 2s ease-in-out infinite;
}

.support-badge.hidden { display: none; }

@keyframes supportPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ── Messages Badge ───────────────────────────────────────────── */
.messages-badge {
  margin-left: var(--space-2);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
  color: white;
  font-size: 0.6875rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
  animation: messagesPulse 2s ease-in-out infinite;
}

.messages-badge.hidden { display: none; }

@keyframes messagesPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ── Notification Dropdown ────────────────────────────────────── */
.notification-dropdown { position: relative; }

/* Ensure header allows dropdown overflow */
header,
header > div,
header nav,
header nav > div {
  overflow: visible !important;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 480px;
  background: white;
  border-radius: 16px;
  border: 1px solid #E2E8F0;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transform-origin: top right;
  transition: all 0.2s ease;
  z-index: 9999;
  display: flex;
  flex-direction: column;
}

.notification-dropdown.open .notification-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.notification-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #E2E8F0;
}

.notification-panel-title {
  font-weight: 600;
  color: #1E293B;
}

.notification-mark-read {
  font-size: 0.8125rem;
  color: #6366F1;
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 500;
  padding: 0;
}

.notification-mark-read:hover {
  color: #4F46E5;
  text-decoration: underline;
}

.notification-panel-content {
  flex: 1;
  overflow-y: auto;
  max-height: 320px;
}

.notification-panel-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  border-top: 1px solid #E2E8F0;
  color: #6366F1;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease;
}

.notification-panel-footer:hover { background: #F8FAFC; }

/* ── Notification Items in Panel ──────────────────────────────── */
.notification-item-mini {
  display: flex;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid #F1F5F9;
  cursor: pointer;
  transition: background 0.15s ease;
}

.notification-item-mini:hover { background: #F8FAFC; }
.notification-item-mini:last-child { border-bottom: none; }

.notification-item-mini.unread {
  background: linear-gradient(135deg, #EEF2FF 0%, #FAFBFF 100%);
}

.notification-item-mini.unread:hover {
  background: linear-gradient(135deg, #E0E7FF 0%, #F5F3FF 100%);
}

.notification-icon-mini {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  background: #F1F5F9;
  flex-shrink: 0;
}

.notification-item-mini.unread .notification-icon-mini {
  background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.notification-content-mini {
  flex: 1;
  min-width: 0;
}

.notification-title-mini {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1E293B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-time-mini {
  font-size: 0.75rem;
  color: #94A3B8;
  margin-top: 0.125rem;
}

/* ── Empty / Loading State ────────────────────────────────────── */
.notification-empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.notification-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94A3B8;
}

.notification-empty-text {
  color: #64748B;
  font-size: 0.875rem;
}

.notification-loading {
  padding: 2rem;
  display: flex;
  justify-content: center;
}

.notification-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid #E2E8F0;
  border-top-color: #6366F1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mobile Fullscreen Notification Panel ─────────────────────── */
@media (max-width: 640px) {
  .notification-panel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: 100% !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    z-index: 9999 !important;
    background: white !important;
    transform: translateY(100%) !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }

  .notification-dropdown.open .notification-panel {
    transform: translateY(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  .notification-panel-header {
    padding-top: calc(1rem + env(safe-area-inset-top, 0px)) !important;
  }

  .notification-panel-content {
    flex: 1 !important;
    max-height: none !important;
    overflow-y: auto !important;
  }

  .notification-panel-footer {
    padding-bottom: calc(0.875rem + env(safe-area-inset-bottom, 0px)) !important;
  }

  .notification-close-mobile {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: #F1F5F9;
    color: #1E293B;
    cursor: pointer;
  }
}

@media (min-width: 641px) {
  .notification-close-mobile { display: none !important; }
}

/* ── Bootstrap dropdown override ──────────────────────────────── */
.dropdown > .dropdown-menu {
  display: block !important;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
}
.dropdown.open > .dropdown-menu {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
}
