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

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

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

  h3 {
    font-size: tokens.$semantic-typography-heading-h3-size;
    color: tokens.$semantic-color-text-primary;
    margin-bottom: tokens.$semantic-spacing-content-paragraph;
  }
}

.demo-section {
  margin-bottom: tokens.$semantic-spacing-layout-lg;

  &:last-child {
    margin-bottom: 0;
  }
}

.demo-row {
  display: flex;
  flex-wrap: wrap;
  gap: tokens.$semantic-spacing-component-sm;
  margin-bottom: tokens.$semantic-spacing-content-paragraph;
}

.demo-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: tokens.$semantic-sizing-button-height-md;
  padding: tokens.$semantic-spacing-component-sm tokens.$semantic-spacing-component-md;
  
  // Visual design
  background: tokens.$semantic-color-primary;
  color: tokens.$semantic-color-on-primary;
  border: none;
  border-radius: tokens.$semantic-border-radius-md;
  box-shadow: tokens.$semantic-shadow-button-rest;
  
  // Typography
  font-size: tokens.$semantic-typography-font-size-md;
  font-weight: tokens.$semantic-typography-font-weight-medium;
  text-decoration: none;
  white-space: nowrap;
  
  // Transitions
  transition: background-color tokens.$semantic-motion-duration-fast tokens.$semantic-motion-easing-ease,
              box-shadow tokens.$semantic-motion-duration-fast tokens.$semantic-motion-easing-ease,
              transform tokens.$semantic-motion-duration-fast tokens.$semantic-motion-easing-ease;
  
  // Cursor
  cursor: pointer;
  user-select: none;

  // Interactive states
  &:hover {
    background: tokens.$semantic-color-primary-hover;
    box-shadow: tokens.$semantic-shadow-button-hover;
    transform: translateY(-1px);
  }

  &:focus-visible {
    outline: 2px solid tokens.$semantic-color-focus;
    outline-offset: 2px;
  }

  &:active {
    background: tokens.$semantic-color-primary-pressed;
    box-shadow: tokens.$semantic-shadow-button-active;
    transform: translateY(0);
  }

  &:disabled {
    background: tokens.$semantic-color-surface-disabled;
    color: tokens.$semantic-color-text-disabled;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
  }
}

.demo-stats {
  display: flex;
  flex-direction: column;
  gap: tokens.$semantic-spacing-component-xs;
  
  p {
    font-size: tokens.$semantic-typography-font-size-md;
    color: tokens.$semantic-color-text-secondary;
    margin: 0;
    
    &:before {
      content: "📊 ";
      margin-right: tokens.$semantic-spacing-component-xs;
    }
  }
}

.overlay-content {
  padding: tokens.$semantic-spacing-component-lg;
  text-align: center;

  h3 {
    font-size: tokens.$semantic-typography-heading-h3-size;
    color: tokens.$semantic-color-text-primary;
    margin: 0 0 tokens.$semantic-spacing-content-paragraph 0;
  }

  p {
    font-size: tokens.$semantic-typography-font-size-md;
    color: tokens.$semantic-color-text-secondary;
    margin: 0 0 tokens.$semantic-spacing-content-heading 0;
    line-height: 1.5;
  }

  button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: tokens.$semantic-sizing-button-height-md;
    padding: tokens.$semantic-spacing-component-sm tokens.$semantic-spacing-component-lg;
    
    // Visual design
    background: tokens.$semantic-color-secondary;
    color: tokens.$semantic-color-on-secondary;
    border: tokens.$semantic-border-width-1 solid tokens.$semantic-color-border-primary;
    border-radius: tokens.$semantic-border-radius-md;
    box-shadow: tokens.$semantic-shadow-button-rest;
    
    // Typography
    font-size: tokens.$semantic-typography-font-size-md;
    font-weight: tokens.$semantic-typography-font-weight-medium;
    
    // Transitions
    transition: background-color tokens.$semantic-motion-duration-fast tokens.$semantic-motion-easing-ease,
                border-color tokens.$semantic-motion-duration-fast tokens.$semantic-motion-easing-ease,
                box-shadow tokens.$semantic-motion-duration-fast tokens.$semantic-motion-easing-ease,
                transform tokens.$semantic-motion-duration-fast tokens.$semantic-motion-easing-ease;
    
    cursor: pointer;

    &:hover {
      background: tokens.$semantic-color-secondary-hover;
      border-color: tokens.$semantic-color-border-primary;
      box-shadow: tokens.$semantic-shadow-button-hover;
      transform: translateY(-1px);
    }

    &:focus-visible {
      outline: 2px solid tokens.$semantic-color-focus;
      outline-offset: 2px;
    }

    &:active {
      background: tokens.$semantic-color-secondary-pressed;
      box-shadow: tokens.$semantic-shadow-button-active;
      transform: translateY(0);
    }
  }
}

.focus-trap-demo {
  display: flex;
  flex-direction: column;
  gap: tokens.$semantic-spacing-component-sm;
  align-items: center;
  
  button,
  input {
    min-height: tokens.$semantic-sizing-input-height-md;
    padding: tokens.$semantic-spacing-component-sm tokens.$semantic-spacing-component-md;
    border: tokens.$semantic-border-width-1 solid tokens.$semantic-color-border-primary;
    border-radius: tokens.$semantic-border-radius-md;
    font-size: tokens.$semantic-typography-font-size-md;
    
    &:focus-visible {
      outline: 2px solid tokens.$semantic-color-focus;
      outline-offset: 2px;
    }
  }
  
  input {
    background: tokens.$semantic-color-surface-secondary;
    color: tokens.$semantic-color-text-primary;
    
    &::placeholder {
      color: tokens.$semantic-color-text-tertiary;
    }
  }
  
  button {
    background: tokens.$semantic-color-tertiary;
    color: tokens.$semantic-color-on-tertiary;
    cursor: pointer;
    
    &:hover {
      background: tokens.$semantic-color-secondary-hover;
    }
    
    &:last-child {
      background: tokens.$semantic-color-danger;
      color: tokens.$semantic-color-on-danger;
      
      &:hover {
        background: tokens.$semantic-color-primary-hover;
      }
    }
  }
}

// Responsive Design
@media (max-width: #{tokens.$semantic-breakpoint-md - 1px}) {
  .demo-container {
    padding: tokens.$semantic-spacing-layout-sm;
  }
  
  .demo-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .demo-button {
    width: 100%;
  }
}

@media (max-width: #{tokens.$semantic-breakpoint-sm - 1px}) {
  .overlay-content {
    padding: tokens.$semantic-spacing-component-md;
  }
  
  .focus-trap-demo {
    button,
    input {
      width: 100%;
    }
  }
}