/* 通知中心样式 */

.notification-bell[hidden],
.notification-panel[hidden] {
  display: none !important;
}

/* 通知按钮 */
.notification-bell {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 1000;
}

.notification-bell__button {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: white;
  border: 2px solid #e5e7eb;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.notification-bell__button:hover {
  border-color: #2563eb;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.2);
}

.notification-bell__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #ef4444;
  color: white;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* 通知面板 */
.notification-panel {
  position: fixed;
  top: 5rem;
  right: 2rem;
  width: 400px;
  max-height: 600px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  z-index: 999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notification-panel__header {
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notification-panel__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #111827;
}

.notification-panel__actions {
  display: flex;
  gap: 0.5rem;
}

.notification-panel__action-btn {
  padding: 0.25rem 0.75rem;
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
}

.notification-panel__action-btn:hover {
  background: #f9fafb;
  border-color: #2563eb;
  color: #2563eb;
}

.notification-panel__tabs {
  display: flex;
  padding: 0 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.notification-tab {
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 0.9rem;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
}

.notification-tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.notification-panel__list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.notification-item {
  padding: 1rem;
  margin-bottom: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.notification-item:hover {
  background: #f9fafb;
}

.notification-item--unread {
  background: #eff6ff;
}

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

.notification-item__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.notification-item__icon {
  font-size: 1.5rem;
  margin-right: 0.75rem;
}

.notification-item__content {
  flex: 1;
}

.notification-item__title {
  font-weight: 600;
  color: #111827;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.notification-item__desc {
  font-size: 0.85rem;
  color: #6b7280;
  line-height: 1.5;
}

.notification-item__time {
  font-size: 0.75rem;
  color: #9ca3af;
  white-space: nowrap;
}

.notification-item__type {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  background: #f3f4f6;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.5rem;
}

.notification-item__type--opportunity {
  background: #fef3c7;
  color: #92400e;
}

.notification-item__type--catalyst {
  background: #d1fae5;
  color: #065f46;
}

.notification-item__type--alert {
  background: #fee2e2;
  color: #991b1b;
}

.notification-item__type--tracking {
  background: #dbeafe;
  color: #1e40af;
}

/* 空状态 */
.notification-empty {
  padding: 3rem 1.5rem;
  text-align: center;
}

.notification-empty__icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.notification-empty__text {
  color: #9ca3af;
  font-size: 0.9rem;
}

/* 重要消息弹出提醒 */
.notification-popup-stack {
  position: fixed;
  top: 6.25rem;
  right: 2rem;
  width: min(420px, calc(100vw - 2rem));
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.notification-popup {
  position: relative;
  overflow: hidden;
  padding: 1rem 1.1rem 1rem;
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-left: 4px solid #2563eb;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.18);
  color: #111827;
  cursor: pointer;
  pointer-events: auto;
  transform-origin: top right;
  animation: notification-popup-in 0.22s ease-out;
}

.notification-popup:hover {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
}

.notification-popup:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.notification-popup.is-dismissing {
  animation: notification-popup-out 0.18s ease-in forwards;
}

.notification-popup--opportunity {
  border-left-color: #f59e0b;
}

.notification-popup--catalyst {
  border-left-color: #10b981;
}

.notification-popup--alert {
  border-left-color: #ef4444;
}

.notification-popup--major {
  animation:
    notification-popup-in 0.22s ease-out,
    notification-major-pulse 1.15s ease-in-out 0.25s 8;
}

.notification-popup--major .notification-popup__icon {
  animation: notification-major-icon 0.9s ease-in-out 0.25s 8;
}

.notification-popup__close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: #f3f4f6;
  color: #64748b;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.notification-popup__close:hover {
  background: #e5e7eb;
  color: #111827;
}

.notification-popup__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-right: 2rem;
  margin-bottom: 0.55rem;
}

.notification-popup__icon {
  font-size: 1.25rem;
  line-height: 1;
}

.notification-popup__type {
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.75rem;
  font-weight: 700;
}

.notification-popup__type--opportunity {
  background: #fef3c7;
  color: #92400e;
}

.notification-popup__type--catalyst {
  background: #d1fae5;
  color: #065f46;
}

.notification-popup__type--alert {
  background: #fee2e2;
  color: #991b1b;
}

.notification-popup__time {
  margin-left: auto;
  color: #94a3b8;
  font-size: 0.75rem;
  white-space: nowrap;
}

.notification-popup__title {
  display: block;
  margin-bottom: 0.4rem;
  padding-right: 1.75rem;
  font-size: 0.95rem;
  line-height: 1.35;
}

.notification-popup__desc {
  margin: 0;
  color: #475569;
  font-size: 0.86rem;
  line-height: 1.55;
}

.notification-popup__action {
  display: inline-flex;
  margin-top: 0.7rem;
  color: #2563eb;
  font-size: 0.82rem;
  font-weight: 700;
}

.notification-popup__progress {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: #2563eb;
  transform-origin: left center;
  animation: notification-popup-progress var(--notification-popup-duration, 30000ms) linear forwards;
}

/* 响应式 */
@media (max-width: 768px) {
  .notification-bell {
    top: 1rem;
    right: 1rem;
  }

  .notification-panel {
    top: 4rem;
    right: 1rem;
    left: 1rem;
    width: auto;
  }

  .notification-popup-stack {
    top: 4.75rem;
    right: 1rem;
    left: 1rem;
    width: auto;
  }
}

/* 通知动画 */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notification-panel {
  animation: slideIn 0.3s ease-out;
}

/* 通知提示音效果 */
.notification-bell__button.has-new {
  animation: ring 0.5s ease-in-out;
}

@keyframes ring {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-15deg);
  }
  75% {
    transform: rotate(15deg);
  }
}

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

@keyframes notification-popup-out {
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
}

@keyframes notification-popup-progress {
  to {
    transform: scaleX(0);
  }
}

@keyframes notification-major-pulse {
  0%, 100% {
    border-color: rgba(239, 68, 68, 0.34);
    box-shadow: 0 16px 42px rgba(15, 23, 42, 0.18);
  }
  50% {
    border-color: rgba(239, 68, 68, 0.9);
    box-shadow: 0 20px 54px rgba(239, 68, 68, 0.34);
  }
}

@keyframes notification-major-icon {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.18);
  }
}
