/* ============================================================
   Mobile-friendly fixes for portals.clippingpathking.com
   Loaded after every other stylesheet (incl. custom.css).
   Desktop (>= 992px) is untouched. Added 2026-11-12.
   ============================================================ */

/* ---------- Tablets and phones ---------- */
@media screen and (max-width: 991.98px) {
  /* custom.css sets .table-responsive { overflow-x: visible } which
     breaks table scrolling on small screens - restore it */
  .table-responsive { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  .dataTables_wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* catch tables that are not wrapped in .table-responsive */
  .page-wrapper .card-body,
  .page-wrapper .white-box { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* fixed-width invoice/preview layouts pan sideways instead of
     blowing up the page */
  .page-wrapper form { max-width: 100% !important; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .page-wrapper .container { max-width: 100%; }
  #page-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ---------- Phones ---------- */
@media screen and (max-width: 767.98px) {
  body { overflow-x: hidden; }
  img { max-width: 100%; height: auto; }

  /* Topbar: custom.css sets .top-navbar { display: inline } which
     collapses the menu toggler to 0 height - rebuild one clean row */
  .topbar { height: auto; }
  .topbar .top-navbar { display: flex !important; flex-wrap: nowrap; align-items: center; justify-content: space-between; min-height: 60px; padding: 0 4px; }
  .topbar .top-navbar .navbar-header { display: flex; align-items: center; flex: 1 1 auto; min-width: 0; width: auto; }
  .topbar .navbar-header img.logo { max-width: 150px; height: auto; }
  .topbar .navbar-collapse { display: flex !important; position: static; width: auto; flex: 0 0 auto; align-items: center; padding: 0; }
  .topbar .navbar-collapse > .navbar-nav { flex-direction: row; }

  /* Hamburger: the themify icon font is not loaded on these pages,
     so draw the icon in pure CSS */
  .topbar .nav-toggler { width: 48px !important; min-width: 48px; height: 60px !important; display: flex !important; align-items: center; justify-content: center; opacity: 1 !important; visibility: visible !important; }
  .topbar .nav-toggler i { display: block !important; width: 22px; height: 2px; background: #2c3c62; box-shadow: 0 -7px 0 #2c3c62, 0 7px 0 #2c3c62; border-radius: 1px; font-size: 0; }
  body.show-sidebar .topbar .nav-toggler i { background: #398bf7; box-shadow: 0 -7px 0 #398bf7, 0 7px 0 #398bf7; }

  /* content clears the fixed topbar */
  .page-wrapper { padding: 75px 8px 8px 8px !important; }

  /* forms, modals, spacing */
  input, select, textarea { max-width: 100%; }
  .modal-dialog { margin: 10px auto; max-width: calc(100vw - 20px); }
  .page-wrapper .ml-5, .page-wrapper .mr-5 { margin-left: 8px !important; margin-right: 8px !important; }
}


/* ============================================================
   Phone card layout for wide list tables (orders, quotes,
   free trials, invoices). Each row becomes a labelled card.
   Works with mobile-cards.js. Added 2026-11-12.
   ============================================================ */
@media screen and (max-width: 767.98px) {
  .mobile-cards-wrap { overflow-x: visible !important; }

  table.mobile-cards { display: block; width: 100% !important; border: none !important; }
  table.mobile-cards thead { display: none; }
  table.mobile-cards tbody { display: block; width: 100%; }

  table.mobile-cards tbody tr {
    display: block; width: 100%;
    border: 1px solid #e2e6ef; border-radius: 10px;
    margin: 0 0 12px 0; padding: 10px 12px;
    background: #fff !important;
    box-shadow: 0 1px 4px rgba(44,60,98,.09);
  }
  table.mobile-cards tbody tr.odd,
  table.mobile-cards tbody tr.even { background: #fff !important; }

  table.mobile-cards tbody td {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: 100% !important; max-width: 100% !important;
    padding: 6px 0 !important;
    border: none !important; border-bottom: 1px solid #f1f3f8 !important;
    background: transparent !important;
    text-align: right !important; white-space: normal !important;
    font-size: 14px !important;
  }
  table.mobile-cards tbody td:last-child { border-bottom: none !important; }
  table.mobile-cards tbody td::before {
    content: attr(data-label);
    flex: 0 0 36%; text-align: left;
    font-weight: 600; color: #6b7a99;
    font-size: 12px; text-transform: uppercase; letter-spacing: .02em;
  }

  /* first column becomes the card heading */
  table.mobile-cards tbody td.mc-title {
    display: block; text-align: left !important;
    padding: 0 0 8px 0 !important;
    font-size: 16px !important; font-weight: 700;
  }
  table.mobile-cards tbody td.mc-title::before { display: none; }
  table.mobile-cards tbody td.mc-title a {
    font-size: 16px; font-weight: 700; word-break: break-all;
  }

  table.mobile-cards tbody td.mc-empty { display: none !important; }

  table.mobile-cards tbody td select,
  table.mobile-cards tbody td input { max-width: 60%; height: 36px; }

  /* action buttons wrap into a tappable grid */
  table.mobile-cards tbody td.mc-actions {
    display: block !important; text-align: left !important; padding-top: 10px !important;
  }
  table.mobile-cards tbody td.mc-actions::before {
    display: block; flex: none; margin-bottom: 6px;
  }
  table.mobile-cards tbody td.mc-actions .btn-group {
    display: flex !important; flex-wrap: wrap; gap: 6px; width: 100%;
  }
  table.mobile-cards tbody td.mc-actions .btn-group > .btn {
    flex: 0 0 calc(20% - 5px); margin: 0 !important;
    min-height: 38px; border-radius: 6px !important;
    display: flex; align-items: center; justify-content: center;
  }

  table.mobile-cards tbody td .badge,
  table.mobile-cards tbody td .label { font-size: 12px; }

  /* DataTables chrome */
  .dataTables_info { font-size: 12px; }
  .dataTables_paginate { font-size: 13px; }
  .dataTables_filter label { display: block; width: 100%; }
  .dataTables_filter input { width: 100% !important; margin: 4px 0 0 0 !important; }

  /* compact filter chips */
  .page-wrapper .btn.btn-sm.m-1 { margin: 3px !important; padding: 5px 9px !important; font-size: 12px !important; }
}


/* ============================================================
   KPI pages: card layout for the wide scoring / people tables.
   Only tables that would otherwise scroll sideways are carded
   (see mobile-cards.js). Added 2026-11-12.
   ============================================================ */
@media screen and (max-width: 767.98px) {
  /* card heading always sits at the top, whatever column it is */
  table.mobile-cards tbody tr { display: flex !important; flex-direction: column; }
  table.mobile-cards tbody td.mc-title { order: -1; }

  table.mobile-cards.kpi-table tbody td select { max-width: 130px; height: 40px; }
  table.mobile-cards.kpi-table tbody td .kpi-pill { font-size: 14px; }

  /* full-width cells (comment boxes and other free-text inputs) */
  table.mobile-cards tbody td.mc-wide { display: block !important; text-align: left !important; }
  table.mobile-cards tbody td.mc-wide::before { display: block; flex: none; margin-bottom: 4px; }
  table.mobile-cards tbody td.mc-wide input,
  table.mobile-cards tbody td.mc-wide textarea { width: 100%; max-width: 100%; height: 40px; }

  /* action cells that hold plain buttons/forms rather than a .btn-group */
  table.mobile-cards tbody td.mc-actions > form,
  table.mobile-cards tbody td.mc-actions > a,
  table.mobile-cards tbody td.mc-actions > button { display: inline-block; margin: 0 6px 6px 0; vertical-align: middle; }
  table.mobile-cards tbody td.mc-actions .btn { min-height: 38px; }
}
