
// Header Notification Bell
.header-notification-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: $spacing-sm;
  color: var(--light-gray);
  transition: var(--transition-fast);
  cursor: pointer;
  border-radius: var(--border-radius-md);

  &:hover {
    color: var(--white);
    background-color: rgba(255, 255, 255, 0.1);
  }

  svg {
    width: 24px;
    height: 24px;
  }

  // Header Notification Badge
  .header-notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: linear-gradient(135deg, var(--danger), #ff6b6b);
    color: var(--white);
    font-size: 11px;
    font-weight: 600;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--dark-gray);
    box-shadow: var(--box-shadow-sm);
    animation: headerBadgePulse 2s infinite;

    &.is-hidden {
      display: none;
    }
  }

  // Bell shake animation for new notifications
  &.has-new-notification {
    animation: headerBellShake 0.5s ease-in-out;
  }
}

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

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

// Header Notification Dropdown
.header-notification-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 380px;
  max-width: 90vw;
  background: var(--dark-gray-lighter);
  border: 1px solid var(--dark-gray-lightest);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  margin-top: $spacing-sm;
  overflow: hidden;
  transform: translateY(-10px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;

  &.is-visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }

  // Arrow
  &::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: var(--dark-gray-lighter);
    border: 1px solid var(--dark-gray-lightest);
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
  }

  .header-notification-header {
    padding: $spacing-md;
    border-bottom: 1px solid var(--dark-gray-lightest);
    display: flex;
    justify-content: space-between;
    align-items: center;

    h3 {
      font-size: 16px;
      font-weight: 600;
      color: var(--white);
      margin: 0;
    }

    .header-mark-all-read {
      font-size: 12px;
      color: var(--primary-color);
      text-decoration: none;
      transition: var(--transition-fast);

      &:hover {
        color: var(--primary-light);
        text-decoration: underline;
      }
    }
  }

  .header-notification-list {
    max-height: 400px;
    overflow-y: auto;

    &::-webkit-scrollbar {
      width: 6px;
    }

    &::-webkit-scrollbar-track {
      background: var(--dark-gray-lightest);
    }

    &::-webkit-scrollbar-thumb {
      background: var(--mid-gray);
      border-radius: 3px;

      &:hover {
        background: var(--light-gray);
      }
    }

    // Loading state
    .header-notification-loading {
      display: flex;
      align-items: center;
      justify-content: center;
      padding: $spacing-xl;
      color: var(--mid-gray);
      
      &::after {
        content: '';
        width: 20px;
        height: 20px;
        border: 2px solid var(--dark-gray-lightest);
        border-top-color: var(--primary-color);
        border-radius: 50%;
        animation: headerNotificationSpin 1s linear infinite;
        margin-left: $spacing-sm;
      }
    }
  }

  .header-notification-item {
    position: relative;
    padding: $spacing-md;
    border-bottom: 1px solid var(--dark-gray-lightest);
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    color: inherit;
    display: block;

    &:hover {
      background-color: rgba(255, 255, 255, 0.05);
      transform: translateX(2px);
    }

    &:last-child {
      border-bottom: none;
    }

    &.is-unread {
      background: linear-gradient(90deg, rgba(75, 139, 255, 0.1), transparent);
      border-left: 3px solid var(--primary-color);

      &::before {
        content: '';
        position: absolute;
        top: 50%;
        right: $spacing-md;
        width: 8px;
        height: 8px;
        background: var(--primary-color);
        border-radius: 50%;
        transform: translateY(-50%);
      }
    }

    .header-notification-content {
      display: flex;
      gap: $spacing-md;
      align-items: flex-start;
    }

    .header-notification-avatar {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      object-fit: cover;
      border: 2px solid var(--dark-gray-lightest);
      flex-shrink: 0;
      transition: transform 0.2s ease;

      &.default-avatar {
        background: var(--dark-gray-lightest);
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--mid-gray);
      }
    }

    &:hover .header-notification-avatar {
      transform: scale(1.05);
    }

    .header-notification-body {
      flex: 1;
      min-width: 0;

      .header-notification-message {
        color: var(--white);
        font-size: 14px;
        line-height: 1.4;
        margin-bottom: $spacing-xs;

        .header-reaction-emoji {
          font-size: 16px;
          margin-left: $spacing-xs;
        }
      }

      .header-notification-preview {
        color: var(--light-gray);
        font-size: 12px;
        font-style: italic;
        margin-bottom: $spacing-xs;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .header-notification-time {
        color: var(--mid-gray);
        font-size: 11px;
      }
    }
  }

  .header-notification-empty {
    padding: $spacing-xxl $spacing-md;
    text-align: center;
    color: var(--mid-gray);

    .header-empty-icon {
      font-size: 48px;
      margin-bottom: $spacing-md;
      opacity: 0.5;
    }

    .header-empty-title {
      font-size: 16px;
      font-weight: 600;
      color: var(--light-gray);
      margin-bottom: $spacing-sm;
    }

    .header-empty-description {
      font-size: 14px;
      line-height: 1.4;
    }
  }

  .header-notification-footer {
    padding: $spacing-md;
    border-top: 1px solid var(--dark-gray-lightest);
    text-align: center;

    .header-view-all-link {
      color: var(--primary-color);
      text-decoration: none;
      font-size: 14px;
      font-weight: 500;
      transition: var(--transition-fast);

      &:hover {
        color: var(--primary-light);
        text-decoration: underline;
      }
    }
  }
}

@keyframes headerNotificationSpin {
  to { transform: rotate(360deg); }
}

// Header Integration Styles
.auth-buttons {
  display: flex;
  align-items: center;
  gap: $spacing-md;

  .header-notification-container {
    position: relative;
    margin-right: $spacing-sm;
  }
}

// User Dropdown Notification Badge
.dropdown-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: $spacing-sm;
  
  i {
    width: 16px;
    flex-shrink: 0;
  }

  .dropdown-notification-badge {
    margin-left: auto;
    background: linear-gradient(135deg, var(--danger), #ff6b6b);
    color: var(--white);
    font-size: 10px;
    font-weight: 600;
    border-radius: 10px;
    min-width: 18px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
  }
}

// Mobile responsiveness for header
@media (max-width: $breakpoint-md) {
  .auth-buttons {
    gap: $spacing-sm;

    .header-notification-container {
      margin-right: 0;
    }
  }

  .header-notification-bell {
    svg {
      width: 20px;
      height: 20px;
    }
    
    .header-notification-badge {
      min-width: 16px;
      height: 16px;
      font-size: 10px;
      top: -4px;
      right: -4px;
    }
  }

  .header-notification-dropdown {
    position: fixed;
    top: 60px; // Adjust based on your header height
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    border-radius: 0;
    margin-top: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);

    &::before {
      display: none;
    }
  }
}

// Notifications Page
.notifications-page {
  background: var(--dark-gray);
  min-height: 100vh;
  padding-top: 80px; // Account for fixed header

  .notifications-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: $spacing-xl $spacing-md;
  }

  .notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: $spacing-xl;
    flex-wrap: wrap;
    gap: $spacing-md;

    h1 {
      font-size: 32px;
      font-weight: 700;
      color: var(--white);
      margin: 0;
    }

    .notifications-actions {
      display: flex;
      gap: $spacing-sm;
    }
  }

  .notifications-content {
    background: var(--dark-gray-lighter);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--box-shadow-lg);
  }

  .notification-card {
    padding: $spacing-lg;
    border-bottom: 1px solid var(--dark-gray-lightest);
    transition: var(--transition-fast);

    &:hover {
      background-color: rgba(255, 255, 255, 0.02);
    }

    &:last-child {
      border-bottom: none;
    }

    &.unread {
      background: linear-gradient(90deg, rgba(75, 139, 255, 0.08), transparent);
      border-left: 4px solid var(--primary-color);
    }

    .notification-main {
      display: flex;
      gap: $spacing-md;
      align-items: flex-start;
      margin-bottom: $spacing-md;
    }

    .notification-avatar {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      object-fit: cover;
      border: 2px solid var(--dark-gray-lightest);
      flex-shrink: 0;
    }

    .notification-details {
      flex: 1;
      min-width: 0;

      .notification-message {
        color: var(--white);
        font-size: 16px;
        line-height: 1.5;
        margin-bottom: $spacing-sm;

        .reaction-emoji {
          font-size: 18px;
          margin-left: $spacing-sm;
        }
      }

      .notification-preview {
        color: var(--light-gray);
        font-size: 14px;
        font-style: italic;
        margin-bottom: $spacing-sm;
        padding: $spacing-sm;
        background: var(--dark-gray-lightest);
        border-radius: var(--border-radius-sm);
        border-left: 3px solid var(--mid-gray);
      }

      .notification-meta {
        display: flex;
        align-items: center;
        gap: $spacing-md;
        font-size: 12px;
        color: var(--mid-gray);

        .notification-time {
          &::before {
            content: '•';
            margin-right: $spacing-xs;
          }
        }

        .notification-status {
          &.unread {
            color: var(--primary-color);
            font-weight: 600;

            &::before {
              content: '•';
              margin-right: $spacing-xs;
            }
          }
        }
      }
    }

    .notification-actions {
      display: flex;
      gap: $spacing-sm;
      justify-content: flex-end;
      flex-wrap: wrap;
    }
  }

  .notifications-empty {
    text-align: center;
    padding: $spacing-xxl * 2 $spacing-md;
    color: var(--mid-gray);

    .empty-icon {
      font-size: 80px;
      margin-bottom: $spacing-xl;
      opacity: 0.3;
    }

    .empty-title {
      font-size: 24px;
      font-weight: 600;
      color: var(--light-gray);
      margin-bottom: $spacing-md;
    }

    .empty-description {
      font-size: 16px;
      line-height: 1.6;
      max-width: 400px;
      margin: 0 auto;
    }
  }

  .notifications-pagination {
    margin-top: $spacing-xl;
    display: flex;
    justify-content: center;
  }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: $spacing-sm $spacing-md;
  border-radius: var(--border-radius-md);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  gap: $spacing-xs;

  &.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);

    &:hover {
      background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
      transform: translateY(-1px);
      box-shadow: var(--box-shadow-md);
    }
  }

  &.btn-secondary {
    background: var(--dark-gray-lightest);
    color: var(--light-gray);
    border: 1px solid var(--mid-gray);

    &:hover {
      background: var(--mid-gray);
      color: var(--white);
    }
  }

  &.btn-danger {
    background: var(--danger);
    color: var(--white);

    &:hover {
      background: darken(#FF3B30, 10%);
      transform: translateY(-1px);
    }
  }

  &.btn-sm {
    padding: $spacing-xs $spacing-sm;
    font-size: 12px;
  }

  &.btn-link {
    background: none;
    color: var(--primary-color);
    padding: 0;

    &:hover {
      color: var(--primary-light);
      text-decoration: underline;
    }
  }
}
}

@media (max-width: $breakpoint-md) {
  .notifications-page {
    .notifications-header {
      flex-direction: column;
      align-items: stretch;

      h1 {
        font-size: 24px;
        text-align: center;
      }

      .notifications-actions {
        justify-content: center;
      }
    }

    .notification-card {
      padding: $spacing-md;

      .notification-main {
        flex-direction: column;
        align-items: stretch;
      }

      .notification-actions {
        justify-content: flex-start;
        margin-top: $spacing-md;
      }
    }
  }
}