/* ============================================================
   BizTracker Pro — public/css/mobile.css
   Dedicated Mobile & Tablet Responsive Stylesheet (<= 1024px)
   Pure Media Query Architecture: Zero impact on desktop (>1024px)
   ============================================================ */

/* ============================================================
   BREAKPOINT: TABLETS & MOBILE LANDSCAPE (<= 1024px)
   ============================================================ */
@media (max-width: 1024px) {

  /* ── Mobile Top Header Bar ── */
  .mobile-top-bar {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--glass-border);
    z-index: 1001;
    padding: 0 1rem;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .mobile-menu-toggle {
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: var(--text);
    font-size: 1.25rem;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
  }

  .mobile-menu-toggle:active {
    transform: scale(0.92);
    background: rgba(139, 92, 246, 0.25);
  }

  .mobile-brand-title {
    font-weight: 700;
    font-size: 1.05rem;
    background: linear-gradient(135deg, var(--purple), var(--blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.01em;
  }

  /* ── Sidebar Backdrop Overlay ── */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .sidebar-backdrop.active {
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* ── Slide-Out Sidebar Drawer ── */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    max-width: 85vw !important;
    z-index: 1002 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 4px 0 28px rgba(0, 0, 0, 0.6) !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--surface) !important;
  }

  .sidebar.open {
    transform: translateX(0) !important;
  }

  /* Keep all labels, brand text, and footer fully visible */
  .brand-text,
  .nav-label,
  .sidebar-footer {
    display: flex !important;
  }

  .brand-text {
    flex-direction: column !important;
  }

  .sidebar-brand {
    position: relative;
    padding-right: 2.75rem !important;
  }

  .sidebar-mobile-close {
    display: flex !important;
    position: absolute;
    top: 1rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: all .15s ease;
  }

  .sidebar-mobile-close:hover,
  .sidebar-mobile-close:active {
    background: rgba(239, 68, 68, 0.2);
    color: var(--red);
  }

  /* ── Main Content Area ── */
  .main {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 4.25rem 1rem 5.5rem 1rem !important;
    height: auto !important;
    min-height: 100vh;
    overflow-y: visible !important;
  }

  /* ── Page Header & Action Toolbars ── */
  .page-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
    margin-bottom: 1.25rem !important;
  }

  .page-header h1 {
    font-size: 1.45rem !important;
  }

  .page-header > div:last-child {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    justify-content: flex-start !important;
  }

  .table-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }

  .search-input {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* ── Touch Table Scrolling ── */
  .variants-table-wrap,
  .table-wrap,
  .table-responsive {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    display: block !important;
    border-radius: var(--radius-sm);
  }

  .variants-table,
  .data-table {
    min-width: 640px !important;
  }

  /* ── Modals on Tablet / Mobile ── */
  .modal {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 90vh !important;
    padding: 1.25rem 1rem !important;
    margin: auto !important;
    overflow-y: auto !important;
  }

  .form-row {
    grid-template-columns: 1fr !important;
    gap: 0.65rem !important;
  }
}

/* ============================================================
   BREAKPOINT: SMARTPHONES (<= 768px)
   ============================================================ */
@media (max-width: 768px) {

  /* ── Mobile Bottom Quick Navigation ── */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 58px;
    background: var(--surface);
    border-top: 1px solid var(--glass-border);
    z-index: 999;
    justify-content: space-around;
    align-items: center;
    padding: 0 0.25rem;
    box-shadow: 0 -2px 14px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .mb-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 600;
    gap: 0.15rem;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
  }

  .mb-nav-item.active {
    color: var(--purple);
  }

  .mb-nav-icon {
    font-size: 1.2rem;
    line-height: 1;
  }

  /* ── Products Page Group Header Responsiveness ── */
  .group-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
    padding: 0.85rem !important;
  }

  .group-header-left {
    width: 100% !important;
  }

  .group-header-right {
    width: 100% !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }

  .product-group-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.6rem !important;
  }

  .product-group-header-right {
    width: 100% !important;
    justify-content: space-between !important;
  }

  .product-subgroup-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }

  .prod-kpi-strip {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.65rem !important;
  }

  .product-filter-pills {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    padding-bottom: 0.4rem !important;
  }

  .filter-pill {
    flex-shrink: 0 !important;
  }

  .group-footer {
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    font-size: 0.74rem !important;
  }

  /* ── Charts & Grids ── */
  .charts-row,
  .charts-matrix-2x2 {
    grid-template-columns: 1fr !important;
  }

  .spotlight-grid {
    grid-template-columns: 1fr !important;
  }

  .quick-launcher-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
  }
}

/* ============================================================
   BREAKPOINT: NARROW SMARTPHONES (<= 480px)
   ============================================================ */
@media (max-width: 480px) {

  .main {
    padding: 3.85rem 0.65rem 5.5rem 0.65rem !important;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.45rem !important;
  }

  .stat-card {
    padding: 0.75rem 0.65rem !important;
    gap: 0.5rem !important;
  }

  .stat-icon-wrap {
    font-size: 1.3rem !important;
  }

  .stat-value {
    font-size: 1.1rem !important;
  }

  .prod-kpi-strip {
    grid-template-columns: 1fr !important;
  }

  .prod-kpi-card {
    padding: 0.65rem 0.85rem !important;
  }

  .group-codes {
    gap: 0.25rem !important;
  }

  .group-desc-snippet {
    max-width: 100% !important;
    display: block !important;
    white-space: normal !important;
  }

  .modal-footer {
    flex-direction: column-reverse !important;
    width: 100% !important;
  }

  .modal-footer button {
    width: 100% !important;
  }

  .btn-group-primary {
    width: 100% !important;
    display: flex !important;
    justify-content: stretch !important;
  }

  .btn-group-primary button {
    flex: 1 !important;
    text-align: center !important;
  }
}
