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

.demo-container {
  padding: $semantic-spacing-layout-section-md;
  max-width: 1200px;
  margin: 0 auto;
}

.demo-section {
  margin-bottom: $semantic-spacing-layout-section-lg;
  
  h3 {
    font-family: map-get($semantic-typography-heading-h3, font-family);
    font-size: map-get($semantic-typography-heading-h3, font-size);
    font-weight: map-get($semantic-typography-heading-h3, font-weight);
    line-height: map-get($semantic-typography-heading-h3, line-height);
    color: $semantic-color-text-primary;
    margin-bottom: $semantic-spacing-content-heading;
  }
  
  h4 {
    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;
    margin-bottom: $semantic-spacing-content-heading;
  }
  
  p {
    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-secondary;
    margin-bottom: $semantic-spacing-content-paragraph;
  }
}

.demo-row {
  display: flex;
  flex-wrap: wrap;
  gap: $semantic-spacing-grid-gap-md;
  align-items: flex-start;
}

.toast-wrapper {
  flex: 0 0 auto;
}

.controls-section {
  margin-bottom: $semantic-spacing-layout-section-md;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: $semantic-spacing-component-sm;
  margin-bottom: $semantic-spacing-component-lg;
}

.demo-button {
  display: inline-flex;
  align-items: center;
  gap: $semantic-spacing-component-xs;
  padding: $semantic-spacing-interactive-button-padding-y $semantic-spacing-interactive-button-padding-x;
  background: $semantic-color-surface-primary;
  border: $semantic-border-width-1 solid $semantic-color-border-primary;
  border-radius: $semantic-border-button-radius;
  color: $semantic-color-text-primary;
  font-family: map-get($semantic-typography-button-medium, font-family);
  font-size: map-get($semantic-typography-button-medium, font-size);
  font-weight: map-get($semantic-typography-button-medium, font-weight);
  line-height: map-get($semantic-typography-button-medium, line-height);
  cursor: pointer;
  transition: all $semantic-motion-duration-fast $semantic-motion-easing-ease;
  min-height: $semantic-sizing-button-height-md;
  
  &:hover {
    box-shadow: $semantic-shadow-button-hover;
    background: $semantic-color-surface-secondary;
  }
  
  &:focus-visible {
    outline: 2px solid $semantic-color-focus;
    outline-offset: 2px;
  }
  
  &:active {
    box-shadow: $semantic-shadow-button-rest;
    transform: translateY(1px);
  }
  
  &--primary {
    background: $semantic-color-primary;
    color: $semantic-color-on-primary;
    border-color: $semantic-color-primary;
    
    &:hover {
      background: $semantic-color-primary;
      opacity: $semantic-opacity-hover;
    }
  }
  
  &--secondary {
    background: $semantic-color-secondary;
    color: $semantic-color-on-secondary;
    border-color: $semantic-color-secondary;
    
    &:hover {
      background: $semantic-color-secondary;
      opacity: $semantic-opacity-hover;
    }
  }
  
  &--warning {
    background: $semantic-color-warning;
    color: $semantic-color-on-warning;
    border-color: $semantic-color-warning;
    
    &:hover {
      background: $semantic-color-warning;
      opacity: $semantic-opacity-hover;
    }
  }
  
  &--danger {
    background: $semantic-color-danger;
    color: $semantic-color-on-danger;
    border-color: $semantic-color-danger;
    
    &:hover {
      background: $semantic-color-danger;
      opacity: $semantic-opacity-hover;
    }
  }
}

.toast-container {
  position: fixed;
  top: $semantic-spacing-layout-section-md;
  right: $semantic-spacing-layout-section-md;
  z-index: $semantic-z-index-modal;
  display: flex;
  flex-direction: column;
  gap: $semantic-spacing-component-sm;
  max-width: 400px;
  width: 100%;
  pointer-events: none;
  
  .ui-toast {
    pointer-events: auto;
  }
}

.stats-section {
  margin-top: $semantic-spacing-layout-section-md;
  padding: $semantic-spacing-component-lg;
  background: $semantic-color-surface-elevated;
  border: $semantic-border-width-1 solid $semantic-color-border-subtle;
  border-radius: $semantic-border-card-radius;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: $semantic-spacing-grid-gap-md;
  margin-bottom: $semantic-spacing-component-lg;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: $semantic-spacing-component-sm;
  background: $semantic-color-surface-primary;
  border: $semantic-border-width-1 solid $semantic-color-border-subtle;
  border-radius: $semantic-border-radius-sm;
}

.stat-label {
  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-secondary;
}

.stat-value {
  font-family: map-get($semantic-typography-label, font-family);
  font-size: map-get($semantic-typography-label, font-size);
  font-weight: $semantic-typography-font-weight-semibold;
  line-height: map-get($semantic-typography-label, line-height);
  color: $semantic-color-primary;
}

// Responsive Design
@media (max-width: calc($semantic-breakpoint-md - 1px)) {
  .demo-container {
    padding: $semantic-spacing-layout-section-sm;
  }
  
  .demo-row {
    flex-direction: column;
  }
  
  .toast-container {
    top: $semantic-spacing-layout-section-sm;
    right: $semantic-spacing-layout-section-sm;
    left: $semantic-spacing-layout-section-sm;
    max-width: none;
  }
  
  .button-group {
    flex-direction: column;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: calc($semantic-breakpoint-sm - 1px)) {
  .demo-container {
    padding: $semantic-spacing-layout-section-xs;
  }
  
  .toast-container {
    top: $semantic-spacing-layout-section-xs;
    right: $semantic-spacing-layout-section-xs;
    left: $semantic-spacing-layout-section-xs;
  }
}