/* ================================================
   NOTIFICATION BELL - Theme-aware styles
   Uses CSS custom properties from common.css
   ================================================ */

.notification-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.bell-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.bell-btn:hover {
  background: var(--bg-secondary);
}

.bell-icon {
  width: 22px;
  height: 22px;
  fill: var(--text-secondary);
  transition: fill 0.2s;
}

.bell-btn:hover .bell-icon {
  fill: var(--primary);
}

.bell-badge {
  position: absolute;
  top: 2px;
  right: 0;
  background: #e74c3c;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 4px;
  pointer-events: none;
}

/* Dropdown */
.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 200;
  overflow: hidden;
  animation: notifDropdownIn 0.15s ease-out;
}

[data-theme="dark"] .notification-dropdown {
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

@keyframes notifDropdownIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Tabs */
.notif-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.notif-tab {
  flex: 1;
  padding: 10px 0;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.notif-tab:hover {
  color: var(--text);
}

.notif-tab.active {
  color: var(--primary);
}

.notif-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}

.notif-tab-badge {
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 4px;
  margin-left: 4px;
  display: inline-block;
  vertical-align: middle;
}

/* Tab header */
.notif-tab-header {
  display: flex;
  justify-content: flex-end;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
}

.notif-mark-all {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.2s;
}

.notif-mark-all:hover {
  background: rgba(211,84,0,0.1);
}

/* Notification list */
.notif-list {
  max-height: 400px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.notif-list::-webkit-scrollbar {
  width: 4px;
}

.notif-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* Notification item */
.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item:hover {
  background: rgba(255,255,255,0.03);
}

.notif-item.unread {
  background: rgba(211,84,0,0.06);
}

.notif-item.unread:hover {
  background: rgba(211,84,0,0.1);
}

.notif-item-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.notif-item-content {
  flex: 1;
  min-width: 0;
}

.notif-item-title {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-item-body {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-item-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.notif-item .unread-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  align-self: center;
}

/* Load more / View all */
.notif-view-all {
  display: block;
  width: 100%;
  padding: 10px;
  background: none;
  border-top: 1px solid var(--border);
  color: var(--primary);
  font-size: 13px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s;
}

.notif-view-all:hover {
  background: rgba(211,84,0,0.06);
}

/* States */
.notif-loading,
.notif-empty,
.notif-error {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.notif-error-retry {
  margin-top: 8px;
  background: none;
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

/* Mobile: bell in header next to hamburger */
@media (max-width: 767px) {
  #notifBellContainer {
    margin-right: 6px !important;
    margin-left: auto;
  }

  /* Mobile dropdown: full-screen overlay style */
  .notification-dropdown.open {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    border: none;
    z-index: 300;
    display: flex !important;
    flex-direction: column;
    animation: notifSlideUp 0.2s ease-out;
  }

  @keyframes notifSlideUp {
    from { opacity: 0; transform: translateY(100%); }
    to { opacity: 1; transform: translateY(0); }
  }

  /* Mobile header inside dropdown */
  .notif-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  .notif-mobile-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
  }

  .notif-mobile-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .notif-mobile-close:hover {
    background: var(--border);
  }

  .notification-dropdown.open .notif-tabs {
    flex-shrink: 0;
  }

  .notification-dropdown.open .notif-tab {
    padding: 12px 0;
    font-size: 14px;
  }

  .notification-dropdown.open .notif-tab-header {
    flex-shrink: 0;
  }

  .notification-dropdown.open .notif-list {
    flex: 1;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .notification-dropdown.open .notif-item {
    padding: 12px 16px;
    gap: 12px;
  }

  .notification-dropdown.open .notif-item-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .notification-dropdown.open .notif-item-title {
    font-size: 14px;
  }

  .notification-dropdown.open .notif-item-body {
    font-size: 13px;
  }

  .notification-dropdown.open .notif-item-time {
    font-size: 12px;
  }

  .notification-dropdown.open .notif-view-all {
    flex-shrink: 0;
    padding: 14px;
    font-size: 14px;
  }

  .notification-dropdown.open .notif-loading,
  .notification-dropdown.open .notif-empty,
  .notification-dropdown.open .notif-error {
    padding: 48px 16px;
    font-size: 14px;
  }
}

/* Desktop: hide mobile header, normal dropdown */
@media (min-width: 768px) {
  .notif-mobile-header {
    display: none !important;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .bell-btn,
  .bell-icon,
  .notif-item,
  .notif-tab,
  .notif-mark-all,
  .notif-load-more {
    transition: none;
  }
  .notification-dropdown {
    animation: none;
  }
}
