/* =========================================================
   SugamRail — Shared Mobile Responsive Styles
   File: /nfrehq/mobile.css
   ========================================================= */

/* -------- Hamburger button (only visible on mobile) -------- */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1100;
  background: #1e3a8a;
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 42px;
  height: 42px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  align-items: center;
  justify-content: center;
  padding: 0;
}
.mobile-menu-btn:active { transform: scale(.95); }

/* -------- Backdrop behind the drawer -------- */
.mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 1050;
  opacity: 0;
  transition: opacity .25s ease;
}
.mobile-backdrop.open { display: block; opacity: 1; }

/* =========================================================
   MOBILE / TABLET (<= 768px)
   ========================================================= */
@media (max-width: 768px) {

  /* Show hamburger */
  .mobile-menu-btn { display: flex; }

  /* --- Sidebar becomes an off-canvas drawer --- */
  aside.sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px !important;
    max-width: 82vw;
    z-index: 1060;
    transform: translateX(-100%);
    transition: transform .25s ease;
    overflow-y: auto;
    box-shadow: 2px 0 14px rgba(0, 0, 0, .2);
  }
  aside.sidebar.open { transform: translateX(0); }

  /* --- Main content takes full width --- */
  main {
    width: 100% !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  /* --- Top bar: shift content so hamburger doesn't cover it --- */
  header.topbar,
  .topbar {
    padding-left: 66px !important;
    padding-right: 12px !important;
    flex-wrap: wrap;
    gap: 8px;
  }
  .topbar h1 { font-size: 1rem !important; }
  .topbar .user-chip { display: none !important; }

  /* --- Generic page body padding --- */
  .page-body,
  .p-5,
  .p-6 {
    padding: 12px !important;
  }

  /* --- Tables: horizontal scroll & compact cells --- */
  .overflow-x-auto { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  table { font-size: 11.5px !important; }
  table th, table td { padding: 6px 8px !important; white-space: nowrap; }

  /* --- Charts scale to screen --- */
  canvas { max-width: 100% !important; height: auto !important; }

  /* --- Inputs get full width --- */
  .form-input, .form-select, .form-textarea { font-size: 16px !important; }
  /* ↑ 16px stops iOS from zooming when the user taps an input */

  /* --- Cards stack --- */
  .card, .rel-card, .report-shell { padding: 14px !important; }

  /* --- Reduce heading sizes --- */
  h1, .text-2xl { font-size: 1.35rem !important; }
  h2, .text-xl  { font-size: 1.15rem !important; }

  /* --- Modals fit on screen --- */
  .modal-dialog { margin: 8px !important; }
  .modal-content { border-radius: 10px !important; }

  /* --- Stop horizontal scroll of the whole page --- */
  body { overflow-x: hidden; }
}

/* =========================================================
   VERY SMALL PHONES (<= 380px)
   ========================================================= */
@media (max-width: 380px) {
  aside.sidebar { width: 240px !important; }
  .mobile-menu-btn { width: 38px; height: 38px; font-size: 20px; }
  .topbar, header.topbar { padding-left: 60px !important; }
  .btn { padding: 7px 14px !important; font-size: 12px !important; }
  .btn-xs { padding: 3px 8px !important; font-size: 10.5px !important; }
}

/* =========================================================
   PRINT — hide mobile chrome if anyone prints
   ========================================================= */
@media print {
  .mobile-menu-btn,
  .mobile-backdrop,
  aside.sidebar { display: none !important; }
}