/* ==========================================================================
   widget-keys.mobile.css — mobile layer for /Widget (Search Widget) and
   /Keys (API Keys).
   Load AFTER widget-keys.css. Contains ONLY @media blocks, so it cannot
   affect the desktop rendering that is already live.
   Breakpoint 991.98px == Bootstrap's lg boundary (lg starts at min-width:992px),
   the same boundary the two views already use for .d-none.d-lg-block / .d-lg-none.
   ========================================================================== */

@media (max-width:991.98px){
  .rk-page{padding:18px 16px 56px}
  .rk-phead{flex-direction:column;align-items:stretch;gap:14px;padding-bottom:18px;margin-bottom:20px}
  .rk-phead h1{font-size:21px}
  .rk-phead p{font-size:13.5px}
  .rk-phead-actions{width:100%}
  .rk-phead-actions .rk-btn{flex:1}
  .rk-section-h{flex-direction:column;align-items:stretch;gap:12px}
  .rk-card-head{flex-wrap:wrap;padding:14px 16px}
  .rk-card-body{padding:16px}
  .rk-steps3{grid-template-columns:1fr}
  .rk-empty{padding:38px 20px}
  .rk-empty-actions{flex-direction:column;align-items:stretch;width:100%;max-width:300px}
  .rk-code{font-size:10.5px;padding:12px}
  .rk-code.rk-code-light{font-size:12px;padding:12px 14px}
  .rk-appear{padding:12px 16px 14px}
  .rk-preview-shell{padding:14px}
  .rk-pv-body{padding:14px}
  /* the embedded widget itself must not force horizontal scroll */
  .rk-pv-frame recuity-search{display:block;max-width:100%}
  /* stacked key cards (mobile markup lives behind .d-lg-none in Keys/Index.cshtml) */
  .rk-kcard-top{flex-direction:column;gap:8px}
  .rk-kcard .rk-kval code{word-break:break-all;font-size:11.5px}
  .rk-kcard-foot{flex-wrap:wrap}
  .rk-kcard-foot .rk-btn{flex:1 1 auto;min-width:88px}
  /* status pills must never break across two lines */
  .rk-pill{white-space:nowrap;flex-shrink:0}
  /* modals go near-fullscreen and stack their footer buttons */
  .rk-modal .modal-dialog{margin:12px}
  .rk-modal .modal-content{border-radius:14px}
  .rk-modal .modal-header,.rk-modal .modal-body,.rk-modal .modal-footer{padding-left:16px;padding-right:16px}
  .rk-modal .modal-footer{flex-direction:column-reverse;align-items:stretch}
  .rk-modal .modal-footer>*{width:100%;text-align:center;justify-content:center}
  .rk-inline-copy{flex-direction:column}
  .rk-inline-copy .rk-btn{width:100%}
}
@media (max-width:480px){
  .rk-page{padding:14px 12px 48px}
  .rk-phead h1{font-size:20px}
  .rk-phead-actions{flex-direction:column}
  .rk-swatch{padding:4px 8px 4px 5px}
  .rk-chip{font-size:11.5px}
}
/* Touch targets: 44px minimum for anything tappable on a phone. */
@media (hover:none){
  .rk-btn{padding:11px 16px}
  .rk-btn-sm{padding:9px 12px}
  .rk-icon-btn{width:38px;height:38px}
  .rk-seg button{padding:9px 14px}
  .rk-input,.rk-select{height:44px}
  .rk-appear-item .rk-swatch,.rk-appear-checks{height:44px}
  .rk-appear-radius .rk-range{margin:20px 0}
}
/* Optional fallback: if a table is ever rendered without the .d-lg-none card
   markup, give every <td> a data-label and this turns rows into cards. */
@media (max-width:991.98px){
  .rk-table.rk-stacked,.rk-table.rk-stacked tbody,.rk-table.rk-stacked tr,.rk-table.rk-stacked td{display:block;width:auto}
  .rk-table.rk-stacked thead{display:none}
  .rk-table.rk-stacked tbody{padding:14px}
  .rk-table.rk-stacked tr{border:1px solid var(--rc-border);border-radius:12px;padding:12px 14px}
  .rk-table.rk-stacked tr+tr{margin-top:12px}
  .rk-table.rk-stacked td{padding:6px 0!important;border:none!important;text-align:left!important;display:flex;align-items:center;justify-content:space-between;gap:14px;min-height:30px}
  .rk-table.rk-stacked td::before{content:attr(data-label);font-size:11.5px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--rc-sage);flex-shrink:0}
  .rk-table.rk-stacked td:first-child{display:block;padding-bottom:10px!important;border-bottom:1px solid rgba(44,95,82,.08)!important;margin-bottom:4px}
  .rk-table.rk-stacked td:first-child::before,.rk-table.rk-stacked td:last-child::before{display:none}
  .rk-table.rk-stacked td:last-child{padding-top:12px!important}
  .rk-table.rk-stacked .rk-actions{width:100%;display:flex;gap:8px}
  .rk-table.rk-stacked .rk-actions .rk-btn{flex:1}
  /* an icon-only button stretched full width reads as an empty box — give it the
     label from its title attribute instead */
  .rk-table.rk-stacked .rk-actions .rk-icon-btn{flex:1;width:auto;height:40px;gap:8px;font-size:12.5px;font-weight:600;font-family:inherit}
  .rk-table.rk-stacked .rk-actions .rk-icon-btn::after{content:attr(title)}
  .rk-table.rk-stacked .rk-pill{white-space:nowrap;flex-shrink:0}
  .rk-table.rk-stacked .rk-chips{justify-content:flex-end}
}

/* The Desktop / Tablet / Phone switch compares preview sizes. On a phone screen the page
   opens on Phone, and the other two would be thumbnails, so the switch is left out. */
@media (max-width:600px){
  .rk-preview-widths{display:none}
}
/* Under 821px the app has a fixed tab bar along the bottom. Saying so here lets anything
   on this page that scrolls itself into view (the preview's filter sheet) stop above it. */
@media (max-width:820.98px){
  .app-container:has(.rk-page){scroll-padding-bottom:72px}
}
