/* Gallant ERP — global mobile / tablet responsive layer */

html,
body,
#app,
.main-wrapper,
.page-wrapper {
  min-width: 0;
  max-width: 100%;
}

/* Sidebar overlay (theme rule is commented out in style.css) */
.sidebar-overlay.opened {
  display: block !important;
}

@media (max-width: 991.98px) {
  .page-wrapper {
    padding: 12px 10px 20px !important;
    margin-left: 0 !important;
  }

  .content,
  .container-fluid {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .page-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .page-header .page-title,
  .page-header h4,
  .page-header h3 {
    font-size: 1.1rem;
    word-break: break-word;
  }

  .page-header .page-btn,
  .page-header .btn-list {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .page-header .page-btn .btn,
  .page-header .btn-list .btn {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* Settings: stack sidebar above content instead of off-screen */
  .settings-wrapper {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .settings-wrapper .settings-sidebar {
    margin-left: 0 !important;
    width: 100% !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    border-right: none !important;
    border-bottom: 1px solid #e6eaed;
    margin-bottom: 12px;
  }

  .settings-wrapper .settings-sidebar .sidebar-inner {
    max-height: 220px;
  }

  /* Card / filter rows */
  .card-body .row.g-2,
  .card-body .row.g-3,
  .filter-row {
    row-gap: 0.75rem;
  }

  .card-body .col-md-auto,
  .card-body .col-lg-auto {
    width: 100%;
  }

  .card-body .btn.w-100,
  .card-body .input-group {
    width: 100%;
  }

  /* Header warehouse chip — allow shrink */
  .header .user-header-info {
    max-width: 42vw;
  }

  .header .user-header-info .info-content span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }
}

@media (max-width: 767.98px) {
  /* Tables: horizontal scroll instead of clipping */
  .table-responsive {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
  }

  table.table {
    min-width: 520px;
  }

  .list-table-actions thead th:last-child,
  .list-table-actions tbody td:last-child {
    position: static !important;
    right: auto !important;
    min-width: 72px !important;
    box-shadow: none !important;
  }

  /* Form grids */
  .row > [class*='col-md-'],
  .row > [class*='col-lg-'],
  .row > [class*='col-xl-'] {
    margin-bottom: 0.25rem;
  }

  .d-flex.gap-2,
  .d-flex.gap-3 {
    flex-wrap: wrap;
  }

  .btn-group {
    flex-wrap: wrap;
  }

  /* Dashboard / report filters with inline widths */
  .dashboard-filters select,
  .dashboard-filters input,
  .report-filter-card select,
  .report-filter-card input {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Stock information & similar split layouts */
  .stock-information-page .col-xl-7,
  .stock-information-page .col-xl-5,
  .stock-information-page .col-lg-7,
  .stock-information-page .col-lg-5 {
    width: 100%;
  }

  /* Modal full width on phone */
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }

  /* Voucher fixed bottom bar — room for content */
  .voucher-container,
  .voucher-form-page {
    padding-bottom: 72px !important;
  }
}

@media (max-width: 575.98px) {
  .header .main-header .logo img {
    max-height: 36px;
    width: auto;
  }

  .header-action-btn {
    padding: 0 10px !important;
    font-size: 12px !important;
  }

  .dropdown-menu.dropdown-xl {
    min-width: min(100vw - 24px, 320px);
    max-width: calc(100vw - 24px);
  }
}
