/* ==========================================================================
   numBer Campaign Intelligence Dashboard — Mobile Native Experience
   iOS HIG & Android Material Design optimizations
   ========================================================================== */

/* Mobile Bottom Navigation (Hidden on Desktop, Visible on <= 768px) */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .content-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .top-posts-grid {
    grid-template-columns: 1fr;
  }
  .telemetry-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  /* Hide Desktop Sidebar Rail */
  .sidebar-rail {
    display: none !important;
  }

  /* Expand Main Viewport to 100% */
  .main-viewport {
    margin-left: 0 !important;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 16px));
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Show Mobile Header Brand */
  .mobile-brand {
    display: flex;
    flex-direction: column;
  }

  .mobile-sub {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-muted);
  }

  .top-nav-bar {
    padding: 0 16px;
    height: 56px;
  }

  .header-breadcrumbs .month-pill {
    display: none;
  }

  .header-actions .btn span {
    display: none;
  }

  .header-actions .btn {
    padding: 8px;
    border-radius: 50%;
  }

  .tab-content-container {
    padding: 16px;
  }

  /* Hero Banner on Mobile */
  .hero-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px;
    gap: 16px;
  }

  .hero-title {
    font-size: 18px;
  }

  .hero-desc {
    font-size: 12px;
  }

  .hero-countdown-box {
    width: 100%;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .countdown-display {
    font-size: 20px;
  }

  /* KPI Grid Mobile Stack */
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 18px;
  }

  .kpi-card {
    padding: 12px;
  }

  .kpi-value {
    font-size: 20px;
  }

  .kpi-delta-badge {
    font-size: 8.5px;
    padding: 2px 5px;
    margin-bottom: 5px;
    gap: 2px;
    letter-spacing: -0.02em;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .kpi-delta-badge .delta-arrow {
    font-size: 8.5px;
  }

  .kpi-label {
    font-size: 10px;
  }

  .kpi-subtext {
    font-size: 10px;
  }

  /* Analytics Split Cards */
  .analytics-row {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 18px;
  }

  /* Content Cards Single Column on Mobile */
  .content-cards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .telemetry-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Roster Toolbar */
  .tab-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .filter-toolbar {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .search-input-box {
    width: 100%;
  }

  .filter-pills-group {
    overflow-x: auto;
    white-space: nowrap;
    padding: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .pill-filter {
    padding: 6px 12px;
    font-size: 11px;
  }

  /* Mobile Roster Table Transformation into Cards */
  .roster-table-container {
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .data-table thead {
    display: none;
  }

  .data-table, .data-table tbody, .data-table tr, .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    padding: 14px;
  }

  .data-table td {
    padding: 6px 0;
    border-bottom: 1px solid rgba(36, 49, 71, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
  }

  .data-table td:last-child {
    border-bottom: none;
    padding-top: 10px;
    justify-content: stretch;
  }

  .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
  }

  .data-table td:last-child::before {
    display: none;
  }

  .btn-table-action {
    width: 100%;
    justify-content: center;
    padding: 8px;
    min-height: 44px; /* Touch target >= 44px */
  }

  /* ==========================================================================
     iOS & Android Native Bottom Navigation Bar
     ========================================================================== */
  .mobile-bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(19, 27, 41, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-subtle);
    z-index: 1000;
  }

  .m-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
    height: 100%;
    min-height: 44px;
    color: var(--text-muted);
    transition: color 0.2s;
  }

  .m-nav-item svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
  }

  .m-nav-item span {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
  }

  .m-nav-item.active {
    color: var(--accent-cyan);
  }

  .m-nav-item.active svg {
    filter: drop-shadow(0 0 8px var(--accent-cyan));
  }

  /* Modal Mobile Sheet Behavior */
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal-dialog {
    max-width: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    max-height: 90vh;
    padding: 20px 16px calc(24px + env(safe-area-inset-bottom, 0px)) 16px;
  }
}
