@use 'ui-design-system/src/styles/semantic/index' as *;

.ui-alert {
  // Core Structure
  display: flex;
  position: relative;
  align-items: flex-start;
  
  // Layout & Spacing
  padding: $semantic-spacing-component-md;
  margin-bottom: $semantic-spacing-component-sm;
  gap: 16px;
  
  // Visual Design
  background: $semantic-color-surface-elevated;
  border: $semantic-border-width-1 solid $semantic-color-border-subtle;
  border-radius: $semantic-border-card-radius;
  box-shadow: $semantic-shadow-elevation-1;
  
  // Typography
  font-family: map-get($semantic-typography-body-medium, font-family);
  font-size: map-get($semantic-typography-body-medium, font-size);
  font-weight: map-get($semantic-typography-body-medium, font-weight);
  line-height: map-get($semantic-typography-body-medium, line-height);
  color: $semantic-color-text-primary;
  
  // Transitions
  transition: all $semantic-motion-duration-fast $semantic-motion-easing-ease;
  
  // Size Variants
  &--sm {
    padding: $semantic-spacing-component-sm;
    gap: 12px;
    font-family: map-get($semantic-typography-body-small, font-family);
    font-size: map-get($semantic-typography-body-small, font-size);
    font-weight: map-get($semantic-typography-body-small, font-weight);
    line-height: map-get($semantic-typography-body-small, line-height);
  }
  
  &--md {
    // Default styles already applied above
  }
  
  &--lg {
    padding: $semantic-spacing-component-lg;
    gap: 20px;
    font-family: map-get($semantic-typography-body-large, font-family);
    font-size: map-get($semantic-typography-body-large, font-size);
    font-weight: map-get($semantic-typography-body-large, font-weight);
    line-height: map-get($semantic-typography-body-large, line-height);
  }
  
  // Color Variants
  &--primary {
    background: $semantic-color-surface-elevated;
    border-color: $semantic-color-primary;
    border-left-width: 4px;
    
    .ui-alert__icon {
      color: $semantic-color-primary;
    }
  }
  
  &--success {
    background: $semantic-color-surface-elevated;
    border-color: $semantic-color-success;
    border-left-width: 4px;
    
    .ui-alert__icon {
      color: $semantic-color-success;
    }
    
    .ui-alert__title {
      color: $semantic-color-success;
    }
  }
  
  &--warning {
    background: $semantic-color-surface-elevated;
    border-color: $semantic-color-warning;
    border-left-width: 4px;
    
    .ui-alert__icon {
      color: $semantic-color-warning;
    }
    
    .ui-alert__title {
      color: $semantic-color-warning;
    }
  }
  
  &--danger {
    background: $semantic-color-surface-elevated;
    border-color: $semantic-color-danger;
    border-left-width: 4px;
    
    .ui-alert__icon {
      color: $semantic-color-danger;
    }
    
    .ui-alert__title {
      color: $semantic-color-danger;
    }
  }
  
  &--info {
    background: $semantic-color-surface-elevated;
    border-color: $semantic-color-info;
    border-left-width: 4px;
    
    .ui-alert__icon {
      color: $semantic-color-info;
    }
    
    .ui-alert__title {
      color: $semantic-color-info;
    }
  }
  
  // BEM Elements
  &__icon {
    flex-shrink: 0;
    color: $semantic-color-text-secondary;
    font-size: 1.25rem; // Increased from $semantic-sizing-icon-inline for better visibility
    margin-top: 2px; // Slight optical alignment
  }
  
  &__content {
    flex: 1;
    min-width: 0; // Prevents flex overflow
  }
  
  &__title {
    margin: 0 0 $semantic-spacing-content-line-tight 0;
    font-family: map-get($semantic-typography-heading-h4, font-family);
    font-size: map-get($semantic-typography-heading-h4, font-size);
    font-weight: map-get($semantic-typography-heading-h4, font-weight);
    line-height: map-get($semantic-typography-heading-h4, line-height);
    color: $semantic-color-text-primary;
    
    &--bold {
      font-weight: $semantic-typography-font-weight-semibold;
    }
  }
  
  &__message {
    margin: 0;
    color: $semantic-color-text-secondary;
  }
  
  &__actions {
    margin-top: $semantic-spacing-component-sm;
    display: flex;
    gap: $semantic-spacing-component-xs;
    flex-wrap: wrap;
  }
  
  &__dismiss {
    position: absolute;
    top: $semantic-spacing-component-xs;
    right: $semantic-spacing-component-xs;
    background: transparent;
    border: none;
    color: $semantic-color-text-tertiary;
    cursor: pointer;
    padding: $semantic-spacing-component-xs;
    border-radius: $semantic-border-radius-sm;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: $semantic-sizing-touch-minimum;
    min-height: $semantic-sizing-touch-minimum;
    
    &:hover {
      background: $semantic-color-surface-secondary;
      color: $semantic-color-text-secondary;
    }
    
    &:focus-visible {
      outline: 2px solid $semantic-color-focus;
      outline-offset: 2px;
    }
    
    &:active {
      background: $semantic-color-surface-primary;
    }
  }
  
  // State Variants
  &--dismissible {
    padding-right: calc($semantic-spacing-component-lg + $semantic-sizing-touch-minimum);
  }
  
  // Responsive Design
  @media (max-width: $semantic-breakpoint-sm - 1) {
    padding: $semantic-spacing-component-sm;
    gap: $semantic-spacing-component-xs;
    
    &--lg {
      padding: $semantic-spacing-component-md;
    }
    
    &__title {
      font-family: map-get($semantic-typography-body-small, font-family);
      font-size: map-get($semantic-typography-body-small, font-size);
      font-weight: map-get($semantic-typography-body-small, font-weight);
      line-height: map-get($semantic-typography-body-small, line-height);
    }
    
    &__message {
      font-family: map-get($semantic-typography-caption, font-family);
      font-size: map-get($semantic-typography-caption, font-size);
      font-weight: map-get($semantic-typography-caption, font-weight);
      line-height: map-get($semantic-typography-caption, line-height);
    }
    
    &--dismissible {
      padding-right: calc($semantic-spacing-component-md + $semantic-sizing-touch-minimum);
    }
  }
}