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

.enhanced-table-demo {
  padding: $semantic-spacing-layout-section-lg;
  max-width: 1400px;
  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;
  }
  
  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;
  }
  
  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;
  }
  
  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 Controls
.demo-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: $semantic-spacing-grid-gap-lg;
  margin-bottom: $semantic-spacing-layout-section-lg;
  padding: $semantic-spacing-component-lg;
  background: $semantic-color-surface-elevated;
  border: $semantic-border-width-1 solid $semantic-color-border-subtle;
  border-radius: $semantic-border-card-radius;
  box-shadow: $semantic-shadow-elevation-1;
}

.demo-control-group {
  h3 {
    font-size: map-get($semantic-typography-body-large, font-size);
    font-weight: $semantic-typography-font-weight-semibold;
    margin-bottom: $semantic-spacing-component-sm;
    color: $semantic-color-text-primary;
  }
  
  label {
    display: flex;
    align-items: center;
    gap: $semantic-spacing-component-xs;
    margin-bottom: $semantic-spacing-component-sm;
    font-size: map-get($semantic-typography-body-medium, font-size);
    font-family: map-get($semantic-typography-body-medium, font-family);
    color: $semantic-color-text-primary;
    cursor: pointer;
    
    input[type="checkbox"] {
      accent-color: $semantic-color-primary;
    }
    
    select {
      padding: $semantic-spacing-component-xs $semantic-spacing-component-sm;
      border: $semantic-border-width-1 solid $semantic-color-border-primary;
      border-radius: $semantic-border-input-radius;
      background: $semantic-color-surface-primary;
      color: $semantic-color-text-primary;
      font-size: map-get($semantic-typography-body-medium, font-size);
      
      &:focus {
        outline: none;
        border-color: $semantic-color-focus;
        box-shadow: 0 0 0 2px rgba($semantic-color-focus, 0.2);
      }
    }
  }
  
  p {
    font-size: map-get($semantic-typography-body-small, font-size);
    color: $semantic-color-text-tertiary;
    margin: 0;
  }
}

.demo-button {
  padding: $semantic-spacing-component-sm $semantic-spacing-component-md;
  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);
  cursor: pointer;
  transition: all $semantic-motion-duration-fast $semantic-motion-easing-ease;
  margin: $semantic-spacing-component-xs;
  
  &:hover:not(:disabled) {
    box-shadow: $semantic-shadow-button-hover;
  }
  
  &:focus-visible {
    outline: 2px solid $semantic-color-focus;
    outline-offset: 2px;
  }
  
  &--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;
    }
  }
  
  &--small {
    padding: $semantic-spacing-component-xs $semantic-spacing-component-sm;
    font-size: map-get($semantic-typography-button-small, font-size);
  }
}

// Performance Metrics
.performance-metrics {
  margin-bottom: $semantic-spacing-layout-section-md;
  padding: $semantic-spacing-component-md;
  background: $semantic-color-surface-secondary;
  border-radius: $semantic-border-input-radius;
  border-left: 4px solid $semantic-color-info;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: $semantic-spacing-component-md;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: $semantic-spacing-component-xs;
  
  .metric-label {
    font-size: map-get($semantic-typography-body-small, font-size);
    color: $semantic-color-text-secondary;
  }
  
  .metric-value {
    font-size: map-get($semantic-typography-body-large, font-size);
    font-weight: $semantic-typography-font-weight-semibold;
    color: $semantic-color-primary;
  }
}

// Table Container
.table-container {
  margin-bottom: $semantic-spacing-layout-section-lg;
  border-radius: $semantic-border-card-radius;
  overflow: hidden;
  box-shadow: $semantic-shadow-elevation-2;
}

// Cell Templates
.salary-cell {
  font-weight: $semantic-typography-font-weight-semibold;
  color: $semantic-color-success;
}

.performance-cell {
  display: flex;
  align-items: center;
  gap: $semantic-spacing-component-sm;
  width: 100%;
}

.performance-bar {
  flex: 1;
  height: 8px;
  background: $semantic-color-border-subtle;
  border-radius: $semantic-border-radius-full;
  overflow: hidden;
}

.performance-fill {
  height: 100%;
  border-radius: $semantic-border-radius-full;
  transition: width $semantic-motion-duration-normal $semantic-motion-easing-ease;
  
  &.performance-excellent {
    background: $semantic-color-success;
  }
  
  &.performance-good {
    background: $semantic-color-info;
  }
  
  &.performance-average {
    background: $semantic-color-warning;
  }
  
  &.performance-poor {
    background: $semantic-color-danger;
  }
}

.performance-text {
  font-size: map-get($semantic-typography-body-small, font-size);
  font-weight: $semantic-typography-font-weight-medium;
  min-width: 35px;
  text-align: right;
}

.action-buttons {
  display: flex;
  gap: $semantic-spacing-component-xs;
}

.action-btn {
  padding: $semantic-spacing-component-xs $semantic-spacing-component-sm;
  border: none;
  border-radius: $semantic-border-radius-sm;
  font-size: map-get($semantic-typography-body-small, font-size);
  font-weight: $semantic-typography-font-weight-medium;
  cursor: pointer;
  transition: all $semantic-motion-duration-fast $semantic-motion-easing-ease;
  
  &--primary {
    background: $semantic-color-primary;
    color: $semantic-color-on-primary;
    
    &:hover {
      opacity: $semantic-opacity-hover;
    }
  }
  
  &--danger {
    background: $semantic-color-danger;
    color: $semantic-color-on-danger;
    
    &:hover {
      opacity: $semantic-opacity-hover;
    }
  }
  
  &:focus-visible {
    outline: 2px solid $semantic-color-focus;
    outline-offset: 1px;
  }
}

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

.state-section {
  padding: $semantic-spacing-component-md;
  background: $semantic-color-surface-elevated;
  border: $semantic-border-width-1 solid $semantic-color-border-subtle;
  border-radius: $semantic-border-input-radius;
  
  h4 {
    margin-bottom: $semantic-spacing-component-sm;
    color: $semantic-color-text-primary;
  }
}

.state-content {
  p {
    margin: 0;
    color: $semantic-color-text-tertiary;
    font-style: italic;
  }
}

.sort-item,
.filter-item {
  padding: $semantic-spacing-component-xs 0;
  font-size: map-get($semantic-typography-body-small, font-size);
  color: $semantic-color-text-primary;
  border-bottom: $semantic-border-width-1 solid $semantic-color-border-subtle;
  
  &:last-child {
    border-bottom: none;
  }
  
  strong {
    color: $semantic-color-primary;
  }
}

// Feature Demo
.feature-demo {
  padding: $semantic-spacing-component-lg;
  background: $semantic-color-surface-secondary;
  border-radius: $semantic-border-card-radius;
  border-left: 4px solid $semantic-color-primary;
}

.feature-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: $semantic-spacing-grid-gap-lg;
}

.feature-item {
  h4 {
    font-size: map-get($semantic-typography-body-large, font-size);
    margin-bottom: $semantic-spacing-component-xs;
    color: $semantic-color-text-primary;
  }
  
  p {
    font-size: map-get($semantic-typography-body-small, font-size);
    color: $semantic-color-text-secondary;
    margin: 0;
  }
}

// Responsive Design
@media (max-width: 1200px) {
  .enhanced-table-demo {
    padding: $semantic-spacing-component-md;
  }
  
  .demo-controls {
    grid-template-columns: 1fr;
  }
  
  .feature-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .state-display {
    grid-template-columns: 1fr;
  }
  
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .performance-cell {
    flex-direction: column;
    gap: $semantic-spacing-component-xs;
    
    .performance-bar {
      width: 100%;
    }
  }
  
  .action-buttons {
    flex-direction: column;
  }
}

// Print styles
@media print {
  .demo-controls,
  .performance-metrics,
  .state-display,
  .feature-demo {
    display: none !important;
  }
}