/* Ticketify responsive layout layer.
   The admin UI primarily uses inline CSSProperties; these rules provide a
   consistent mobile fallback without changing desktop presentation. */

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

input,
select,
textarea,
button {
  max-width: 100%;
}

main,
main * {
  min-width: 0;
}

main p,
main span,
main strong,
main a,
main td,
main th,
main label {
  overflow-wrap: anywhere;
}

main table {
  max-width: 100%;
}

@media (max-width: 900px) {
  body main {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 18px !important;
    padding-right: 18px !important;
  }

  /* All dashboard, ticket, billing, settings and onboarding grids become
     single-column layouts on compact screens. */
  main [style*="grid-template-columns"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  main [style*="min-width"] {
    min-width: 0 !important;
  }

  main [style*="max-width"] {
    max-width: 100% !important;
  }

  main > header,
  main > section > header,
  main > article > header,
  main form > header {
    max-width: 100%;
  }

  /* Header/action rows and filter bars should wrap rather than overflow. */
  main [style*="display: flex"] {
    max-width: 100%;
    flex-wrap: wrap;
  }

  main form {
    max-width: 100%;
  }

  main input,
  main select,
  main textarea {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Wide data tables remain usable instead of forcing the full page wider. */
  main table {
    display: block;
    width: 100% !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  main pre,
  main code {
    max-width: 100%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 640px) {
  body main {
    padding: 18px 14px 28px !important;
  }

  main h1 {
    font-size: clamp(26px, 8vw, 34px) !important;
    line-height: 1.12 !important;
  }

  main h2 {
    font-size: clamp(20px, 6vw, 26px) !important;
    line-height: 1.2 !important;
  }

  /* Cards use the available screen width and lose oversized desktop padding. */
  main article,
  main section,
  main form,
  main [style*="border-radius"] {
    max-width: 100%;
  }

  main article[style*="padding: 32"],
  main section[style*="padding: 32"],
  main div[style*="padding: 32"] {
    padding: 20px !important;
  }

  main article[style*="padding: 28"],
  main section[style*="padding: 28"],
  main div[style*="padding: 28"] {
    padding: 18px !important;
  }

  main article[style*="padding: 24"],
  main section[style*="padding: 24"],
  main div[style*="padding: 24"] {
    padding: 16px !important;
  }

  /* Ticket rows, pricing cards and other grid-based records are rendered as
     readable vertical cards on phones. */
  main a[style*="display: grid"],
  main article[style*="display: grid"],
  main div[style*="display: grid"] {
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
  }

  /* Action controls are touch friendly. */
  main button,
  main input[type="submit"],
  main input[type="button"] {
    min-height: 44px;
  }

  main select,
  main input:not([type="checkbox"]):not([type="radio"]),
  main textarea {
    min-height: 44px;
    font-size: 16px !important;
  }

  main textarea {
    min-height: 110px;
  }

  /* Multi-button action bars become easy-to-tap stacked controls. */
  main [style*="display: flex"] > button,
  main [style*="display: flex"] > a {
    max-width: 100%;
  }

  main [style*="justify-content: space-between"] {
    gap: 12px !important;
  }

  main [style*="position: sticky"] {
    position: static !important;
  }
}

@media (max-width: 420px) {
  body main {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  /* On very small phones, action buttons use the full card width. */
  main form button,
  main form a[style*="padding"],
  main header a[style*="padding"] {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
  }

  main [style*="gap: 28"] {
    gap: 16px !important;
  }

  main [style*="gap: 24"] {
    gap: 14px !important;
  }
}
