// Demo Page Shared Styles
// This stylesheet contains all the common styles for component demo pages

.demo-nav-spacer .demo-nav-back {
  margin-top: 30px;
}

.demo-page {
  min-height: 100vh;
  padding-block: 4rem;
}

.component-demo {
  padding: 2rem 0;

  &.x-padding {
    padding-inline: 2.5rem;
  }
}

.demo-header {
  margin-bottom: 3rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 2rem;
}

.demo-nav {
  margin-bottom: 1rem;

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background-color: transparent;
    border-color: #64748b;
    color: #64748b;

    &:hover {
      background-color: #64748b;
      color: white;
    }

    &--outline {
      background-color: transparent;
      border-color: #64748b;
      color: #64748b;

      &:hover {
        background-color: #64748b;
        color: white;
      }
    }

    &--small {
      padding: 0.5rem 1rem;
      font-size: 0.875rem;
    }
  }
}

.demo-subtitle {
  font-size: 1.125rem;
  color: #64748b;
  margin-top: 0.5rem;
}

.demo-section {
  margin-bottom: 4rem;

  >.section-grid h2:not([class]) {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 1rem;
    border-bottom: 3px solid #667eea;
    padding-bottom: 0.5rem;
  }

  >.section-grid h3:not([class]) {
    font-size: 1.75rem;
    color: #444;
    margin: 2rem 0 1rem;
  }

  >.section-grid h4:not([class]) {
    font-size: 1.25rem;
    color: #555;
    margin-bottom: 1rem;
  }

  .section-intro {
    font-size: 1.125rem;
    color: #666;
    margin-bottom: 2rem;
    line-height: 1.6;
  }
}

.demo-example {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  margin: 1.5rem 0;
}

.demo-preview {
  padding: 2rem;
  background: white;
  border-bottom: 1px solid #e2e8f0;
}

.demo-content {
  background: #f8f9fa;
  padding: 2rem;
  border-radius: 8px;
  margin-bottom: 2rem;
}

.demo-form {
  max-width: 600px;

  &--complete {
    max-width: none;
  }
}

.form-section {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e2e8f0;

  &:last-of-type {
    border-bottom: none;
    margin-bottom: 2rem;
  }

  h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
  }
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;

  @media (max-width: 640px) {
    flex-direction: column;
  }
}

.demo-code {
  padding: 1rem;
  background: #1e293b;

  pre {
    margin: 0;

    code {
      color: #e2e8f0;
      font-family: "Monaco", "Menlo", monospace;
      font-size: 0.875rem;
      line-height: 1.6;
    }
  }
}

.props-table {
  overflow-x: auto;
  margin: 1.5rem 0;

  table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
  }

  th,
  td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
  }

  th {
    background: #f8fafc;
    font-weight: 600;
    color: #374151;
  }

  code {
    background: #f1f5f9;
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-size: 0.875rem;
    color: #1e293b;
  }
}

// Accessibility Features Grid
.accessibility-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.accessibility-item {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);

  h4 {
    color: #667eea;
    margin-bottom: 1rem;
    font-size: 1.1rem;
  }

  ul {
    margin: 0;
    padding-left: 1.5rem;
    line-height: 1.6;
  }

  li {
    margin-bottom: 0.5rem;
  }

  kbd {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    padding: 0.1em 0.4em;
    font-size: 0.875em;
    font-family: monospace;
  }

  code {
    background: #f1f5f9;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.875em;
    font-family: monospace;
  }
}

// Design Guidelines Grid
.guidelines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.guideline-item {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);

  h4 {
    margin-bottom: 1rem;
    font-size: 1.1rem;

    &:first-child {
      color: #059669; // Green for "Do"
    }

    &:nth-child(1):contains("❌") {
      color: #dc2626; // Red for "Don't"
    }
  }

  ul {
    margin: 0;
    padding-left: 1.5rem;
    line-height: 1.6;
  }

  li {
    margin-bottom: 0.5rem;
    color: #666;
  }
}

// Code blocks
pre {
  background: #2d3748;
  color: #e2e8f0;
  padding: 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1rem 0;

  code {
    font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
    font-size: 0.9rem;
    line-height: 1.5;
  }
}

// Legacy support for old CSS classes (can be removed once all pages are updated)
.accessibility-info,
.guidelines {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.guidelines {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.guideline h3 {
  color: #374151;
  margin-bottom: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}

.guideline ul {
  margin: 0;
  padding-left: 1.25rem;
}

.guideline li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

// Component-specific styles
.variants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.variant-demo {
  h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #374151;
  }
}

.checkbox-grid {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}

.checkbox-fieldset {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;

  &__legend {
    font-weight: 600;
    color: #374151;
    padding: 0 0.5rem;
    margin-bottom: 1rem;
  }
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;

  @media (max-width: 640px) {
    grid-template-columns: 1fr;
  }
}

// Responsive adjustments
@media (max-width: 768px) {
  .demo-page {
    padding-block: 2rem;
  }

  .component-demo {
    padding: 1rem 0;
  }

  .demo-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;

    h1 {
      font-size: 2rem;
    }

    .demo-subtitle {
      font-size: 1rem;
    }
  }

  .demo-preview {
    padding: 1rem;
  }

  .demo-content {
    padding: 1.5rem;
  }

  .demo-section {
    margin-bottom: 3rem;

    h2 {
      font-size: 2rem;
    }

    h3 {
      font-size: 1.5rem;
    }
  }

  .demo-form {
    max-width: none;
  }

  .guidelines {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .variants-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .accessibility-grid,
  .guidelines-grid {
    grid-template-columns: 1fr;
  }

  .props-table {
    font-size: 0.8rem;
  }

  .props-table th,
  .props-table td {
    padding: 0.5rem;
  }
}

.welcome-page {
  min-height: 100vh;
}

/* Button styles for anchor links */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  padding: 0.75rem 1.5rem;

  &:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
  }

  &--primary {
    background-color: #007bff;
    border-color: #007bff;
    color: white;

    &:hover {
      background-color: #0056b3;
      border-color: #0056b3;
    }
  }

  &--outline {
    background-color: transparent;
    border-color: #007bff;
    color: #007bff;

    &:hover {
      background-color: #007bff;
      color: white;
    }
  }

  &--medium {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }
}

.hero {
  padding: 4rem 0;
  text-align: center;

  &__content {
    max-width: 800px;
    margin: 0 auto;
  }

  h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #333;
    font-weight: 700;
  }

  &__subtitle {
    font-size: 1.25rem;
    color: #666;
    margin-bottom: 2rem;
    line-height: 1.6;
  }

  &__actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
  }
}

.quick-start {
  padding: 4rem 0;
  background-color: #f8f9fa;

  h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: #333;
  }

  &__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
  }

  &__item {
    h3 {
      color: #007bff;
      margin-bottom: 1rem;
    }

    p {
      line-height: 1.6;
      color: #666;
    }

    code {
      background: #e9ecef;
      padding: 0.2em 0.4em;
      border-radius: 3px;
      font-size: 0.9em;
    }
  }
}

.resources {
  padding: 4rem 0;

  h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: #333;
  }

  &__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
  }

  &__item {
    text-decoration: none;
    text-align: center;
    padding: 2rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: box-shadow 0.2s ease;

    &:hover {
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    h3 {
      margin-bottom: 1rem;
      color: #333;

      a {
        color: inherit;
        text-decoration: none;

        &:hover {
          color: #007bff;
        }
      }
    }

    p {
      line-height: 1.6;
      color: #666;
      margin: 0;
    }
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hero {
    padding: 2rem 0;

    h1 {
      font-size: 2rem;
    }

    &__subtitle {
      font-size: 1.125rem;
    }

    &__actions {
      flex-direction: column;
      align-items: center;
    }
  }

  .quick-start,
  .resources {
    padding: 2rem 0;

    h2 {
      font-size: 2rem;
      margin-bottom: 2rem;
    }

    &__grid {
      grid-template-columns: 1fr;
      gap: 1.5rem;
    }
  }
}

// Demo Navigation Styles
.col--left {
  position: sticky;
  top: 2rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Custom scrollbar styling */
.col--left::-webkit-scrollbar {
  width: 6px;
}

.col--left::-webkit-scrollbar-track {
  background: transparent;
}

.col--left::-webkit-scrollbar-thumb {
  background: var(--color-border, #e1e5e9);
  border-radius: 3px;
}

.col--left::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-secondary, #666);
}

/* Firefox scrollbar */
.col--left {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border, #e1e5e9) transparent;
}

.demo-nav-back {
  margin-bottom: 1.5rem;
  position: sticky;
  top: 0;
  background: var(--color-background, #fff);
  z-index: 10;
  padding-bottom: 0.5rem;
}

.col--left h2 {
  position: sticky;
  top: 0;
  background: var(--color-background, #fff);
  z-index: 10;
  margin: 0 0 1rem 0;
  padding: 1rem 0 0.5rem 0;
}

.demo-nav-list--title {
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--color-border, #e1e5e9);
}

.demo-nav-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0 0;
  padding-bottom: 2rem;
  /* Extra space at bottom for better UX */
}

.demo-nav-list li {


  &:not(:first-child):has(.nav-header) {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border, #e1e5e9);
  }
}

.nav-header {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-primary, #333);
  margin: 1.5rem 0 0.75rem 0;
  padding: 0;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.nav-header:first-child {
  margin-top: 0;
}

.demo-nav-list a {
  display: block;
  padding: 0.5rem 0;
  text-decoration: none;
  color: var(--color-text-secondary, #666);
  border-radius: 4px;
  transition: color 0.2s ease;
}

.demo-nav-list a:hover {
  color: var(--color-text-primary, #333);
}

.demo-nav-list a.active {
  color: var(--color-primary, #007acc);
  font-weight: 600;
}

.demo-nav-list a.active::before {
  content: "→ ";
  margin-right: 0.25rem;
}

.colors-page {
  padding: 2rem 0;
}

.page-header {
  margin-bottom: 3rem;
}

.page-intro {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;

  h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #333;
    font-weight: 700;
  }

  p {
    font-size: 1.25rem;
    color: #666;
    line-height: 1.6;
  }
}

.color-showcase {
  margin-bottom: 4rem;

  h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #333;
  }

  p {
    margin-bottom: 2rem;
    color: #666;
    line-height: 1.6;
  }

  code {
    background-color: #f5f5f5;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: "Courier New", monospace;
    font-size: 0.9rem;
  }
}

.color-group {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

// New horizontal layout for color swatches
.color-swatches-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.color-swatch {
  flex: 0 0 100px;
  margin-bottom: 0.5rem;
}

.color-preview {
  width: 100%;
  height: 80px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  margin-bottom: 0.5rem;
}

.color-info {
  text-align: center;
}

.color-name {
  font-weight: 600;
  font-size: 1rem;
  color: #333;
  margin-bottom: 0.25rem;
}

.color-value {
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  color: #666;
}

.color-usage {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #eee;

  .usage-title {
    font-weight: 600;
    min-width: 80px;
  }

  .usage-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;

    code {
      background-color: #f0f0f0;
      padding: 0.2rem 0.4rem;
      border-radius: 3px;
      font-size: 0.85rem;
    }
  }
}

.usage-examples {
  h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #333;
  }

  p {
    margin-bottom: 2rem;
    color: #666;
    line-height: 1.6;
  }
}

.usage-example {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.example-item {
  padding: 1rem;
  border-radius: 6px;
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  font-weight: 600;
}

// Added demo-code styles directly to ensure consistent appearance
.demo-code {
  padding: 1rem;
  background: #1e293b;
  border-radius: 6px;

  pre {
    margin: 0;

    code {
      color: #e2e8f0;
      font-family: "Monaco", "Menlo", monospace;
      font-size: 0.875rem;
      line-height: 1.6;
    }
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .page-intro {
    h1 {
      font-size: 2rem;
    }

    p {
      font-size: 1.125rem;
    }
  }

  .color-showcase {
    h2 {
      font-size: 2rem;
    }
  }

  .usage-examples {
    h2 {
      font-size: 2rem;
    }
  }

  .color-swatches-row {
    flex-wrap: wrap;
    justify-content: center;
  }

  .color-swatch {
    flex: 0 0 80px;
  }

  .color-usage {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

.page-intro {
  text-align: center;
  margin-bottom: 3rem;

  h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #333;
  }

  p {
    font-size: 1.125rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
  }
}

h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: #333;
  margin-top: 3rem;

  &:first-of-type {
    margin-top: 0;
  }
}

h3 {
  font-size: 1.25rem;
  color: #495057;
  margin: 2rem 0 1rem 0;

  &:first-child {
    margin-top: 0;
  }
}

p {
  color: #666;
  margin-bottom: 1rem;
  line-height: 1.6;
}

.grid-demo-box {
  background-color: #e3f2fd;
  border: 2px solid #2196f3;
  border-radius: 4px;
  padding: 1rem;
  text-align: center;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  .expand-right & {
    border-right-width: 0;
    border-radius: 4px 0 0 4px;

    &::after {
      border-right-width: 2px;
      border-radius: 0 4px 4px 0;
    }
  }

  .expand-left & {
    border-left-width: 0;
    border-radius: 0 4px 4px 0;

    &::after {
      border-left-width: 2px;
      border-radius: 4px 0 0 4px;
    }
  }

  code {
    background-color: #1976d2;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    font-family: "Courier New", monospace;
  }

  p {
    margin: 0;
    font-size: 0.875rem;
    color: #666;
  }

  &--outline {
    background-color: transparent;
    border: 2px dashed #9c27b0;

    code {
      background-color: #9c27b0;
    }
  }

  &--accent {
    background-color: #f3e5f5;
    border-color: #9c27b0;

    code {
      background-color: #9c27b0;
    }
  }

  &--full {
    background-color: #e8f5e8;
    border-color: #4caf50;

    code {
      background-color: #4caf50;
    }
  }

  &--info {
    background-color: #fff3e0;
    border-color: #ff9800;
    text-align: left;

    h2,
    h3 {
      margin-top: 0;
      color: #e65100;
    }

    code {
      background-color: #ff9800;
      color: white;
    }
  }
}

.responsive-info {
  ul {
    margin: 1rem 0;
    padding-left: 1.5rem;

    li {
      margin-bottom: 0.5rem;
      line-height: 1.6;

      strong {
        color: #007bff;
      }
    }
  }

  .code-example {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1rem;
    margin: 1rem 0;

    code {
      background-color: transparent;
      color: #e83e8c;
      font-size: 1rem;
    }
  }
}

.usage-content {
  ul {
    margin: 1rem 0;
    padding-left: 1.5rem;

    li {
      margin-bottom: 0.5rem;
      line-height: 1.6;

      strong {
        color: #007bff;
      }

      code {
        background-color: #f8f9fa;
        color: #e83e8c;
        padding: 0.125rem 0.25rem;
        border-radius: 3px;
        font-size: 0.875rem;
      }
    }
  }

  p {
    line-height: 1.6;
    margin-bottom: 1rem;

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

/* Responsive adjustments */
@media (max-width: 768px) {
  .page-intro h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }
}