/**
 * Notification Bell Component - Mobile First
 *
 * @package PCC_Woo
 * @since 1.5.0
 */

/* ============================================
   Header Notification Bell Container
   ============================================ */

.header-notification-bell {
  display: flex;
  align-items: center;
  z-index: 10;
}

/* On mobile, hide on small screens or reposition */
@media (max-width: 767px) {
  .header-notification-bell {
    order: 2; /* Position between cart and avatar */
    margin: 0 -4px;
  }

  .header-notification-bell .notification-bell__trigger {
    width: 36px;
    height: 36px;
  }

  .header-notification-bell .notification-bell__icon {
    width: 20px;
    height: 20px;
  }

  .header-notification-bell .notification-bell__badge {
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    font-size: 9px;
    padding: 0 4px;
  }
}

/* ============================================
   Base Component (Mobile First)
   ============================================ */

.notification-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.notification-bell__trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.notification-bell__trigger:hover {
  background-color: var(--ins-gray-100, #f3f4f6);
}

.notification-bell__trigger:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--ins-primary-200, #93c5fd);
}

.notification-bell__icon {
  width: 22px;
  height: 22px;
  color: var(--ins-gray-600, #4b5563);
}

/* Badge */
.notification-bell__badge {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background-color: var(--ins-status-error, #ef4444);
  border-radius: 9px;
  line-height: 1;
}

/* ============================================
   Dropdown (Mobile: Full width bottom sheet)
   ============================================ */

.notification-bell__dropdown {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  background: #fff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.notification-bell__dropdown[aria-hidden="true"] {
  visibility: hidden;
  pointer-events: none;
}

.notification-bell__dropdown--open {
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
}

/* Header */
.notification-bell__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--ins-gray-100, #f3f4f6);
}

.notification-bell__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ins-gray-900, #111827);
}

.notification-bell__mark-all {
  padding: 6px 12px;
  font-size: 13px;
  color: var(--ins-primary-600, #2563eb);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.notification-bell__mark-all:hover {
  color: var(--ins-primary-700, #1d4ed8);
}

/* Tabs */
.notification-bell__tabs {
  display: flex;
  border-bottom: 1px solid var(--ins-gray-100, #f3f4f6);
}

.notification-bell__tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ins-gray-500, #6b7280);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.notification-bell__tab:hover {
  color: var(--ins-gray-700, #374151);
}

.notification-bell__tab--active {
  color: var(--ins-primary-600, #2563eb);
  border-bottom-color: var(--ins-primary-600, #2563eb);
}

.notification-bell__tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background-color: var(--ins-primary-500, #3b82f6);
  border-radius: 9px;
}

.notification-bell__tab-badge[style*="display: none"] {
  display: none;
}

/* List */
.notification-bell__list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: calc(80vh - 140px);
}

/* Loading */
.notification-bell__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.notification-bell__spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--ins-gray-200, #e5e7eb);
  border-top-color: var(--ins-primary-500, #3b82f6);
  border-radius: 50%;
  animation: notification-spin 0.8s linear infinite;
}

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

/* Empty State */
.notification-bell__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  text-align: center;
}

.notification-bell__empty-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  color: var(--ins-gray-300, #d1d5db);
}

.notification-bell__empty p {
  margin: 0;
  font-size: 14px;
  color: var(--ins-gray-500, #6b7280);
}

/* Notification Item */
.notification-bell__item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.notification-bell__item:hover {
  background-color: var(--ins-gray-50, #f9fafb);
}

.notification-bell__item--unread {
  background-color: var(--ins-primary-50, #eff6ff);
}

.notification-bell__item--unread:hover {
  background-color: var(--ins-primary-100, #dbeafe);
}

/* Item Icon */
.notification-bell__item-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--ins-gray-100, #f3f4f6);
}

.notification-bell__item-icon svg {
  width: 18px;
  height: 18px;
  color: var(--ins-gray-500, #6b7280);
}

.notification-bell__item-icon--message {
  background-color: var(--ins-primary-100, #dbeafe);
}

.notification-bell__item-icon--message svg {
  color: var(--ins-primary-600, #2563eb);
}

.notification-bell__item-icon--quote_sent,
.notification-bell__item-icon--quote_accepted {
  background-color: #d1fae5;
}

.notification-bell__item-icon--quote_sent svg,
.notification-bell__item-icon--quote_accepted svg {
  color: #059669;
}

.notification-bell__item-icon--quote_rejected {
  background-color: #fee2e2;
}

.notification-bell__item-icon--quote_rejected svg {
  color: #dc2626;
}

.notification-bell__item-icon--order_created,
.notification-bell__item-icon--order_status {
  background-color: #fef3c7;
}

.notification-bell__item-icon--order_created svg,
.notification-bell__item-icon--order_status svg {
  color: #d97706;
}

/* Item Content */
.notification-bell__item-content {
  flex: 1;
  min-width: 0;
}

.notification-bell__item-title {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ins-gray-900, #111827);
  line-height: 1.3;
}

.notification-bell__item--unread .notification-bell__item-title {
  font-weight: 600;
}

.notification-bell__item-message {
  margin: 0;
  font-size: 13px;
  color: var(--ins-gray-500, #6b7280);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-bell__item-time {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--ins-gray-400, #9ca3af);
}

/* Unread Dot */
.notification-bell__item-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  background-color: var(--ins-primary-500, #3b82f6);
  border-radius: 50%;
  margin-top: 6px;
}

/* Item Badge (for messages) */
.notification-bell__item-badge {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background-color: var(--ins-primary-500, #3b82f6);
  border-radius: 10px;
  margin-top: 4px;
}

/* Footer */
.notification-bell__footer {
  padding: 12px 20px;
  border-top: 1px solid var(--ins-gray-100, #f3f4f6);
  text-align: center;
}

.notification-bell__view-all {
  font-size: 14px;
  font-weight: 500;
  color: var(--ins-primary-600, #2563eb);
  text-decoration: none;
}

.notification-bell__view-all:hover {
  text-decoration: underline;
}

/* ============================================
   Desktop Styles (min-width: 768px)
   ============================================ */

@media (min-width: 768px) {
  .notification-bell__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    bottom: auto;
    left: auto;
    width: 380px;
    max-height: 520px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(-10px);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  .notification-bell__dropdown--open {
    transform: translateY(0);
    opacity: 1;
  }

  .notification-bell__header {
    padding: 14px 16px 10px;
  }

  .notification-bell__title {
    font-size: 16px;
  }

  .notification-bell__tab {
    padding: 10px 12px;
    font-size: 13px;
  }

  .notification-bell__list {
    max-height: 340px;
  }

  .notification-bell__item {
    padding: 12px 16px;
    gap: 10px;
  }

  .notification-bell__item-icon {
    width: 32px;
    height: 32px;
  }

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

  .notification-bell__item-title {
    font-size: 13px;
  }

  .notification-bell__item-message {
    font-size: 12px;
  }

  .notification-bell__footer {
    padding: 10px 16px;
  }

  .notification-bell__view-all {
    font-size: 13px;
  }
}

/* ============================================
   Backdrop for Mobile
   ============================================ */

.notification-bell__backdrop {
  display: none;
}

@media (max-width: 767px) {
  .notification-bell__dropdown--open ~ .notification-bell__backdrop,
  .notification-bell.notification-bell--open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 999;
  }
}
