/* Prevent unwanted scrolling on mobile interactions */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
    position: relative;
  }

  html {
    overflow-x: hidden;
  }

  .navbar {
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .navbar-links.mobile-open {
    max-height: 80vh;
    overflow-y: auto;
  }

  input:focus,
  textarea:focus,
  select:focus,
  button:focus {
    scroll-margin-top: 0;
  }
}

/* Tablet */
@media (max-width: 768px) {
  .hero-content h2 {
    font-size: 32px;
  }

  .hero-content p {
    font-size: 16px;
  }

  .demo-card {
    padding: 24px;
  }

  .benefits-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .use-cases-grid {
    grid-template-columns: 1fr;
  }

  .pricing-content {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .api-actions {
    flex-direction: column;
  }

  .api-actions .btn {
    width: 100%;
  }

  .docs-content {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .docs-sidebar {
    position: static;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .hero-content h2 {
    font-size: 24px;
    line-height: 1.3;
  }

  .hero-content p {
    font-size: 14px;
  }

  .playground-selector {
    gap: 8px;
    justify-content: center;
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }

  .system-btn {
    padding: 8px 12px;
    font-size: 12px;
    flex: 1;
    flex-shrink: 0;
  }

  .demo-card {
    padding: 16px;
  }

  .demo-textarea {
    min-height: 100px;
    font-size: 14px;
  }

  .btn-lg {
    width: 100%;
    padding: 12px 16px;
  }

  .results-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .results-actions {
    width: 100%;
    flex-direction: column;
  }

  .results-actions .btn {
    width: 100%;
  }

  .results-table {
    font-size: 12px;
  }

  .results-table th,
  .results-table td {
    padding: 8px;
  }

  .benefits h2,
  .use-cases h2,
  .pricing h2,
  .api-example h2,
  .cta h2 {
    font-size: 24px;
  }

  /* Benefits grid - single column */
  .benefits-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .benefit-card {
    padding: 20px;
  }

  .benefit-icon {
    font-size: 32px;
    margin-bottom: 12px;
  }

  .benefit-card h3 {
    font-size: 14px;
  }

  .benefit-card p {
    font-size: 12px;
  }

  /* Use cases grid - single column */
  .use-cases-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .use-case-card {
    padding: 16px;
  }

  .use-case-card h3 {
    font-size: 14px;
  }

  .use-case-card p {
    font-size: 12px;
  }

  /* Pricing content - stack vertically */
  .pricing-content {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .pricing-info h3 {
    font-size: 16px;
  }

  .pricing-example h4 {
    font-size: 14px;
  }

  .pricing-table td {
    padding: 8px 0;
    font-size: 12px;
  }

  /* Limitations grid - single column */
  .limitations-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .limitation-card {
    padding: 16px;
  }

  .limitation-icon {
    font-size: 24px;
  }

  .limitation-card h3 {
    font-size: 13px;
  }

  .limitation-card p {
    font-size: 11px;
  }

  /* Comparison table - stack cells */
  .comparison-row {
    grid-template-columns: 1fr;
  }

  .comparison-cell {
    padding: 12px;
    font-size: 12px;
    border-bottom: 1px solid #e5e7eb;
  }

  .comparison-row.header .comparison-cell {
    font-weight: 700;
    background: #f3f4f6;
    padding: 12px;
  }

  .code-example {
    padding: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .code-example pre {
    font-size: 10px;
    white-space: pre-wrap;
    word-break: break-word;
  }

  .results-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .results-table {
    min-width: 100%;
  }

  .why-we-work {
    padding: 16px;
  }

  .why-we-work h3 {
    font-size: 14px;
    margin-bottom: 20px;
  }

  .cta p {
    font-size: 14px;
  }

  .auth-card {
    padding: 24px 16px;
  }

  .auth-header h1 {
    font-size: 20px;
  }

  .form-group input {
    font-size: 16px;
  }

  .docs-header h1 {
    font-size: 24px;
  }

  .docs-nav h3 {
    font-size: 12px;
  }

  .docs-nav a {
    font-size: 12px;
  }

  .doc-section h2 {
    font-size: 20px;
  }

  .doc-section h3 {
    font-size: 16px;
  }

  /* Prevent horizontal overflow */
  body {
    overflow-x: hidden;
  }

  .code-block {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .code-block pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 10px;
  }
}

/* Extra small devices */
@media (max-width: 360px) {
  .hero-content h2 {
    font-size: 20px;
  }

  .system-btn {
    padding: 6px 10px;
    font-size: 11px;
    flex: none;
  }

  .btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .results-table {
    font-size: 11px;
  }

  .results-table th,
  .results-table td {
    padding: 6px;
  }

  /* Prevent horizontal overflow */
  body {
    overflow-x: hidden;
  }

  .code-block {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .code-block pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 10px;
  }

  .results-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .results-table {
    min-width: 100%;
  }

  .playground-selector {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }

  .system-btn {
    flex-shrink: 0;
  }
}
