/* ==========================================================================
   NOTIFICATION SYSTEM
   ========================================================================== */

.notification-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  max-width: 380px;
  width: 100%;
}

.notification {
  --notification-icon-bg: var(--color-gray-100);
  background: var(--color-surface-elevated);
  border: var(--border-width-thin) solid var(--color-border-light);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.06);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  pointer-events: auto;
  opacity: 0;
  animation: notificationEnter 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  min-height: 52px;
  max-width: 100%;
  word-wrap: break-word;
}

.notification.removing {
  animation: notificationExit 0.24s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.notification--stacked {
  align-items: flex-start;
}

.notification--stacked .notification-icon {
  margin-top: 1px;
}

.notification--stacked .notification-close {
  margin-top: 1px;
}

.notification-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-full);
  background: var(--notification-icon-bg);
  line-height: 1;
}

.notification-icon svg {
  width: 16px;
  height: 16px;
  display: block;
  flex-shrink: 0;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: 0 0 2px 0;
  line-height: var(--line-height-tight);
}

.notification-message {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  color: var(--color-text-primary);
  margin: 0;
  line-height: var(--line-height-normal);
  word-break: break-word;
}

.notification-body {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.notification-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

.notification-action {
  appearance: none;
  display: inline-flex;
  align-items: center;
  border: var(--border-width-thin) solid var(--color-border-light);
  background: var(--color-gray-50);
  color: var(--color-text-primary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.notification-action svg {
  width: 13px;
  height: 13px;
  margin-right: 6px;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.notification-action:hover {
  background: var(--color-gray-100);
}

.notification-action:active {
  background: var(--color-gray-200);
}

.notification-action:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  border-color: var(--color-info);
}

.notification-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0;
  margin: 0;
  border-radius: 4px;
  transition: color var(--transition-fast), opacity var(--transition-fast);
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.65;
}

.notification-close svg {
  width: 14px;
  height: 14px;
  display: block;
  flex-shrink: 0;
}

.notification-close:hover {
  opacity: 1;
  color: var(--color-text-primary);
}

.notification-close:active {
  opacity: 0.85;
}

.notification-confirm-actions {
  margin-top: var(--space-3);
  display: flex;
  gap: var(--space-2);
}

/* Notification types */
.notification.success {
  --notification-icon-bg: color-mix(in srgb, var(--color-success) 12%, var(--color-gray-100));
}

.notification.error {
  --notification-icon-bg: color-mix(in srgb, var(--color-error) 12%, var(--color-gray-100));
}

.notification.warning {
  --notification-icon-bg: color-mix(in srgb, var(--color-warning) 14%, var(--color-gray-100));
}

.notification.info {
  --notification-icon-bg: color-mix(in srgb, var(--color-info) 12%, var(--color-gray-100));
}

.notification.success .notification-icon {
  color: var(--color-success);
}

.notification.error .notification-icon {
  color: var(--color-error);
}

.notification.warning .notification-icon {
  color: var(--color-warning);
}

.notification.info .notification-icon {
  color: var(--color-info);
}

/* Animations */
@keyframes notificationEnter {
  from {
    transform: translateY(-12px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes notificationExit {
  from {
    transform: translateY(0) scale(1);
    opacity: 1;
    max-height: 120px;
    margin-bottom: var(--space-2);
  }
  to {
    transform: translateY(-8px) scale(0.98);
    opacity: 0;
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .notification-container {
    top: var(--space-3);
    right: var(--space-3);
    left: var(--space-3);
    max-width: none;
  }

  .notification {
    padding: 11px 12px;
  }
}

/* Dark theme */
:root[data-theme='dark'] .notification {
  background: var(--color-surface-elevated);
  border-color: var(--color-border-light);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2);
}

:root[data-theme='dark'] .notification.success {
  --notification-icon-bg: color-mix(in srgb, var(--color-success) 18%, rgba(255, 255, 255, 0.06));
}

:root[data-theme='dark'] .notification.error {
  --notification-icon-bg: color-mix(in srgb, var(--color-error) 18%, rgba(255, 255, 255, 0.06));
}

:root[data-theme='dark'] .notification.warning {
  --notification-icon-bg: color-mix(in srgb, var(--color-warning) 18%, rgba(255, 255, 255, 0.06));
}

:root[data-theme='dark'] .notification.info {
  --notification-icon-bg: color-mix(in srgb, var(--color-info) 18%, rgba(255, 255, 255, 0.06));
}

:root[data-theme='dark'] .notification-message,
:root[data-theme='dark'] .notification-title {
  color: var(--color-text-primary);
}

:root[data-theme='dark'] .notification-close {
  color: var(--color-text-secondary);
}

:root[data-theme='dark'] .notification-close:hover {
  color: var(--color-text-primary);
}

:root[data-theme='dark'] .notification-action {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--color-border-medium);
  color: var(--color-text-primary);
}

:root[data-theme='dark'] .notification-action svg {
  color: var(--color-text-secondary);
}

:root[data-theme='dark'] .notification-action:hover {
  background: rgba(255, 255, 255, 0.1);
}
