// Variables
$color-error: #dc2626;
$color-error-light: #fef2f2;
$color-error-border: #fecaca;
$color-text-primary: #1f2937;
$color-text-secondary: #6b7280;
$color-white: #ffffff;
$color-gray-50: #f9fafb;
$color-gray-100: #f3f4f6;
$color-gray-900: #111827;

$spacing-xs: 0.5rem;
$spacing-sm: 1rem;
$spacing-md: 1.5rem;
$spacing-lg: 2rem;
$spacing-xl: 3rem;

$font-size-sm: 0.875rem;
$font-size-base: 1rem;
$font-size-lg: 1.125rem;
$font-size-xl: 1.5rem;
$font-size-2xl: 2rem;

$border-radius-sm: 0.375rem;
$border-radius-md: 0.5rem;
$border-radius-lg: 0.75rem;

$breakpoint-mobile: 640px;

$transition-fast: 0.2s ease-in-out;

.errorBoundary {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: $color-gray-50;
  padding: $spacing-lg;

  @media (max-width: $breakpoint-mobile) {
    padding: $spacing-sm;
  }
}

.container {
  max-width: 600px;
  width: 100%;
}

.content {
  background-color: $color-white;
  border-radius: $border-radius-lg;
  padding: $spacing-xl;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  text-align: center;

  @media (max-width: $breakpoint-mobile) {
    padding: $spacing-md;
  }
}

.iconWrapper {
  display: flex;
  justify-content: center;
  margin-bottom: $spacing-md;
}

.icon {
  width: 4rem;
  height: 4rem;
  color: $color-error;
}

.title {
  font-size: $font-size-2xl;
  font-weight: 700;
  color: $color-text-primary;
  margin: 0 0 $spacing-sm 0;

  @media (max-width: $breakpoint-mobile) {
    font-size: $font-size-xl;
  }
}

.message {
  font-size: $font-size-base;
  color: $color-text-secondary;
  line-height: 1.6;
  margin: 0 0 $spacing-lg 0;
}

.details {
  background-color: $color-error-light;
  border: 1px solid $color-error-border;
  border-radius: $border-radius-md;
  padding: $spacing-sm;
  margin-bottom: $spacing-lg;
  text-align: left;
}

.detailsSummary {
  cursor: pointer;
  font-size: $font-size-sm;
  font-weight: 600;
  color: $color-error;
  padding: $spacing-xs;
  
  &:hover {
    text-decoration: underline;
  }
  
  &:focus {
    outline: 2px solid $color-error;
    outline-offset: 2px;
    border-radius: $border-radius-sm;
  }
}

.errorStack {
  font-family: monospace;
  font-size: $font-size-sm;
  color: $color-gray-900;
  background-color: $color-gray-100;
  padding: $spacing-sm;
  border-radius: $border-radius-sm;
  margin-top: $spacing-sm;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.actions {
  display: flex;
  justify-content: center;
  gap: $spacing-sm;
}

.retryButton {
  padding: 0.75rem $spacing-md;
  background-color: $color-text-primary;
  color: $color-white;
  border: none;
  border-radius: $border-radius-md;
  font-size: $font-size-base;
  font-weight: 600;
  cursor: pointer;
  transition: background-color $transition-fast, transform 0.1s ease-in-out;
  
  &:hover {
    background-color: lighten($color-text-primary, 10%);
    transform: translateY(-1px);
  }
  
  &:active {
    transform: translateY(0);
  }
  
  &:focus {
    outline: 2px solid $color-text-primary;
    outline-offset: 2px;
  }
  
  &:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
  }
}