/**
 * Notification Center — Quiet Dignity
 *
 * "The best design is the one you don't notice." — Dieter Rams
 *
 * Notifications should inform without demanding attention.
 * A gentle tap on the shoulder, not a shout across the room.
 */

/* ========== Notification Bell ========== */

.notification-center {
  position: relative;
}

.notification-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-tertiary);
  cursor: pointer;
  transition:
    color var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.notification-bell:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.notification-bell:active {
  transform: scale(0.95);
}

.notification-bell:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.notification-bell svg {
  transition: transform var(--duration-fast) var(--ease-out);
}

.notification-bell:hover svg {
  transform: rotate(-8deg);
}

/* ========== Badge — Subtle Urgency ========== */

.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: var(--font-weight-bold);
  color: white;
  box-shadow: 0 0 8px var(--accent-dim);
  animation: badge-appear 0.3s var(--ease-spring);
}

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

@keyframes badge-appear {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  60% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ========== Panel — The Dropdown ========== */

.notification-panel {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  width: 380px;
  max-height: 500px;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06),
    0 20px 25px -5px rgba(0, 0, 0, 0.2);
  z-index: var(--z-dropdown);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transition:
    opacity var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

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

/* Top edge highlight */
.notification-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: var(--space-4);
  right: var(--space-4);
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.08),
    transparent
  );
  z-index: 1;
}

/* ========== Panel Header ========== */

.notification-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-dim);
  background: var(--bg-surface);
}

.notification-panel__title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.notification-panel__actions {
  display: flex;
  gap: var(--space-1);
}

.notification-panel__action {
  padding: var(--space-1) var(--space-2);
  background: transparent;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  color: var(--text-tertiary);
  cursor: pointer;
  transition:
    color var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out);
}

.notification-panel__action:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.notification-panel__action--primary {
  color: var(--accent-primary);
}

.notification-panel__action--primary:hover {
  background: var(--accent-dim);
  color: var(--accent-primary);
}

/* ========== Notification List ========== */

.notification-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Custom scrollbar */
.notification-list::-webkit-scrollbar {
  width: 6px;
}

.notification-list::-webkit-scrollbar-track {
  background: transparent;
}

.notification-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}

.notification-list::-webkit-scrollbar-thumb:hover {
  background: var(--border-bright);
}

/* ========== Notification Item ========== */

.notification-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-dim);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item:hover {
  background: var(--bg-hover);
}

.notification-item--unread {
  background: rgba(99, 102, 241, 0.04);
}

.notification-item--unread:hover {
  background: rgba(99, 102, 241, 0.08);
}

/* Level indicator */
.notification-item__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  margin-top: 2px;
}

.notification-item__icon--info {
  color: var(--accent-primary);
}

.notification-item__icon--success {
  color: var(--color-success);
}

.notification-item__icon--warning {
  color: var(--color-warning);
}

.notification-item__icon--error {
  color: var(--color-danger);
}

/* Content */
.notification-item__content {
  flex: 1;
  min-width: 0;
}

.notification-item__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.notification-item__title {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-item--unread .notification-item__title {
  font-weight: var(--font-weight-semibold);
}

.notification-item__time {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--text-tertiary);
}

.notification-item__message {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Unread dot */
.notification-item__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  margin-top: 8px;
  box-shadow: 0 0 8px var(--accent-dim);
}

/* ========== Empty State — Quiet Contentment ========== */

.notification-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.notification-empty__icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-4);
  color: var(--text-tertiary);
  font-size: var(--text-xl);
}

.notification-empty__title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

.notification-empty__desc {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  max-width: 200px;
  line-height: var(--line-height-relaxed);
}

/* ========== Responsive ========== */

@media (max-width: 480px) {
  .notification-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 60vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .notification-panel::after {
    content: '';
    position: absolute;
    top: var(--space-2);
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 4px;
    background: var(--border);
    border-radius: var(--radius-full);
  }

  .notification-panel__header {
    padding-top: var(--space-6);
  }
}

/* ========== Animation ========== */

@keyframes panel-enter {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.notification-panel[data-state="open"] {
  animation: panel-enter var(--duration-normal) var(--ease-smooth);
}

/* ========== Light Mode ========== */

[data-theme="light"] .notification-item--unread {
  background: rgba(99, 102, 241, 0.06);
}

[data-theme="light"] .notification-item--unread:hover {
  background: rgba(99, 102, 241, 0.1);
}

[data-theme="light"] .notification-panel::before {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 0, 0, 0.04),
    transparent
  );
}

/* ========== Reduced Motion ========== */

@media (prefers-reduced-motion: reduce) {
  .notification-panel,
  .notification-badge,
  .notification-bell svg {
    animation: none;
    transition: none;
  }
}
