/* Notifications CSS */

/* --- Notification Bell & Badge --- */
#notification-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color var(--transition-fast) ease, background var(--transition-fast) ease;
}

#notification-bell:hover {
  color: var(--text-primary);
}

.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  height: 16px;
  min-width: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-primary);
  box-shadow: var(--shadow-sm);
  transform: scale(0);
  transition: transform var(--transition-normal) cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.notif-badge.has-unread {
  transform: scale(1);
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 0 rgba(234, 101, 0, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(234, 101, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(234, 101, 0, 0); }
}

/* --- Backdrop --- */
.notif-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10009;
  background: transparent;
  display: none;
}

.notif-backdrop.active {
  display: block;
}

/* --- Notification Panel --- */
#notification-panel {
  position: fixed;
  top: 56px;
  right: 16px;
  width: 380px;
  max-height: 480px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 10010;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-10px) scale(0.98);
  transition: opacity 0.2s ease,
              transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
              visibility 0.2s ease;
  transform-origin: top right;
  overflow: hidden;
  font-family: 'Outfit', sans-serif;
}

#notification-panel.active {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateY(0) scale(1) !important;
}

/* --- Panel Header --- */
.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

[data-theme="light"] .notif-panel-header,
[data-theme="cream"] .notif-panel-header {
  background: var(--bg-secondary);
}

[data-theme="stone"] .notif-panel-header {
  background: #2A160A;
}

.notif-panel-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.notif-mark-all {
  background: transparent;
  border: none;
  color: var(--accent, #ea6500);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast) ease, color var(--transition-fast) ease;
  font-family: inherit;
}

.notif-mark-all:hover {
  background: rgba(234, 101, 0, 0.1);
}

/* --- Notification List --- */
.notif-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.notif-list::-webkit-scrollbar {
  width: 6px;
}

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

.notif-list::-webkit-scrollbar-thumb {
  background-color: var(--border-strong);
  border-radius: 10px;
}

/* --- Date Group --- */
.notif-date-group {
  padding: 12px 20px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* --- Notification Item --- */
.notif-item {
  display: flex;
  align-items: flex-start;
  padding: 16px 20px;
  gap: 16px;
  text-decoration: none;
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast) ease;
  position: relative;
  cursor: pointer;
}

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

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

.notif-item.unread {
  background: rgba(234, 101, 0, 0.04);
}

[data-theme="light"] .notif-item.unread,
[data-theme="cream"] .notif-item.unread {
  background: rgba(234, 101, 0, 0.08);
}

[data-theme="stone"] .notif-item.unread {
  background: rgba(217, 122, 70, 0.15);
}

.notif-item.unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}

/* --- Icons --- */
.notif-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/* --- Content --- */
.notif-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.notif-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
}

.notif-message {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-item.expanded .notif-message {
  display: block;
  white-space: pre-wrap;
}

/* --- Time --- */
.notif-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

/* --- Empty State --- */
.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
  gap: 12px;
}

.notif-empty-icon {
  font-size: 2.5rem;
  opacity: 0.4;
  margin-bottom: 8px;
}

.notif-empty-text {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.notif-empty-sub {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* --- Mobile Responsive --- */
@media (max-width: 600px) {
  #notification-panel {
    position: fixed;
    top: 60px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100vh - 80px);
    transform-origin: top;
  }
}
