/* Mobile-first enhancements for QR generator */

@media (max-width: 767px) {
  img, video, canvas {
    max-width: 100%;
    height: auto;
  }

  pre {
    max-width: 100%;
    overflow-x: auto;
  }

  body {
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .container {
    border-radius: 0;
    min-height: 100vh;
  }

  header {
    padding-top: 20px;
    padding-bottom: 0;
  }

  .logo {
    font-size: 1.55rem;
  }

  .tagline {
    font-size: 0.92rem;
  }

  main {
    padding-top: 16px;
    padding-bottom: 100px;
  }

  .generator-section {
    gap: 16px;
  }

  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex: 0 0 auto;
    min-width: 72px;
    padding: 12px 14px;
    font-size: 0.88rem;
  }

  .input-field,
  .generate-btn,
  .action-btn {
    font-size: 16px; /* prevent iOS zoom on focus */
  }

  .generate-btn {
    padding: 16px;
    position: sticky;
    bottom: calc(12px + env(safe-area-inset-bottom, 0));
    z-index: 10;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
  }

  .qr-display {
    min-height: 240px;
    padding: 20px;
  }

  .qr-display.has-qr {
    border-style: solid;
    border-color: #bfdbfe;
    background: #f8fafc;
  }

  .qr-display.has-qr canvas,
  .qr-display.has-qr img {
    max-width: min(100%, 280px);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
  }

  .action-buttons {
    flex-direction: column;
    gap: 8px;
  }

  .action-btn-primary {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
  }

  .action-btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
  }

  .mobile-save-hint {
    display: block;
    margin-top: 10px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.45;
  }

  .desktop-only {
    display: none !important;
  }

  /* Sticky save / share bar after QR is ready */
  .mobile-action-bar {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
    gap: 8px;
    grid-template-columns: 1fr 1fr;
  }

  .mobile-action-bar.visible {
    display: grid;
  }

  .mobile-action-bar button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 12px;
    border-radius: 12px;
    border: none;
    font-size: 0.95rem;
    font-weight: 650;
    cursor: pointer;
  }

  .mobile-action-bar .btn-save {
    background: var(--primary-color);
    color: #fff;
  }

  .mobile-action-bar .btn-share {
    background: #f1f5f9;
    color: var(--text-primary);
    border: 1px solid var(--border);
  }

  .info-section,
  .seo-section {
    display: none;
  }

  .site-footer {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0));
    font-size: 0.8rem;
  }

  .footer-links {
    flex-wrap: wrap;
    gap: 12px;
  }
}

@media (min-width: 768px) {
  .mobile-only {
    display: none !important;
  }

  .mobile-action-bar {
    display: none !important;
  }

  .mobile-save-hint {
    display: none;
  }
}
