/* ==========================================================================
   Mobile Responsive Overrides
   Loaded after style.css — targets screens <= 768px
   Only overrides content area. Does NOT touch header, navbar, or sidebar.
   ========================================================================== */

@media (max-width: 768px) {

  /* --- Charts: hidden by default on mobile, toggled via JS --- */
  .chart-container,
  .chart-card > .card-body {
    display: none !important;
  }

  .chart-toggle-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-bottom: 0.5rem;
    border: 1px dashed #ccc;
    border-radius: 6px;
    background: #f8f9fa;
    color: #495057;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: center;
  }

  .chart-toggle-btn:hover,
  .chart-toggle-btn:focus {
    background: #e9ecef;
    border-color: #adb5bd;
  }

  .chart-container.chart-visible,
  .chart-card.chart-visible > .card-body,
  .chart-card.chart-visible > .card-body .chart-container {
    display: block !important;
  }

  /* --- DataTables: horizontal scroll with readable columns --- */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-responsive table {
    width: auto !important;
    min-width: 800px;
  }

  /* --- Modals: full-width on mobile --- */
  .modal-xl .modal-dialog,
  .modal-lg .modal-dialog {
    max-width: 100%;
    margin: 0.5rem;
  }

  /* --- Touch targets: minimum 44px for tap-friendliness (content area only) --- */
  .pcoded-main-container .btn-sm {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  /* --- Grid: force single column for multi-col layouts (content area only) --- */
  .pcoded-main-container .row > .col-3,
  .pcoded-main-container .row > .col-4,
  .pcoded-main-container .row > .col-6,
  .pcoded-main-container .row > .col-8,
  .pcoded-main-container .row > .col-9 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* --- KPI stat cards: stack vertically --- */
  .pcoded-main-container .row > [class*="col-xl-2"] {
    flex: 0 0 50%;
    max-width: 50%;
  }

  /* --- Card spacing (content area only) --- */
  .pcoded-main-container .card {
    margin-bottom: 1rem;
  }

  /* --- Inline chart heights: cap on mobile (content area only) --- */
  .pcoded-main-container [style*="height: 500px"],
  .pcoded-main-container [style*="height:500px"],
  .pcoded-main-container [style*="height: 600px"],
  .pcoded-main-container [style*="height:600px"],
  .pcoded-main-container [style*="height: 720px"],
  .pcoded-main-container [style*="height:720px"],
  .pcoded-main-container [style*="height: 768px"],
  .pcoded-main-container [style*="height:768px"] {
    height: 350px !important;
  }

  /* --- Breadcrumb: wrap text --- */
  .page-header .breadcrumb {
    flex-wrap: wrap;
  }

  /* --- Footer / copyright spacing --- */
  .pcoded-content {
    padding: 20px 10px;
  }
}

/* Hide chart toggle button on desktop */
@media (min-width: 769px) {
  .chart-toggle-btn {
    display: none;
  }
}
