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

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

  h2 {
    color: $semantic-color-text-primary;
    font-size: $semantic-typography-heading-h2-size;
    margin-bottom: $semantic-spacing-layout-lg;
    border-bottom: 1px solid $semantic-color-border-subtle;
    padding-bottom: $semantic-spacing-content-paragraph;
  }

  h3 {
    color: $semantic-color-text-secondary;
    font-size: $semantic-typography-heading-h3-size;
    margin-bottom: $semantic-spacing-component-lg;
    margin-top: $semantic-spacing-layout-lg;
  }

  h4 {
    color: $semantic-color-text-primary;
    font-size: $semantic-typography-heading-h4-size;
    margin-bottom: $semantic-spacing-component-md;
  }
}

.demo-section {
  margin-bottom: $semantic-spacing-layout-xl;
  
  &:last-child {
    margin-bottom: 0;
  }
}

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

.demo-column {
  display: flex;
  flex-direction: column;
  gap: $semantic-spacing-component-lg;
  flex: 1;
  min-width: 300px;
}

.demo-accordion-container {
  max-width: 600px;
}

.demo-controls {
  display: flex;
  gap: $semantic-spacing-component-md;
  flex-wrap: wrap;
  margin-bottom: $semantic-spacing-component-lg;
  padding: $semantic-spacing-component-lg;
  background: $semantic-color-surface-secondary;
  border-radius: $semantic-border-radius-lg;
  border: 1px solid $semantic-color-border-subtle;

  button {
    padding: $semantic-spacing-component-sm $semantic-spacing-component-md;
    border: 1px solid $semantic-color-border-primary;
    border-radius: $semantic-border-radius-sm;
    background: $semantic-color-surface-primary;
    color: $semantic-color-text-primary;
    font-size: $semantic-typography-font-size-sm;
    cursor: pointer;
    transition: all $semantic-motion-duration-fast $semantic-easing-standard;

    &:hover {
      background: $semantic-color-surface-secondary;
      border-color: $semantic-color-border-primary;
    }

    &:focus {
      outline: 2px solid $semantic-color-primary;
      outline-offset: 2px;
    }

    &--primary {
      background: $semantic-color-primary;
      color: $semantic-color-on-primary;
      border-color: $semantic-color-primary;

      &:hover {
        background: $semantic-color-primary;
        opacity: 0.9;
      }
    }
  }
}

.demo-item {
  display: flex;
  flex-direction: column;
  gap: $semantic-spacing-component-sm;
  padding: $semantic-spacing-component-md;
  border: 1px solid $semantic-color-border-subtle;
  border-radius: $semantic-border-radius-md;
  background: $semantic-color-surface-primary;

  h5 {
    margin: 0 0 $semantic-spacing-component-xs 0;
    font-size: $semantic-typography-font-size-sm;
    font-weight: $semantic-typography-font-weight-medium;
    color: $semantic-color-text-secondary;
  }
}

.code-example {
  background: $semantic-color-surface-secondary;
  border: 1px solid $semantic-color-border-subtle;
  border-radius: $semantic-border-radius-sm;
  padding: $semantic-spacing-component-md;
  font-family: $semantic-typography-font-family-mono;
  font-size: $semantic-typography-font-size-xs;
  color: $semantic-color-text-primary;
  overflow-x: auto;
  white-space: pre-wrap;
  margin-top: $semantic-spacing-component-sm;
}

.sample-content {
  line-height: $semantic-typography-line-height-relaxed;
  
  p {
    margin: 0 0 $semantic-spacing-component-sm 0;
    
    &:last-child {
      margin-bottom: 0;
    }
  }
  
  ul {
    margin: 0 0 $semantic-spacing-component-sm $semantic-spacing-component-lg;
    
    &:last-child {
      margin-bottom: 0;
    }
  }
  
  li {
    margin-bottom: $semantic-spacing-component-xs;
    
    &:last-child {
      margin-bottom: 0;
    }
  }
}

.icon-demo {
  display: inline-flex;
  align-items: center;
  gap: $semantic-spacing-component-xs;
  color: $semantic-color-primary;
  font-weight: $semantic-typography-font-weight-medium;
}

// Responsive design
@media (max-width: $semantic-breakpoint-md - 1) {
  .demo-container {
    padding: $semantic-spacing-layout-md;
  }

  .demo-row {
    flex-direction: column;
  }

  .demo-column {
    min-width: auto;
  }

  .demo-controls {
    flex-direction: column;
    gap: $semantic-spacing-component-sm;
  }
}

@media (max-width: $semantic-breakpoint-sm - 1) {
  .demo-container {
    padding: $semantic-spacing-layout-sm;
  }

  .demo-item {
    padding: $semantic-spacing-component-sm;
  }
}