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

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

.demo-section {
  margin-bottom: $semantic-spacing-layout-section-xl;
  
  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;
    border-bottom: $semantic-border-width-1 solid $semantic-color-border-subtle;
    padding-bottom: $semantic-spacing-component-sm;
  }
  
  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-secondary;
    margin-bottom: $semantic-spacing-component-sm;
  }
  
  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-component-md;
  }
}

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

.demo-item {
  padding: $semantic-spacing-component-md;
  background: $semantic-color-surface-secondary;
  border-radius: $semantic-border-radius-md;
  border: $semantic-border-width-1 solid $semantic-color-border-subtle;
}

.demo-controls {
  display: flex;
  flex-wrap: wrap;
  gap: $semantic-spacing-component-sm;
  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-subtle;
  
  button {
    padding: $semantic-spacing-interactive-button-padding-y $semantic-spacing-interactive-button-padding-x;
    border: $semantic-border-width-1 solid $semantic-color-border-primary;
    border-radius: $semantic-border-radius-sm;
    background: $semantic-color-surface-primary;
    color: $semantic-color-text-primary;
    cursor: pointer;
    transition: all $semantic-motion-duration-fast $semantic-motion-easing-ease;
    
    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);
    
    &:hover {
      background: $semantic-color-surface-elevated;
      box-shadow: $semantic-shadow-button-hover;
    }
    
    &:focus-visible {
      outline: 2px solid $semantic-color-focus;
      outline-offset: 2px;
    }
    
    &.active {
      background: $semantic-color-primary;
      color: $semantic-color-on-primary;
      border-color: $semantic-color-primary;
    }
    
    &:disabled {
      opacity: $semantic-opacity-disabled;
      cursor: not-allowed;
      pointer-events: none;
    }
  }
}

.selection-info {
  margin-top: $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-subtle;
  
  p {
    font-weight: $semantic-typography-font-weight-semibold;
    margin-bottom: $semantic-spacing-component-sm;
  }
  
  ul {
    list-style: none;
    padding: 0;
    margin: 0;
    
    li {
      padding: $semantic-spacing-content-line-tight 0;
      border-bottom: $semantic-border-width-1 solid $semantic-color-border-subtle;
      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);
      
      &:last-child {
        border-bottom: none;
      }
    }
  }
}

.event-log {
  background: $semantic-color-surface-elevated;
  border-radius: $semantic-border-radius-md;
  border: $semantic-border-width-1 solid $semantic-color-border-subtle;
  overflow: hidden;
  
  .event-controls {
    padding: $semantic-spacing-component-md;
    border-bottom: $semantic-border-width-1 solid $semantic-color-border-subtle;
    background: $semantic-color-surface-secondary;
    
    button {
      padding: $semantic-spacing-interactive-button-padding-y $semantic-spacing-interactive-button-padding-x;
      border: $semantic-border-width-1 solid $semantic-color-border-primary;
      border-radius: $semantic-border-radius-sm;
      background: $semantic-color-surface-primary;
      color: $semantic-color-text-primary;
      cursor: pointer;
      transition: all $semantic-motion-duration-fast $semantic-motion-easing-ease;
      
      font-family: map-get($semantic-typography-button-small, font-family);
      font-size: map-get($semantic-typography-button-small, font-size);
      font-weight: map-get($semantic-typography-button-small, font-weight);
      line-height: map-get($semantic-typography-button-small, line-height);
      
      &:hover {
        background: $semantic-color-surface-elevated;
        box-shadow: $semantic-shadow-button-hover;
      }
      
      &:focus-visible {
        outline: 2px solid $semantic-color-focus;
        outline-offset: 2px;
      }
    }
  }
  
  .event-list {
    max-height: 300px;
    overflow-y: auto;
    
    .no-events {
      padding: $semantic-spacing-component-lg;
      text-align: center;
      color: $semantic-color-text-tertiary;
      font-style: italic;
    }
    
    .event-item {
      display: grid;
      grid-template-columns: 120px 1fr auto;
      gap: $semantic-spacing-component-sm;
      padding: $semantic-spacing-component-sm $semantic-spacing-component-md;
      border-bottom: $semantic-border-width-1 solid $semantic-color-border-subtle;
      
      &:last-child {
        border-bottom: none;
      }
      
      .event-type {
        font-weight: $semantic-typography-font-weight-semibold;
        color: $semantic-color-primary;
        font-family: map-get($semantic-typography-body-small, font-family);
        font-size: map-get($semantic-typography-body-small, font-size);
        line-height: map-get($semantic-typography-body-small, line-height);
      }
      
      .event-details {
        color: $semantic-color-text-primary;
        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);
      }
      
      .event-time {
        color: $semantic-color-text-tertiary;
        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);
        white-space: nowrap;
      }
    }
  }
}

// Responsive Design
@media (max-width: $semantic-breakpoint-md - 1) {
  .demo-container {
    padding: $semantic-spacing-component-md;
  }
  
  .demo-grid {
    grid-template-columns: 1fr;
    gap: $semantic-spacing-grid-gap-md;
  }
  
  .demo-controls {
    flex-direction: column;
    align-items: stretch;
    
    button {
      width: 100%;
      text-align: center;
    }
  }
  
  .event-item {
    grid-template-columns: 1fr;
    gap: $semantic-spacing-content-line-tight;
    
    .event-time {
      justify-self: end;
      grid-row: 1;
      grid-column: 1;
    }
    
    .event-type {
      grid-row: 2;
      grid-column: 1;
    }
    
    .event-details {
      grid-row: 3;
      grid-column: 1;
    }
  }
}

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