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

.demo-container {
  padding: $semantic-spacing-component-lg;
  background: $semantic-color-surface;
  min-height: 100vh;
  
  h2 {
    font-family: map-get($semantic-typography-heading-h2, font-family);
    font-size: map-get($semantic-typography-heading-h2, font-size);
    font-weight: map-get($semantic-typography-heading-h2, font-weight);
    line-height: map-get($semantic-typography-heading-h2, line-height);
    color: $semantic-color-text-primary;
    margin-bottom: $semantic-spacing-content-heading;
    border-bottom: $semantic-border-width-1 solid $semantic-color-border-secondary;
    padding-bottom: $semantic-spacing-component-sm;
  }
}

.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-component-md;
  }
}

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

.demo-card {
  border: $semantic-border-width-1 solid $semantic-color-border-secondary;
  border-radius: $semantic-border-card-radius;
  background: $semantic-color-surface-secondary;
  padding: $semantic-spacing-component-md;
  
  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-component-sm;
  }
}

.sidebar-demo-container {
  height: 300px;
  border: $semantic-border-width-1 solid $semantic-color-border-subtle;
  border-radius: $semantic-border-radius-sm;
  overflow: hidden;
  position: relative;
  
  &--interactive {
    height: 400px;
  }
  
  .demo-content {
    padding: $semantic-spacing-component-md;
    color: $semantic-color-text-primary;
    
    h4, h5 {
      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);
      margin-bottom: $semantic-spacing-component-xs;
    }
    
    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;
    }
    
    ul {
      list-style: none;
      padding: 0;
      margin: 0;
      
      li {
        padding: $semantic-spacing-content-line-tight;
        color: $semantic-color-text-secondary;
        border-bottom: $semantic-border-width-1 solid $semantic-color-border-subtle;
        
        &:last-child {
          border-bottom: none;
        }
      }
    }
  }
}

// Sidebar content styling
[slot="sidebar"] {
  color: $semantic-color-text-primary;
  
  h5 {
    font-family: map-get($semantic-typography-heading-h5, font-family);
    font-size: map-get($semantic-typography-heading-h5, font-size);
    font-weight: map-get($semantic-typography-heading-h5, font-weight);
    line-height: map-get($semantic-typography-heading-h5, line-height);
    margin-bottom: $semantic-spacing-component-sm;
    color: $semantic-color-text-primary;
  }
  
  ul {
    list-style: none;
    padding: 0;
    margin: 0;
    
    li {
      padding: $semantic-spacing-component-xs;
      margin-bottom: $semantic-spacing-component-xs;
      border-radius: $semantic-border-radius-sm;
      color: $semantic-color-text-secondary;
      cursor: pointer;
      transition: all $semantic-motion-duration-fast $semantic-motion-easing-ease;
      
      &:hover {
        background: $semantic-color-surface-elevated;
        color: $semantic-color-text-primary;
      }
    }
  }
  
  nav ul li {
    display: flex;
    align-items: center;
    gap: $semantic-spacing-component-xs;
  }
}

.demo-controls {
  display: flex;
  flex-wrap: wrap;
  gap: $semantic-spacing-component-md;
  margin-bottom: $semantic-spacing-component-lg;
  padding: $semantic-spacing-component-md;
  background: $semantic-color-surface-elevated;
  border-radius: $semantic-border-radius-md;
  border: $semantic-border-width-1 solid $semantic-color-border-secondary;
  
  label {
    display: flex;
    flex-direction: column;
    gap: $semantic-spacing-component-xs;
    font-family: map-get($semantic-typography-label, font-family);
    font-size: map-get($semantic-typography-label, font-size);
    font-weight: map-get($semantic-typography-label, font-weight);
    line-height: map-get($semantic-typography-label, line-height);
    color: $semantic-color-text-primary;
    
    select, input {
      padding: $semantic-spacing-interactive-input-padding-y $semantic-spacing-interactive-input-padding-x;
      border: $semantic-border-width-1 solid $semantic-color-border-primary;
      border-radius: $semantic-border-input-radius;
      background: $semantic-color-surface;
      color: $semantic-color-text-primary;
      font-family: map-get($semantic-typography-input, font-family);
      font-size: map-get($semantic-typography-input, font-size);
      transition: border-color $semantic-motion-duration-fast $semantic-motion-easing-ease;
      
      &:focus {
        outline: 2px solid $semantic-color-focus;
        outline-offset: 2px;
        border-color: $semantic-color-border-focus;
      }
    }
    
    input[type="checkbox"] {
      width: auto;
      margin-right: $semantic-spacing-component-xs;
    }
  }
}

.demo-button {
  padding: $semantic-spacing-interactive-button-padding-y $semantic-spacing-interactive-button-padding-x;
  background: $semantic-color-primary;
  color: $semantic-color-on-primary;
  border: none;
  border-radius: $semantic-border-button-radius;
  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;
  
  &:hover {
    box-shadow: $semantic-shadow-button-hover;
  }
  
  &:focus-visible {
    outline: 2px solid $semantic-color-focus;
    outline-offset: 2px;
  }
  
  &:active {
    box-shadow: $semantic-shadow-button-rest;
  }
}

// Responsive design
@media (max-width: 768px) {
  .demo-row {
    grid-template-columns: 1fr;
  }
  
  .demo-controls {
    flex-direction: column;
    
    label {
      flex-direction: row;
      align-items: center;
      gap: $semantic-spacing-component-sm;
    }
  }
  
  .sidebar-demo-container {
    height: 250px;
    
    &--interactive {
      height: 300px;
    }
  }
}