/* ============================================================
   HASHMICYBERLINKS - v7.5  MOBILE FIRST — TOOLS
   ------------------------------------------------------------
   Har tool mobile par aasani se chale:
     • 2-column panels ek column ho jayen
     • thumbnails grid chhoti
     • buttons full width, tap-friendly (44px)
     • koi horizontal scroll nahi
   ============================================================ */

@media (max-width: 820px) {

  /* ---- tool page wrapper ---- */
  .form-card{padding:14px !important}

  /* ---- jpg-to-pdf / pdf workspace split panels ---- */
  #jpgReview > div{
    grid-template-columns:1fr !important;
    min-height:0 !important;
  }
  #jpgReview > div > div{
    border-right:0 !important;
    border-bottom:1px solid var(--border) !important;
    padding:14px !important;
  }

  /* ---- any 2-col grid inside a tool card ---- */
  .form-card [style*="grid-template-columns:1fr 1fr"],
  .form-card [style*="grid-template-columns: 1fr 1fr"],
  .form-card [style*="grid-template-columns:1fr 340px"],
  .form-card [style*="grid-template-columns:2fr"],
  .form-card [style*="grid-template-columns:3fr"]{
    grid-template-columns:1fr !important;
  }

  /* ---- image resizer 2-panel ---- */
  .ir-wrap,
  .ir-grid{
    grid-template-columns:1fr !important;
  }

  /* ---- thumbnails grid ---- */
  #jpgGrid,
  .thumb-grid,
  .hcl-grid{
    grid-template-columns:repeat(auto-fill, minmax(104px, 1fr)) !important;
    max-height:none !important;
  }

  /* ---- buttons: easy tapping ---- */
  .form-card .btn,
  .form-card button.btn,
  .ir-btn{
    min-height:44px;
    font-size:13.5px !important;
  }

  /* ---- form rows stack ---- */
  .form-card .row,
  .form-card .form-row,
  .form-card .ir-row{
    flex-direction:column !important;
    align-items:stretch !important;
  }
  .form-card input.input,
  .form-card select.input,
  .ir-input{
    width:100% !important;
    max-width:100% !important;
    min-height:44px;
    font-size:14px;
  }

  /* ---- preview boxes ---- */
  .ir-preview-box,
  #irOrigBox,
  #irResBox{
    min-height:170px !important;
  }

  /* ---- result / download button full width ---- */
  #irDl,
  .hcl-output-btn{
    width:100% !important;
    max-width:100% !important;
  }

  /* ---- no sideways scroll inside a tool ---- */
  .form-card{overflow-x:hidden}

  /* ---- tool guide readable ---- */
  .hcl-tool-guide{font-size:14px}
  .hcl-tool-guide h2{font-size:19px}
  .hcl-tool-guide h3{font-size:16px;margin-top:22px}
}

@media (max-width: 480px) {

  .form-card{padding:12px !important}
  #jpgReview > div > div{padding:12px !important}

  /* thumbnails 2 per row */
  #jpgGrid,
  .thumb-grid{
    grid-template-columns:repeat(auto-fill, minmax(84px, 1fr)) !important;
    gap:9px !important;
  }

  /* headings smaller */
  .form-card h1,
  .form-card h2{font-size:18px !important}
  .form-card h3{font-size:15.5px !important}

  /* optional controls can collapse rather than overflow */
  .hcl-mobile-hide{display:none !important}

  /* loader + output */
  .hcl-loader{padding:26px 12px}
  .hcl-output{padding:18px 13px}
}

/* ---- landscape phones / small tablets ---- */
@media (min-width:481px) and (max-width:820px){
  #jpgGrid{grid-template-columns:repeat(auto-fill, minmax(115px,1fr)) !important}
}

/* ---- make sure nothing forces a wide layout ---- */
@media (max-width:820px){
  .form-card img,
  .form-card canvas,
  .form-card video{
    max-width:100% !important;
    height:auto;
  }
  .form-card table{
    display:block;
    overflow-x:auto;
    white-space:nowrap;
  }
}

/* JPG-to-PDF: keep file actions visible and hide reorder extras on phones */
@media(max-width:600px){
  .jpg-order-controls .jpg-move-handle,
  .jpg-order-controls button[aria-label^="Move image"],
  .jpg-order-controls select{display:none!important}
  .jpg-order-controls button.jpg-replace,
  .jpg-order-controls button.jpg-remove{display:inline-flex!important;min-height:42px;min-width:42px;align-items:center;justify-content:center}
  .jpg-order-controls button.jpg-replace{font-size:12px;font-weight:800}
  .jpg-order-controls button.jpg-remove{position:absolute;right:5px;top:5px}
}

/* Narrow phone width: related-blog cards use a 320px grid minimum. */
@media(max-width:360px){
  .hb-toolread .hb-grid,
  .hb-toolread .hb-grid-2{
    grid-template-columns:minmax(0,1fr)!important;
    min-width:0!important;
  }
  .hb-toolread .hb-card{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }
  .hb-toolread .hb-card img,
  .hb-toolread .hb-card-body{max-width:100%;box-sizing:border-box}
}

/* PDF quick tabs remain on one swipeable row instead of pushing the upload below fold. */
@media(max-width:600px){
  #pdfTabs{
    justify-content:flex-start!important;
    flex-wrap:nowrap!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    white-space:nowrap;
    scrollbar-width:none;
    -webkit-overflow-scrolling:touch;
    gap:8px!important;
    padding:0 2px 6px;
  }
  #pdfTabs::-webkit-scrollbar{display:none}
  #pdfTabs .tab{flex:0 0 auto;white-space:nowrap}
  .jpg-order-help-desktop{display:none}
  .jpg-order-help-mobile{display:inline}
  /* Keep the floating support control clear of mobile upload actions. */
  #hcl-report-issue{display:none!important}
}
@media(min-width:601px){.jpg-order-help-mobile{display:none}}
