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

.demo-container {
  padding: $semantic-spacing-layout-section-lg;
  max-width: 1200px;
  margin: 0 auto;
  
  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;
  }
  
  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-section {
  margin-bottom: $semantic-spacing-layout-section-lg;
  padding: $semantic-spacing-component-lg;
  background: $semantic-color-surface-primary;
  border: $semantic-border-width-1 solid $semantic-color-border-subtle;
  border-radius: $semantic-border-card-radius;
  box-shadow: $semantic-shadow-elevation-1;
  
  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;
    border-bottom: $semantic-border-width-1 solid $semantic-color-border-subtle;
    padding-bottom: $semantic-spacing-component-sm;
  }
}

.demo-row {
  display: flex;
  flex-wrap: wrap;
  gap: $semantic-spacing-grid-gap-lg;
  align-items: flex-start;
  
  &--spaced {
    justify-content: space-around;
    
    .demo-example {
      min-width: 200px;
      text-align: center;
    }
  }
}

.demo-example {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: $semantic-spacing-component-md;
  padding: $semantic-spacing-component-lg;
  background: $semantic-color-surface-secondary;
  border: $semantic-border-width-1 solid $semantic-color-border-primary;
  border-radius: $semantic-border-input-radius;
  min-height: 120px;
  position: relative;
  
  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: 0 0 $semantic-spacing-component-sm 0;
    text-align: center;
  }
}

.demo-button {
  padding: $semantic-spacing-interactive-button-padding-y $semantic-spacing-interactive-button-padding-x;
  border: $semantic-border-width-1 solid $semantic-color-primary;
  border-radius: $semantic-border-button-radius;
  background: $semantic-color-primary;
  color: $semantic-color-on-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;
  
  &:hover:not(:disabled) {
    box-shadow: $semantic-shadow-button-hover;
  }
  
  &:focus-visible {
    outline: 2px solid $semantic-color-focus;
    outline-offset: 2px;
  }
  
  &:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: $semantic-shadow-button-rest;
  }
  
  &--secondary {
    background: $semantic-color-surface-primary;
    color: $semantic-color-text-primary;
    border-color: $semantic-color-border-primary;
    
    &:hover:not(:disabled) {
      background: $semantic-color-surface-secondary;
    }
  }
}

.demo-log {
  background: $semantic-color-surface-elevated;
  border: $semantic-border-width-1 solid $semantic-color-border-secondary;
  border-radius: $semantic-border-input-radius;
  padding: $semantic-spacing-component-md;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: $semantic-spacing-component-md;
  
  &__empty {
    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-tertiary;
    text-align: center;
    font-style: italic;
    margin: 0;
  }
  
  &__entry {
    display: flex;
    gap: $semantic-spacing-component-sm;
    padding: $semantic-spacing-component-xs;
    border-bottom: $semantic-border-width-1 solid $semantic-color-border-subtle;
    
    &:last-child {
      border-bottom: none;
    }
  }
  
  &__time {
    font-family: $semantic-typography-font-family-mono;
    font-size: map-get($semantic-typography-caption, font-size);
    color: $semantic-color-text-tertiary;
    flex-shrink: 0;
    min-width: 80px;
  }
  
  &__message {
    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);
    color: $semantic-color-text-primary;
  }
}

// Responsive design
@media (max-width: 768px) {
  .demo-container {
    padding: $semantic-spacing-component-md;
  }
  
  .demo-row {
    flex-direction: column;
    align-items: stretch;
    
    &--spaced {
      align-items: center;
    }
  }
  
  .demo-example {
    min-height: auto;
    padding: $semantic-spacing-component-md;
  }
  
  .demo-section {
    padding: $semantic-spacing-component-md;
  }
}

// Ensure positioned FAB menus are visible above demo content
:host {
  position: relative;
  z-index: 1;
}