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

.accessibility-demo {
  padding: $semantic-spacing-layout-md;
  max-width: 1200px;
  margin: 0 auto;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

.demo-header {
  text-align: center;
  margin-bottom: $semantic-spacing-component-lg * 2;
  
  h1 {
    color: #1a1a1a;
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: $semantic-spacing-component-lg;
  }
  
  p {
    color: #666;
    font-size: 1.125rem;
  }
}

.demo-section {
  margin-bottom: $semantic-spacing-component-lg * 2;
  padding: $semantic-spacing-component-md $semantic-spacing-component-md;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  
  h2 {
    color: #1a1a1a;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: $semantic-spacing-component-lg;
    border-bottom: 2px solid #007bff;
    padding-bottom: $semantic-spacing-component-md / 2;
  }
  
  h3 {
    color: #1a1a1a;
    font-size: 1.25rem;
    font-weight: 600;
    margin: $semantic-spacing-component-lg 0 $semantic-spacing-component-lg / 2 0;
  }
}

// Preferences Display
.preferences-display {
  display: flex;
  flex-direction: column;
  gap: $semantic-spacing-component-sm;
  padding: $semantic-spacing-component-md;
  background: #fff;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
  
  p {
    margin: 0;
    font-size: 1rem;
    color: #666;
  }
}

// Demo Controls
.demo-controls {
  display: flex;
  flex-direction: column;
  gap: $semantic-spacing-component-md;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: $semantic-spacing-component-sm;
  
  label {
    font-weight: 500;
    color: #1a1a1a;
    font-size: 1rem;
  }
}

.button-group {
  display: flex;
  gap: $semantic-spacing-component-sm;
  flex-wrap: wrap;
  align-items: center;
}

.demo-input {
  padding: $semantic-spacing-component-md $semantic-spacing-component-md;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #1a1a1a;
  font-size: 1rem;
  transition: border-color 0.15s ease-out;
  
  &:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    border-color: #007bff;
  }
  
  &::placeholder {
    color: #999;
  }
}

.demo-select {
  @extend .demo-input;
  cursor: pointer;
}

.demo-textarea {
  @extend .demo-input;
  min-height: 80px;
  resize: vertical;
}

// Focus Demo
.focus-demo {
  display: flex;
  flex-direction: column;
  gap: $semantic-spacing-component-md;
}

// Focus Trap Demo
.trap-controls {
  margin-bottom: $semantic-spacing-component-lg;
}

.focus-trap-container {
  padding: $semantic-spacing-component-md * 1.5;
  border: 2px dashed #e0e0e0;
  border-radius: 8px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: $semantic-spacing-component-md;
  transition: all 0.3s ease-out;
  
  &.trap-enabled {
    border-color: #007bff;
    background: #f0f8ff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
  }
  
  h3 {
    margin-top: 0;
    color: #1a1a1a;
  }
  
  p {
    color: #666;
    margin: 0;
  }
}

// Navigation Demo
.navigation-demo {
  display: flex;
  flex-direction: column;
  gap: $semantic-spacing-component-lg;
}

.navigation-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  
  li {
    padding: $semantic-spacing-component-md $semantic-spacing-component-md;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.15s ease-out;
    color: #1a1a1a;
    
    &:last-child {
      border-bottom: none;
    }
    
    &:hover {
      background: #f5f5f5;
    }
    
    &:focus {
      outline: 2px solid #007bff;
      outline-offset: -2px;
      background: #f0f8ff;
    }
    
    &.disabled {
      opacity: 0.6;
      cursor: not-allowed;
      color: #999;
    }
  }
}

.navigation-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: $semantic-spacing-component-sm;
  padding: $semantic-spacing-component-md;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: #fff;
  
  .grid-item {
    padding: $semantic-spacing-component-md;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #e9ecef;
    color: #495057;
    cursor: pointer;
    transition: all 0.15s ease-out;
    font-size: 0.875rem;
    
    &:hover:not(:disabled) {
      background: #dee2e6;
    }
    
    &:focus {
      outline: 2px solid #007bff;
      outline-offset: 2px;
    }
    
    &:disabled {
      opacity: 0.6;
      cursor: not-allowed;
      background: #f8f9fa;
      color: #999;
    }
  }
}

// Modal Demo
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  min-width: 400px;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  animation: slideIn 0.3s ease-out;
  
  .modal-header {
    padding: $semantic-spacing-component-md $semantic-spacing-component-md;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    h3 {
      margin: 0;
      color: #1a1a1a;
    }
    
    .modal-close {
      background: none;
      border: none;
      font-size: 24px;
      cursor: pointer;
      color: #666;
      padding: 4px 8px;
      border-radius: 4px;
      transition: all 0.15s ease-out;
      
      &:hover {
        background: #f5f5f5;
        color: #1a1a1a;
      }
      
      &:focus {
        outline: 2px solid #007bff;
        outline-offset: 2px;
      }
    }
  }
  
  .modal-body {
    padding: $semantic-spacing-component-md * 1.5;
    
    p {
      color: #666;
      margin-bottom: $semantic-spacing-component-lg;
    }
    
    .demo-input {
      width: 100%;
      margin-bottom: $semantic-spacing-component-lg;
    }
  }
  
  .modal-footer {
    padding: $semantic-spacing-component-md $semantic-spacing-component-md;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: $semantic-spacing-component-sm;
    justify-content: flex-end;
  }
}

// Screen Reader Demo
.sr-demo {
  display: flex;
  flex-direction: column;
  gap: $semantic-spacing-component-md;
  
  p {
    color: #666;
    margin: $semantic-spacing-component-lg / 2 0;
  }
}

.status-demo {
  display: flex;
  flex-direction: column;
  gap: $semantic-spacing-component-sm;
}

// Keyboard Shortcuts
.shortcuts-info {
  background: #f5f5f5;
  padding: $semantic-spacing-component-md;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
}

.shortcuts-list {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: $semantic-spacing-component-sm $semantic-spacing-component-md;
  margin: 0;
  
  dt {
    font-weight: 500;
    color: #1a1a1a;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
  }
  
  dd {
    margin: 0;
    color: #666;
    display: flex;
    align-items: center;
  }
}

// Footer
.demo-footer {
  text-align: center;
  padding: $semantic-spacing-component-md * 2;
  border-top: 1px solid #e0e0e0;
  margin-top: $semantic-spacing-component-lg * 2;
  
  p {
    color: #666;
    font-size: 0.875rem;
    margin: 0;
  }
}

// Animations
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

// Responsive Design
@media (max-width: 768px) {
  .accessibility-demo {
    padding: $semantic-spacing-component-md / 2;
  }
  
  .demo-section {
    padding: $semantic-spacing-component-md / 2;
  }
  
  .button-group {
    flex-direction: column;
    align-items: stretch;
  }
  
  .navigation-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .shortcuts-list {
    grid-template-columns: 1fr;
    gap: $semantic-spacing-component-sm;
    
    dt {
      text-align: left;
    }
  }
  
  .modal-content {
    min-width: 90vw;
    margin: $semantic-spacing-component-md;
  }
}

// High Contrast Mode Support
@media (prefers-contrast: high) {
  .demo-section {
    border-color: ButtonText;
  }
  
  .focus-trap-container.trap-enabled {
    border-color: Highlight;
  }
  
  .navigation-list li:focus {
    outline-color: Highlight;
  }
  
  .grid-item:focus {
    outline-color: Highlight;
  }
}

// Reduced Motion Support
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01s !important;
    transition-duration: 0.01s !important;
  }
}