/**
 * Shared styles for documentation pages.
 * Import this file in your component and include the mixin.
 *
 * Usage in component:
 * @use 'valtech-components/styles/docs-page' as docs;
 *
 * styles: [`@include docs.page();`]
 */

@mixin page() {
  // Main layout
  .docs-page {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;

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

  .docs-page__content {
    min-width: 0;
  }

  .docs-page__toc {
    position: sticky;
    top: 2rem;
    height: fit-content;

    @media (max-width: 1024px) {
      display: none;
    }
  }

  // Header
  .docs-page__header {
    margin-bottom: 2rem;
  }

  .docs-page__badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.06);
    color: #555;
    margin-bottom: 0.75rem;

    body.dark &,
    html.ion-palette-dark &,
    body[data-theme='dark'] & {
      background: rgba(255, 255, 255, 0.1);
      color: #aaa;
    }
  }

  .docs-page__header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 0.75rem 0;
    color: var(--ion-text-color, #1a1a1a);

    @media (max-width: 768px) {
      font-size: 2rem;
    }
  }

  .docs-page__lead {
    font-size: 1.125rem;
    color: var(--ion-color-medium, #666);
    margin: 0;
    line-height: 1.6;

    @media (max-width: 768px) {
      font-size: 1rem;
    }
  }

  // Sections
  section {
    margin-bottom: 2rem;
  }

  // Headings
  h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: var(--ion-text-color, #1a1a1a);
    scroll-margin-top: 2rem;
  }

  h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 1.5rem 0 1rem 0;
    color: var(--ion-text-color, #1a1a1a);
  }

  h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.25rem 0 0.75rem 0;
    color: var(--ion-text-color, #1a1a1a);
  }

  // Text
  p {
    line-height: 1.7;
    color: var(--ion-text-color, #1a1a1a);
    margin: 0 0 1rem 0;
  }

  // Lists
  ul,
  ol {
    padding-left: 1.5rem;
    margin: 0 0 1rem 0;
  }

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

  // Links
  a {
    color: var(--ion-color-primary, #3880ff);
    text-decoration: none;

    &:hover {
      text-decoration: underline;
    }
  }

  // Code inline
  code:not([class*='language-']) {
    background: rgba(0, 0, 0, 0.06);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.875em;

    body.dark &,
    html.ion-palette-dark &,
    body[data-theme='dark'] & {
      background: rgba(255, 255, 255, 0.1);
    }
  }

  // Pre blocks (without syntax highlighting)
  pre:not([class*='language-']) {
    background: rgba(0, 0, 0, 0.04);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0 0 1rem 0;

    body.dark &,
    html.ion-palette-dark &,
    body[data-theme='dark'] & {
      background: rgba(255, 255, 255, 0.06);
    }

    code {
      background: none;
      padding: 0;
    }
  }

  // Tables
  table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
  }

  th,
  td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);

    body.dark &,
    html.ion-palette-dark &,
    body[data-theme='dark'] & {
      border-color: rgba(255, 255, 255, 0.1);
    }
  }

  th {
    font-weight: 600;
    background: rgba(0, 0, 0, 0.02);

    body.dark &,
    html.ion-palette-dark &,
    body[data-theme='dark'] & {
      background: rgba(255, 255, 255, 0.04);
    }
  }

  // Blockquote
  blockquote {
    margin: 0 0 1rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--ion-color-primary, #3880ff);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 0 8px 8px 0;

    body.dark &,
    html.ion-palette-dark &,
    body[data-theme='dark'] & {
      background: rgba(255, 255, 255, 0.04);
    }

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

  // Image
  img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
  }

  // Horizontal rule
  hr {
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin: 2rem 0;

    body.dark &,
    html.ion-palette-dark &,
    body[data-theme='dark'] & {
      border-color: rgba(255, 255, 255, 0.1);
    }
  }

  // Strong text
  strong {
    font-weight: 600;
  }
}

/**
 * Compact version without grid layout (for use inside other layouts)
 */
@mixin content() {
  // Headings
  h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: var(--ion-text-color, #1a1a1a);
    scroll-margin-top: 2rem;
  }

  h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 1.5rem 0 1rem 0;
    color: var(--ion-text-color, #1a1a1a);
  }

  h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.25rem 0 0.75rem 0;
    color: var(--ion-text-color, #1a1a1a);
  }

  p {
    line-height: 1.7;
    color: var(--ion-text-color, #1a1a1a);
    margin: 0 0 1rem 0;
  }

  ul,
  ol {
    padding-left: 1.5rem;
    margin: 0 0 1rem 0;
  }

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

  section {
    margin-bottom: 2rem;
  }

  a {
    color: var(--ion-color-primary, #3880ff);
    text-decoration: none;

    &:hover {
      text-decoration: underline;
    }
  }

  code:not([class*='language-']) {
    background: rgba(0, 0, 0, 0.06);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.875em;

    body.dark &,
    html.ion-palette-dark &,
    body[data-theme='dark'] & {
      background: rgba(255, 255, 255, 0.1);
    }
  }
}
