/**
 * Modern Notifications System - Sphere
 * Complete, polished notification UI with dropdown, badges, grouping
 */

/* Notification Bell in Header */
.notification-bell-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notification-bell-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-elevated);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: var(--text-primary);
}

.notification-bell-btn:hover {
  background: var(--surface-hover);
  transform: scale(1.05);
}

.notification-bell-btn.has-unread {
  animation: bell-ring 2s ease-in-out infinite;
}

@keyframes bell-ring {
  0%, 100% {
    transform: rotate(0deg);
  }
  10%, 30% {
    transform: rotate(-10deg);
  }
  20%, 40% {
    transform: rotate(10deg);
  }
}

.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

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

/* Notification Dropdown */
.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 420px;
  max-width: 90vw;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: all 0.2s ease;
  overflow: hidden;
}

.notification-dropdown.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.notification-dropdown-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notification-dropdown-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.notification-dropdown-actions {
  display: flex;
  gap: 8px;
}

.notification-action-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  background: var(--surface-elevated);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.notification-action-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.notification-dropdown-content {
  max-height: 500px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Notification Items */
.notification-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  gap: 12px;
}

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

.notification-item.unread {
  background: rgba(8, 145, 178, 0.05);
}

.notification-item.unread::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0891b2;
}

.notification-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-elevated);
}

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

.notification-text {
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.4;
  margin: 0 0 4px 0;
}

.notification-actor {
  font-weight: 600;
  color: var(--text-primary);
}

.notification-time {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.notification-icon {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}

.notification-icon-like {
  background: #ef4444;
  color: white;
}

.notification-icon-comment {
  background: #0891b2;
  color: white;
}

.notification-icon-share {
  background: #10b981;
  color: white;
}

.notification-icon-friend {
  background: #8b5cf6;
  color: white;
}

.notification-icon-live {
  background: #ec4899;
  color: white;
}

.notification-icon-tip {
  background: #f59e0b;
  color: white;
}

.notification-avatar-wrapper {
  position: relative;
}

.notification-item .delete-btn {
  opacity: 0;
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-elevated);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: var(--text-muted);
}

.notification-item:hover .delete-btn {
  opacity: 1;
}

.delete-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  transform: scale(1.1);
}

/* Empty State */
.notification-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.notification-empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  opacity: 0.3;
}

.notification-empty h4 {
  margin: 0 0 8px 0;
  font-size: 1.125rem;
  color: var(--text-primary);
  font-weight: 600;
}

.notification-empty p {
  margin: 0;
  font-size: 0.875rem;
}

/* Grouped Notifications */
.notification-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-elevated);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  margin-left: 4px;
}

/* Verification Badge in Notifications */
.notification-verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  vertical-align: middle;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .notification-dropdown {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    max-height: calc(100vh - 60px);
  }

  .notification-dropdown-content {
    max-height: calc(100vh - 140px);
  }

  .notification-item {
    padding: 14px 16px;
  }

  .notification-avatar {
    width: 40px;
    height: 40px;
  }
}

/* Loading State */
.notification-loading {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
}

.notification-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

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

/* View All Footer */
.notification-dropdown-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.notification-view-all-btn {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: var(--surface-elevated);
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.notification-view-all-btn:hover {
  background: var(--primary);
  color: white;
}
