/**
 * ATP.ai Notification System CSS
 * 
 * Complete styling for in-app notification system including:
 * - Bell icon with unread badge
 * - Dropdown panel with notification list
 * - Notification types (follower, reply, inquiry, message, reminder, system)
 * - Mark as read/unread functionality
 * - Empty state
 * - Loading state
 * - Responsive design
 * - Dark mode support
 * - Animations
 */

/* ============================================
   NOTIFICATION BELL ICON
   ============================================ */

.notification-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  border-radius: var(--border-radius-md, 8px);
  cursor: pointer;
  transition: background 0.2s ease;
  color: var(--color-text-primary, #1a1a1a);
}

.notification-bell:hover {
  background: var(--color-background-secondary, #f8f9fa);
}

.notification-bell.active {
  background: var(--color-primary-light, rgba(80, 102, 120, 0.1));
  color: var(--color-primary, #506678);
}

.notification-bell__icon {
  width: 24px;
  height: 24px;
}

/* Unread badge */
.notification-bell__badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--color-danger, #e76f51);
  color: #ffffff;
  font-size: var(--font-size-xs, 0.625rem);
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(231, 111, 81, 0.4);
  animation: popIn 0.3s ease-out;
}

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

/* Bell ring animation when new notification arrives */
@keyframes bellRing {
  0%,
  100% {
    transform: rotate(0deg);
  }
  10%,
  30% {
    transform: rotate(-10deg);
  }
  20%,
  40% {
    transform: rotate(10deg);
  }
}

.notification-bell--ringing .notification-bell__icon {
  animation: bellRing 0.5s ease-in-out;
}

/* ============================================
   NOTIFICATION DROPDOWN
   ============================================ */

.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 400px;
  max-height: 600px;
  background: var(--color-background-tertiary, #ffffff);
  border-radius: var(--border-radius-lg, 12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  z-index: 1000;
  animation: dropdownSlideIn 0.2s ease-out;
  display: none;
}

.notification-dropdown.active {
  display: flex;
  flex-direction: column;
}

/* ============================================
   DROPDOWN HEADER
   ============================================ */

.notification-dropdown__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md, 1rem) var(--spacing-lg, 1.5rem);
  border-bottom: 1px solid var(--color-border-light, #e0e0e0);
  background: var(--color-background-secondary, #f8f9fa);
}

.notification-dropdown__title {
  font-size: var(--font-size-lg, 1.125rem);
  font-weight: 700;
  color: var(--color-text-primary, #1a1a1a);
}

.notification-dropdown__actions {
  display: flex;
  gap: var(--spacing-sm, 0.75rem);
}

.notification-dropdown__action {
  padding: var(--spacing-xs, 0.5rem) var(--spacing-sm, 0.75rem);
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 600;
  color: var(--color-primary, #506678);
  background: transparent;
  border: none;
  border-radius: var(--border-radius-sm, 6px);
  cursor: pointer;
  transition: background 0.2s ease;
}

.notification-dropdown__action:hover {
  background: var(--color-primary-light, rgba(80, 102, 120, 0.1));
}

/* ============================================
   NOTIFICATION LIST
   ============================================ */

.notification-list {
  overflow-y: auto;
  max-height: 480px;
  flex: 1;
}

.notification-list::-webkit-scrollbar {
  width: 8px;
}

.notification-list::-webkit-scrollbar-track {
  background: var(--color-background-secondary, #f8f9fa);
}

.notification-list::-webkit-scrollbar-thumb {
  background: var(--color-border-light, #e0e0e0);
  border-radius: 4px;
}

.notification-list::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-tertiary, #999999);
}

/* ============================================
   NOTIFICATION ITEM
   ============================================ */

.notification-item {
  display: flex;
  gap: var(--spacing-md, 1rem);
  padding: var(--spacing-md, 1rem) var(--spacing-lg, 1.5rem);
  border-bottom: 1px solid var(--color-border-light, #e0e0e0);
  cursor: pointer;
  transition: background 0.2s ease;
  position: relative;
}

.notification-item:hover {
  background: var(--color-background-secondary, #f8f9fa);
}

.notification-item.unread {
  background: var(--color-primary-light, rgba(80, 102, 120, 0.05));
}

.notification-item.unread::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--color-primary, #506678);
}

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

/* ============================================
   NOTIFICATION ICON
   ============================================ */

.notification-item__icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

/* Type-specific icons */
.notification-item--follower .notification-item__icon {
  background: linear-gradient(
    135deg,
    rgba(147, 51, 234, 0.1) 0%,
    rgba(147, 51, 234, 0.05) 100%
  );
  color: var(--color-purple, #9333ea);
}

.notification-item--reply .notification-item__icon {
  background: linear-gradient(
    135deg,
    rgba(46, 196, 182, 0.1) 0%,
    rgba(46, 196, 182, 0.05) 100%
  );
  color: var(--color-info, #2ec4b6);
}

.notification-item--inquiry .notification-item__icon {
  background: linear-gradient(
    135deg,
    rgba(255, 159, 28, 0.1) 0%,
    rgba(255, 159, 28, 0.05) 100%
  );
  color: var(--color-warning, #ff9f1c);
}

.notification-item--message .notification-item__icon {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.1) 0%,
    rgba(59, 130, 246, 0.05) 100%
  );
  color: var(--color-blue, #3b82f6);
}

.notification-item--reminder .notification-item__icon {
  background: linear-gradient(
    135deg,
    rgba(231, 111, 81, 0.1) 0%,
    rgba(231, 111, 81, 0.05) 100%
  );
  color: var(--color-danger, #e76f51);
}

.notification-item--system .notification-item__icon {
  background: linear-gradient(
    135deg,
    rgba(80, 102, 120, 0.1) 0%,
    rgba(80, 102, 120, 0.05) 100%
  );
  color: var(--color-primary, #506678);
}

/* ============================================
   NOTIFICATION CONTENT
   ============================================ */

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

.notification-item__title {
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 600;
  color: var(--color-text-primary, #1a1a1a);
  margin-bottom: var(--spacing-xs, 0.5rem);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notification-item__message {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #666666);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notification-item__time {
  font-size: var(--font-size-xs, 0.75rem);
  color: var(--color-text-tertiary, #999999);
  margin-top: var(--spacing-xs, 0.5rem);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs, 0.5rem);
}

/* ============================================
   NOTIFICATION ACTIONS
   ============================================ */

.notification-item__actions {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs, 0.5rem);
  align-items: flex-end;
}

.notification-item__mark {
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary, #999999);
  transition: all 0.2s ease;
}

.notification-item__mark:hover {
  background: var(--color-background-secondary, #f8f9fa);
  color: var(--color-primary, #506678);
}

.notification-item__mark svg {
  width: 16px;
  height: 16px;
}

/* ============================================
   DROPDOWN FOOTER
   ============================================ */

.notification-dropdown__footer {
  padding: var(--spacing-md, 1rem) var(--spacing-lg, 1.5rem);
  border-top: 1px solid var(--color-border-light, #e0e0e0);
  background: var(--color-background-secondary, #f8f9fa);
  text-align: center;
}

.notification-dropdown__view-all {
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 600;
  color: var(--color-primary, #506678);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs, 0.5rem);
  padding: var(--spacing-xs, 0.5rem) var(--spacing-sm, 0.75rem);
  border-radius: var(--border-radius-sm, 6px);
  transition: background 0.2s ease;
}

.notification-dropdown__view-all:hover {
  background: var(--color-primary-light, rgba(80, 102, 120, 0.1));
}

/* ============================================
   EMPTY STATE
   ============================================ */

.notification-empty {
  padding: var(--spacing-3xl, 4rem) var(--spacing-lg, 1.5rem);
  text-align: center;
}

.notification-empty__icon {
  font-size: 3rem;
  margin-bottom: var(--spacing-md, 1rem);
  opacity: 0.3;
}

.notification-empty__title {
  font-size: var(--font-size-md, 1rem);
  font-weight: 600;
  color: var(--color-text-primary, #1a1a1a);
  margin-bottom: var(--spacing-xs, 0.5rem);
}

.notification-empty__message {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #666666);
}

/* ============================================
   LOADING STATE
   ============================================ */

.notification-loading {
  padding: var(--spacing-xl, 2rem);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md, 1rem);
  color: var(--color-text-secondary, #666666);
}

.notification-loading__spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(80, 102, 120, 0.2);
  border-top-color: var(--color-primary, #506678);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes dropdownSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
  .notification-dropdown {
    width: calc(100vw - 2rem);
    max-width: 400px;
    right: 1rem;
  }
}

@media (max-width: 480px) {
  .notification-dropdown {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    max-height: 80vh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    animation: slideUpMobile 0.3s ease-out;
  }

  .notification-dropdown__header,
  .notification-dropdown__footer {
    padding: var(--spacing-md, 1rem);
  }

  .notification-item {
    padding: var(--spacing-md, 1rem);
  }

  .notification-empty {
    padding: var(--spacing-2xl, 3rem) var(--spacing-md, 1rem);
  }
}

@keyframes slideUpMobile {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   DARK MODE
   ============================================ */

[data-theme="dark"] .notification-bell {
  color: var(--color-text-primary-dark, #f5f5f5);
}

[data-theme="dark"] .notification-bell:hover {
  background: var(--color-background-secondary-dark, #1e1e1e);
}

[data-theme="dark"] .notification-bell.active {
  background: var(--color-primary-light, rgba(80, 102, 120, 0.2));
}

[data-theme="dark"] .notification-dropdown {
  background: var(--color-background-tertiary-dark, #2a2a2a);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .notification-dropdown__header,
[data-theme="dark"] .notification-dropdown__footer {
  background: var(--color-background-secondary-dark, #1e1e1e);
  border-color: var(--color-border-dark, #333333);
}

[data-theme="dark"] .notification-dropdown__title {
  color: var(--color-text-primary-dark, #f5f5f5);
}

[data-theme="dark"] .notification-dropdown__action:hover {
  background: var(--color-primary-light, rgba(80, 102, 120, 0.3));
}

[data-theme="dark"] .notification-item {
  border-color: var(--color-border-dark, #333333);
}

[data-theme="dark"] .notification-item:hover {
  background: var(--color-background-secondary-dark, #1e1e1e);
}

[data-theme="dark"] .notification-item.unread {
  background: var(--color-primary-light, rgba(80, 102, 120, 0.15));
}

[data-theme="dark"] .notification-item__title {
  color: var(--color-text-primary-dark, #f5f5f5);
}

[data-theme="dark"] .notification-item__message {
  color: var(--color-text-secondary-dark, #b0b0b0);
}

[data-theme="dark"] .notification-item__time {
  color: var(--color-text-tertiary-dark, #888888);
}

[data-theme="dark"] .notification-item__mark {
  color: var(--color-text-tertiary-dark, #888888);
}

[data-theme="dark"] .notification-item__mark:hover {
  background: var(--color-background-secondary-dark, #1e1e1e);
  color: var(--color-primary-light, rgba(80, 102, 120, 0.9));
}

[data-theme="dark"] .notification-empty__title {
  color: var(--color-text-primary-dark, #f5f5f5);
}

[data-theme="dark"] .notification-empty__message {
  color: var(--color-text-secondary-dark, #b0b0b0);
}

[data-theme="dark"] .notification-list::-webkit-scrollbar-track {
  background: var(--color-background-secondary-dark, #1e1e1e);
}

[data-theme="dark"] .notification-list::-webkit-scrollbar-thumb {
  background: var(--color-border-dark, #444444);
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.notification-bell:focus {
  outline: 2px solid var(--color-primary, #506678);
  outline-offset: 2px;
}

.notification-item:focus {
  outline: 2px solid var(--color-primary, #506678);
  outline-offset: -2px;
}

.notification-dropdown__action:focus,
.notification-dropdown__view-all:focus,
.notification-item__mark:focus {
  outline: 2px solid var(--color-primary, #506678);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .notification-bell__badge,
  .notification-dropdown,
  .notification-item,
  .notification-item__mark,
  .notification-dropdown__action,
  .notification-dropdown__view-all {
    animation: none;
    transition: none;
  }

  .notification-bell--ringing .notification-bell__icon {
    animation: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .notification-dropdown {
    border: 2px solid currentColor;
  }

  .notification-item.unread::before {
    width: 5px;
  }

  .notification-bell__badge {
    border: 2px solid #ffffff;
  }
}
