@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-content-heading;
    margin-top: $semantic-spacing-layout-lg;
  }
}

.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-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: $semantic-spacing-content-line-normal;
  padding: $semantic-spacing-component-md;
  border: 1px solid $semantic-color-border-subtle;
  border-radius: $semantic-border-radius-md;
  background: $semantic-color-surface-primary;
  min-width: 100px;

  p {
    margin: 0;
    font-size: $semantic-typography-font-size-md;
    color: $semantic-color-text-secondary;
    text-align: center;
    font-weight: $semantic-typography-font-weight-medium;
  }

  &:hover {
    border-color: $semantic-color-border-primary;
    box-shadow: $semantic-shadow-elevation-1;
  }
}

.demo-controls {
  display: flex;
  gap: $semantic-spacing-component-lg;
  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;

  .control-group {
    display: flex;
    flex-direction: column;
    gap: $semantic-spacing-component-xs;
    min-width: 120px;

    label {
      font-size: $semantic-typography-font-size-sm;
      font-weight: $semantic-typography-font-weight-medium;
      color: $semantic-color-text-primary;
    }

    input[type="range"] {
      width: 100%;
      min-width: 150px;
    }

    input[type="checkbox"] {
      margin-right: $semantic-spacing-component-xs;
    }

    select {
      padding: $semantic-spacing-component-xs $semantic-spacing-component-sm;
      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;

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

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

    &:hover:not(:disabled) {
      background: $semantic-color-primary-hover;
      border-color: $semantic-color-primary-hover;
      box-shadow: $semantic-shadow-elevation-2;
    }

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

    &:disabled {
      opacity: 0.38;
      cursor: not-allowed;
      background: $semantic-color-surface-secondary;
      border-color: $semantic-color-border-subtle;
      color: $semantic-color-text-tertiary;
    }
  }
}

.demo-interactive-result {
  display: flex;
  justify-content: center;
  padding: $semantic-spacing-component-xl;
  background: $semantic-color-surface-primary;
  border-radius: $semantic-border-radius-lg;
  border: 2px dashed $semantic-color-border-subtle;
}

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

  .demo-row {
    gap: $semantic-spacing-component-md;
  }

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

    .control-group {
      min-width: auto;
    }
  }
}

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

  .demo-row {
    justify-content: center;
  }

  .demo-item {
    min-width: 80px;
  }
}