/* Desain123 Stock - responsive UI polish / fallback */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { min-width: 320px; overflow-x: hidden; margin: 0; }
img, svg, video, canvas { max-width: 100%; }
button, input, select, textarea { font: inherit; }
input, select, textarea { min-height: 44px; }
button, a { -webkit-tap-highlight-color: transparent; }

/* Prevent long words/URLs from breaking cards on narrow screens. */
main, main * { overflow-wrap: anywhere; }

/* Tables: allow horizontal scroll instead of stretching the page. */
main table { width: 100%; border-collapse: collapse; }
main .overflow-x-auto { -webkit-overflow-scrolling: touch; }

/* Mobile navigation */
.mobile-menu-trigger::-webkit-details-marker { display: none; }
.mobile-menu-trigger { list-style: none; }
.mobile-nav { flex: 0 0 auto; }
.mobile-menu-panel {
  max-height: calc(100vh - 88px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Better tap targets / form controls */
.mobile-menu-panel a,
.mobile-menu-panel button { min-height: 44px; }

@media (max-width: 767px) {
  header { overflow: visible; }
  header > .mx-auto {
    width: 100%;
    min-height: 64px;
  }
  header .mobile-menu-panel {
    position: fixed;
    top: 72px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    max-height: calc(100dvh - 84px);
    margin-top: 0;
    border-radius: 22px;
  }
  main { width: 100%; min-width: 0; overflow-x: hidden; }
  footer { overflow: hidden; }

  /* Keep the existing visual language, just reduce mobile density. */
  main h1 { line-height: 1.08; }
  main h2 { line-height: 1.12; }
  main .rounded-\[2rem\] { border-radius: 1.25rem; }
  main .rounded-\[1\.75rem\] { border-radius: 1.25rem; }

  /* Make common page containers breathe on phones. */
  main > div.mx-auto,
  main > section.mx-auto {
    padding-left: 16px;
    padding-right: 16px;
  }

  /* Grids become single-column unless the view explicitly keeps a tiny grid. */
  main .grid.sm\:grid-cols-2,
  main .grid.md\:grid-cols-2,
  main .grid.lg\:grid-cols-5,
  main .grid.lg\:grid-cols-4,
  main .grid.md\:grid-cols-4 {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* Catalog cards keep two columns where there is enough room. */
  /* Asset detail stacks cleanly. */
  main .lg\:col-span-3,
  main .lg\:col-span-2 { grid-column: auto !important; }

  /* Compact mobile footer. */
  footer .grid {
    grid-template-columns: 1fr !important;
    gap: 22px !important;
  }
  footer { margin-top: 48px !important; }
  footer .px-4 { padding-left: 16px !important; padding-right: 16px !important; }
  footer .py-14 { padding-top: 36px !important; padding-bottom: 36px !important; }

  /* Forms should never overflow. */
  input, select, textarea { width: 100%; max-width: 100%; }
  button { max-width: 100%; }

  /* Profile page: cards stack with compact spacing. */
  .profile-page { padding-top: 28px !important; padding-bottom: 42px !important; }
  .profile-page .profile-card { padding: 18px !important; border-radius: 20px !important; }
  .profile-page .profile-heading { font-size: 2.15rem !important; }
  .profile-page .profile-actions { justify-content: stretch !important; }
  .profile-page .profile-actions button { width: 100%; }
  .profile-page .profile-avatar-row { align-items: flex-start !important; }

  /* Prevent file input text from making the card wider than the screen. */
  input[type="file"] { min-width: 0; width: 100%; }

  /* Notifications / support / admin rows stay readable. */
  main .flex-wrap { row-gap: 12px; }
}

@media (max-width: 380px) {
  header > .mx-auto { gap: 8px !important; padding-left: 12px !important; padding-right: 12px !important; }
  header a.font-display { font-size: 1.15rem !important; }
  main .px-4 { padding-left: 12px !important; padding-right: 12px !important; }
  .profile-page .profile-heading { font-size: 1.9rem !important; }
}

@media (min-width: 768px) {
  /* Desktop keeps the original spacious proportions. */
  .mobile-nav { display: none !important; }
}

@media (min-width: 420px) and (max-width: 767px) {
  main .grid.sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
}
