/**
 * Staff Notifications Styles
 * Notification bell and panel for app-tho
 * Following Semi Design System
 */

/* ================================================
   CSS Variables - Semi Design Tokens
   ================================================ */
:root {
  --notification-bell-size: 48px;
  --notification-panel-width: 380px;
  --notification-panel-height: 70vh;
  --notification-item-gap: var(--semi-spacing-small, 12px);
}

/* ================================================
   Notification Bell Container (in header)
   ================================================ */
.notification-bell-container {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: 8px;
}

.notification-bell-container .staff-notification-bell {
  position: relative;
  top: auto;
  right: auto;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}

.notification-bell-container .staff-notification-bell:hover {
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
}

/* ================================================
   Notification Bell Button
   ================================================ */
.staff-notification-bell {
  position: fixed;
  top: 16px;
  right: 16px;
  width: var(--notification-bell-size);
  height: var(--notification-bell-size);
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(251, 191, 36, 0.3);
  z-index: 9999;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.staff-notification-bell:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(251, 191, 36, 0.4);
}

.staff-notification-bell:active {
  transform: scale(0.95);
}

.staff-notification-bell svg,
.staff-notification-bell i {
  width: 24px;
  height: 24px;
  color: white;
  font-size: 24px;
}

/* Bell ring animation when has new notifications */
.staff-notification-bell.has-new .notification-bell-icon {
  animation: bellRing 2s ease-in-out infinite;
}

@keyframes bellRing {
  0%,
  100% {
    transform: rotate(0deg);
  }
  10%,
  30% {
    transform: rotate(15deg);
  }
  20%,
  40% {
    transform: rotate(-15deg);
  }
  50% {
    transform: rotate(0deg);
  }
}

/* Badge for unread count */
.staff-notification-badge,
.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  background: var(--semi-color-danger, #ef4444);
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(255, 77, 79, 0.4);
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.staff-notification-badge:empty,
.staff-notification-badge[data-count='0'] {
  display: none;
}

/* ================================================
   Notification Panel
   ================================================ */
.staff-notification-panel {
  position: fixed;
  top: 0;
  right: -100%;
  width: var(--notification-panel-width);
  max-width: 100vw;
  height: 100vh;
  background: var(--semi-color-bg-0, #ffffff);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.staff-notification-panel.active {
  right: 0;
}

/* Panel Header */
.notification-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--semi-color-border, #e5e6eb);
  background: var(--semi-color-bg-1, #f9fafb);
}

.notification-panel-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--semi-color-text-0, #1c1f23);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.notification-panel-header h3 svg {
  color: var(--semi-color-primary, #0066ff);
}

.notification-panel-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--semi-color-text-0, #1c1f23);
  display: flex;
  align-items: center;
  gap: 8px;
}

.notification-panel-title i {
  color: var(--semi-color-primary, #0066ff);
}

/* Panel Header Actions */
.notification-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notification-panel-close {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--semi-color-text-2, #86909c);
  transition: all 0.2s ease;
}

.notification-panel-close:hover {
  background: var(--semi-color-danger-light, #ffebe8);
  color: var(--semi-color-danger, #ef4444);
}

/* Mark All Read Button */
.notification-mark-all-read {
  padding: 6px 12px;
  background: var(--semi-color-fill-0, #f2f3f5);
  border: 1px solid var(--semi-color-border, #e5e6eb);
  border-radius: 6px;
  font-size: 12px;
  color: var(--semi-color-text-1, #4e5969);
  cursor: pointer;
  transition: all 0.2s ease;
}

.notification-mark-all-read:hover {
  background: var(--semi-color-primary-light-default, #e6f0ff);
  border-color: var(--semi-color-primary, #0066ff);
  color: var(--semi-color-primary, #0066ff);
}

/* Panel Body - Notification List */
.notification-panel-body,
.notification-panel-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--notification-item-gap);
}

.notification-panel-body::-webkit-scrollbar {
  width: 6px;
}

.notification-panel-body::-webkit-scrollbar-thumb {
  background: var(--semi-color-fill-2, #c9cdd4);
  border-radius: 3px;
}

.notification-panel-body::-webkit-scrollbar-track {
  background: transparent;
}

/* Empty State */
.notification-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.notification-empty-icon {
  width: 80px;
  height: 80px;
  background: var(--semi-color-fill-0, #f2f3f5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.notification-empty-icon i {
  font-size: 36px;
  color: var(--semi-color-text-3, #c9cdd4);
}

.notification-empty-text {
  font-size: 14px;
  color: var(--semi-color-text-2, #86909c);
}

/* ================================================
   Notification Item
   ================================================ */
.notification-item {
  background: var(--semi-color-bg-0, #ffffff);
  border: 1px solid var(--semi-color-border, #e5e6eb);
  border-radius: 12px;
  padding: 16px;
  padding-right: 40px; /* Space for indicator dot */
  margin-bottom: var(--notification-item-gap);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.notification-item:hover {
  border-color: var(--semi-color-primary-light-active, #b8d4ff);
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.08);
  transform: translateY(-2px);
}

.notification-item:last-child {
  margin-bottom: 0;
}

/* Unread Indicator */
.notification-item.unread {
  background: var(--semi-color-primary-light-default, #e6f0ff);
  border-color: var(--semi-color-primary-light-active, #b8d4ff);
}

.notification-item.unread::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: var(--semi-color-primary, #0066ff);
  border-radius: 0 4px 4px 0;
}

/* Notification Item Content */
.notification-item-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.notification-item-icon {
  width: 40px;
  height: 40px;
  background: var(--semi-color-primary-light-default, #e6f0ff);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notification-item-icon i {
  font-size: 18px;
  color: var(--semi-color-primary, #0066ff);
}

.notification-item-info {
  flex: 1;
  min-width: 0;
}

.notification-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--semi-color-text-0, #1c1f23);
  margin: 0 0 4px 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notification-item-time {
  font-size: 12px;
  color: var(--semi-color-text-2, #86909c);
}

.notification-item-content {
  font-size: 13px;
  color: var(--semi-color-text-1, #4e5969);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Notification with media preview */
.notification-item-media {
  margin-top: 12px;
  border-radius: 8px;
  overflow: hidden;
  max-height: 120px;
}

.notification-item-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ================================================
   Notification Detail Modal
   ================================================ */
.notification-detail-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.notification-detail-overlay.active {
  opacity: 1;
  visibility: visible;
}

.notification-detail-modal {
  background: var(--semi-color-bg-0, #ffffff);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification-detail-overlay.active .notification-detail-modal {
  transform: scale(1) translateY(0);
}

.notification-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--semi-color-border, #e5e6eb);
}

.notification-detail-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--semi-color-text-0, #1c1f23);
}

.notification-detail-close {
  width: 36px;
  height: 36px;
  background: var(--semi-color-fill-0, #f2f3f5);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--semi-color-text-2, #86909c);
  transition: all 0.2s ease;
}

.notification-detail-close:hover {
  background: var(--semi-color-fill-1, #e5e6eb);
  color: var(--semi-color-text-0, #1c1f23);
}

.notification-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.notification-detail-body h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--semi-color-text-0, #1c1f23);
  margin: 0 0 16px 0;
  line-height: 1.3;
}

/* Detail Media */
.notification-detail-media {
  margin-bottom: 20px;
  border-radius: 12px;
  overflow: hidden;
}

.notification-detail-media img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
}

.notification-detail-media video {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  background: #000;
}

/* Detail Content */
.notification-detail-content {
  font-size: 15px;
  color: var(--semi-color-text-1, #4e5969);
  line-height: 1.7;
}

.notification-detail-content p {
  margin: 0 0 16px 0;
}

.notification-detail-content p:last-child {
  margin-bottom: 0;
}

/* Detail Meta */
.notification-detail-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--semi-color-border, #e5e6eb);
  font-size: 13px;
  color: var(--semi-color-text-2, #86909c);
}

.notification-detail-meta i {
  margin-right: 6px;
}

/* Detail Footer with Link */
.notification-detail-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--semi-color-border, #e5e6eb);
}

.notification-detail-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  background: var(--semi-color-primary, #0066ff);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.notification-detail-link:hover {
  background: var(--semi-color-primary-hover, #0052cc);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

/* ================================================
   Panel Overlay (backdrop)
   ================================================ */
.staff-notification-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.staff-notification-panel-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ================================================
   Dark Mode Support
   ================================================ */
[data-theme='dark'] .staff-notification-bell,
.dark-mode .staff-notification-bell {
  background: var(--semi-color-primary-dark, #3d85ff);
}

[data-theme='dark'] .staff-notification-panel,
.dark-mode .staff-notification-panel {
  background: var(--semi-color-bg-0-dark, #1d1f21);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
}

[data-theme='dark'] .notification-panel-header,
.dark-mode .notification-panel-header {
  background: var(--semi-color-bg-1-dark, #2d2f31);
  border-color: var(--semi-color-border-dark, #3d3f41);
}

[data-theme='dark'] .notification-item,
.dark-mode .notification-item {
  background: var(--semi-color-bg-1-dark, #2d2f31);
  border-color: var(--semi-color-border-dark, #3d3f41);
}

[data-theme='dark'] .notification-item.unread,
.dark-mode .notification-item.unread {
  background: rgba(0, 102, 255, 0.15);
}

[data-theme='dark'] .notification-item-title,
.dark-mode .notification-item-title,
[data-theme='dark'] .notification-panel-title,
.dark-mode .notification-panel-title {
  color: var(--semi-color-text-0-dark, #f0f1f2);
}

[data-theme='dark'] .notification-detail-modal,
.dark-mode .notification-detail-modal {
  background: var(--semi-color-bg-0-dark, #1d1f21);
}

/* ================================================
   Loading State
   ================================================ */
.notification-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.notification-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--semi-color-fill-1, #e5e6eb);
  border-top-color: var(--semi-color-primary, #0066ff);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.notification-loading-text {
  margin-top: 12px;
  font-size: 14px;
  color: var(--semi-color-text-2, #86909c);
}

/* ================================================
   Mark All Read Button (alt class)
   ================================================ */
.mark-all-read-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mark-all-read-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ================================================
   Notification Empty (alt class)
   ================================================ */
.notification-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #9ca3af;
  text-align: center;
}

.notification-empty svg {
  margin-bottom: 12px;
  opacity: 0.5;
}

.notification-empty p {
  margin: 0;
  font-size: 14px;
}

/* ================================================
   Notification Item Indicator
   ================================================ */
.notification-item-indicator {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--semi-color-primary, #0066ff);
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.2);
}

.notification-item.unread .notification-item-indicator {
  opacity: 1;
}

/* ================================================
   Notification Time
   ================================================ */
.notification-time {
  font-size: 11px;
  color: var(--semi-color-text-2, #9ca3af);
}

/* ================================================
   Staff Notification Detail Modal (alt classes)
   ================================================ */
.staff-notification-detail-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.staff-notification-detail-modal.active {
  opacity: 1;
  visibility: visible;
}

.notification-detail-container {
  position: relative;
  max-width: 480px;
  width: 100%;
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.notification-detail-container .notification-detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  background: rgba(0, 0, 0, 0.5);
  color: white;
}

.notification-detail-container .notification-detail-close:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: rotate(90deg);
}

.staff-notification-detail-modal.active .notification-detail-container {
  transform: scale(1) translateY(0);
}

.notification-detail-time {
  display: block;
  font-size: 12px;
  color: var(--semi-color-text-2, #9ca3af);
  margin-bottom: 20px;
}

/* ================================================
   Responsive Design
   ================================================ */
@media screen and (max-width: 768px) {
  .notification-bell-container .staff-notification-bell {
    width: 26px;
    height: 26px;
  }

  .staff-notification-bell {
    width: 44px;
    height: 44px;
    top: 12px;
    right: 12px;
  }

  .staff-notification-bell svg,
  .staff-notification-bell i {
    width: 16px;
    height: 16px;
    font-size: 16px;
  }

  .staff-notification-panel {
    width: 100%;
    border-radius: 0;
  }

  .notification-panel-header {
    padding: 14px 16px;
  }

  .notification-panel-title {
    font-size: 16px;
  }

  .notification-panel-body {
    padding: 12px;
  }

  .notification-item {
    padding: 14px;
    margin-bottom: 10px;
  }

  .notification-item-title {
    font-size: 13px;
  }

  .notification-item-content {
    font-size: 12px;
    -webkit-line-clamp: 2;
  }

  .notification-detail-modal {
    max-height: 90vh;
    border-radius: 12px;
  }

  .notification-detail-overlay {
    padding: 12px;
  }
}

/* Landscape phone adjustments */
@media screen and (max-height: 500px) {
  .staff-notification-panel {
    height: 100vh;
  }

  .notification-detail-modal {
    max-height: 95vh;
  }
}
