/* static/css/mobile.css
   Mobile-first overrides for QSB marketing + ShadowScan demo UI.
   This file is loaded AFTER app.css (and dashboard.css if you have it).
*/

@media (max-width: 980px){

  /* ----------------------------
     GLOBAL / COMMON
  ---------------------------- */
  .container{
    width: min(1160px, calc(100% - 26px));
  }

  .btn{
    padding: 11px 14px;
  }

  /* ----------------------------
     DEMO APP: SIDEBAR -> OFF CANVAS
  ---------------------------- */

  /* If your demo uses .demo-shell with sidebar + main */
  .demo-shell{
    display:block !important;
    position:relative;
  }

  /* Sidebar becomes off-canvas drawer */
  .demo-sidebar{
    position: fixed !important;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(88vw, 360px);
    z-index: 2000;
    transform: translateX(-110%);
    transition: transform .18s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Overlay behind sidebar */
  .demo-overlay{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 1900;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
  }

  /* When open */
  body.demo-sidebar-open .demo-sidebar{
    transform: translateX(0);
  }
  body.demo-sidebar-open .demo-overlay{
    opacity: 1;
    pointer-events: auto;
  }

  /* Main takes full width */
  .demo-main{
    width: 100%;
    padding-top: 64px; /* space for mobile top header */
  }

  /* Mobile top header bar */
  .demo-mobilebar{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1800;
    padding: 12px 14px;
    backdrop-filter: blur(14px);
    background: rgba(8,10,16,.72);
    border-bottom: 1px solid rgba(255,255,255,.08);
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap: 12px;
  }

  .demo-menu-btn{
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(255,255,255,.06);
    color: #e9eef8;
    padding: 10px 12px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
  }

  .demo-mobilebrand{
    display:flex;
    align-items:center;
    gap: 10px;
    min-width: 0;
  }

  .demo-mobilebrand img{
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 10px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.10);
    padding: 4px;
  }

  .demo-mobilebrand .t1{
    font-weight: 800;
    font-size: 14px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 55vw;
  }
  .demo-mobilebrand .t2{
    font-size: 12px;
    color: rgba(168,180,202,.9);
    margin-top: 2px;
  }

  /* Topbar in pages: stack actions */
  .topbar{
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .topbar-actions{
    width: 100%;
    display:flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  .topbar-actions .btn{
    flex: 1 1 auto;
  }

  /* Grid cards: stack */
  .grid-4{
    grid-template-columns: 1fr 1fr !important;
  }
  .grid-2x{
    grid-template-columns: 1fr !important;
  }

  /* Findings table: make rows wrap clean */
  .finding-row{
    display:grid !important;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 14px !important;
  }
  .finding-row .link{
    justify-self: start;
  }

  /* Asset table rows: stack */
  .asset-row2{
    display:grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px;
    padding: 14px !important;
  }
  .asset-row2 .chips{
    justify-content:flex-start;
    flex-wrap: wrap;
  }

  /* Search input should fit */
  .search{
    width: 100%;
    display:flex;
    gap: 10px;
  }
  .search input{
    flex: 1 1 auto;
    min-width: 0;
  }
}

/* Even smaller phones */
@media (max-width: 520px){
  .grid-4{
    grid-template-columns: 1fr !important;
  }

  .topbar-actions .btn{
    width: 100%;
  }
}
