/**
 * Customer Portal — Confirm Dialog, Toast, Button Spinner
 *
 * Reuses the existing `arraysubs-modal*` skeleton and only adds variant
 * styling (danger), confirm-specific spacing, the toast container, and
 * the spinner button state.
 *
 * @package ArraySubs
 */

// =====================================================
// Confirm Dialog
// =====================================================

.arraysubs-portal-confirm {
  &__body {
    padding-top: 0;
  }

  &__error {
    margin: 12px 0 0;
    padding: 10px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    color: #b91c1c;
    font-size: 13px;
  }

  &--danger {
    .arraysubs-modal__title {
      color: #b91c1c;
    }
  }
}

// Sized container for confirm modals
.arraysubs-modal__container--confirm {
  max-width: 440px;
}

// Danger button variant inside portal modals (free portal CSS already
// styles `.arraysubs-btn--danger`; ensure the modal confirm button keeps
// the variant when stacked).
.arraysubs-portal-confirm__confirm.arraysubs-btn--danger {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #fff !important;

  &:hover:not(:disabled) {
    background: #b91c1c !important;
    border-color: #b91c1c !important;
  }
}

// =====================================================
// Button Spinner
// =====================================================

.arraysubs-portal-spinner {
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
  animation: arraysubs-portal-spin 0.8s linear infinite;
}

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

.arraysubs-btn--loading {
  cursor: progress !important;
  opacity: 0.85;

  // Force inline-flex so spinner aligns nicely with text.
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;

  // Vendor buttons (Woo, WP) sometimes have padding tweaks; keep it tight.
  > svg {
    flex: 0 0 auto;
  }
}

// =====================================================
// Floating Toast
// =====================================================

.arraysubs-portal-toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 100001;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.arraysubs-portal-toast {
  pointer-events: auto;
  min-width: 260px;
  max-width: 380px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 6px;
  background: #ffffff;
  color: #1d2327;
  font-size: 14px;
  line-height: 1.45;
  box-shadow:
    0 10px 25px rgba(0, 0, 0, 0.15),
    0 4px 8px rgba(0, 0, 0, 0.06);
  border-left: 4px solid #46b450;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-10px);
  transition:
    opacity 200ms ease,
    transform 200ms ease;

  &--visible {
    opacity: 1;
    transform: translateY(0);
  }

  &__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #d4edda;
    color: #155724;
    font-size: 13px;
    font-weight: 700;
  }

  &__message {
    flex: 1;
    word-break: break-word;
  }

  &--error {
    border-left-color: #dc2626;

    .arraysubs-portal-toast__icon {
      background: #fee2e2;
      color: #b91c1c;
    }
  }

  &--info {
    border-left-color: #2271b1;

    .arraysubs-portal-toast__icon {
      background: #dbeafe;
      color: #1e40af;
    }
  }
}

@media (max-width: 480px) {
  .arraysubs-portal-toast-container {
    top: 12px;
    right: 12px;
    left: 12px;
  }

  .arraysubs-portal-toast {
    min-width: 0;
    max-width: none;
  }
}
