/* ==========================================================================
   Active Solutions - Mobile First & Responsive Layout Specification
   Breakpoints: Desktop (>= 1024px), Tablet (768px - 1023px), Mobile (< 768px)
   ========================================================================== */

/* Mobile Navigation Hamburger & Backdrop */
.mobile-nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 8px;
  cursor: pointer;
  color: var(--text-main);
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}

.mobile-nav-toggle:hover {
  background-color: var(--surface-subtle);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  z-index: 95;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

/* Tablet & Mobile Breakpoints (< 1024px) */
@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-backdrop.mobile-open {
    display: block;
    opacity: 1;
  }

  .main-wrapper {
    margin-left: 0;
    width: 100%;
  }

  .mobile-nav-toggle {
    display: flex;
  }

  .content-body {
    padding: 1.25rem 1rem 2.5rem;
  }
}

/* Mobile Small Screen Breakpoints (< 768px) */
@media (max-width: 767px) {
  .top-header {
    padding: 0 0.85rem;
  }

  .header-title {
    font-size: 1rem;
  }

  .staff-switcher-select {
    max-width: 130px;
    font-size: 0.75rem;
    padding: 5px 8px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .section-title {
    font-size: 1.15rem;
  }

  /* Force 1-Column on Mobile Grids */
  .metrics-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .launchpad-grid {
    grid-template-columns: 1fr;
    padding: 0.85rem;
    gap: 0.85rem;
  }

  /* Card Panel Headers on Mobile */
  .card-panel-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .panel-actions {
    width: 100%;
    justify-content: space-between;
  }

  .search-box {
    width: 100%;
  }

  /* Touch Targets for Mobile (Minimum 44px) */
  .btn, .filter-pill, .nav-item, .channel-btn {
    min-height: 44px;
  }

  .task-checkbox {
    width: 22px;
    height: 22px;
  }

  .task-item {
    padding: 0.85rem;
    gap: 0.75rem;
  }

  /* Operations Queue & KPI Ribbon Responsive Stack */
  .dash-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .dash-kpi-card {
    padding: 0.75rem 0.85rem;
    gap: 0.65rem;
  }

  .kpi-icon-box {
    width: 36px;
    height: 36px;
  }

  .kpi-label {
    font-size: 0.68rem;
  }

  .kpi-value {
    font-size: 1.25rem;
  }

  .kpi-sub {
    font-size: 0.65rem;
  }

  /* Operations Queue Filter Bar & Horizontal Scrolling Pills */
  .filter-pills {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    max-width: 100%;
    scrollbar-width: thin;
  }

  .filter-pills::-webkit-scrollbar {
    height: 4px;
  }

  .filter-pills::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 4px;
  }

  .filter-pill {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.75rem;
    padding: 6px 12px;
  }

  #view-messaging .panel-actions {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }

  #view-messaging .panel-actions > div,
  #view-messaging .panel-actions > select,
  #view-messaging .panel-actions > .search-box {
    width: 100% !important;
    min-width: 100% !important;
  }

  /* Workflow Pipelines & Templates Grid on Mobile */
  .wf-pipelines-grid,
  .wf-templates-grid {
    grid-template-columns: 1fr !important;
    padding: 0.85rem !important;
  }

  .wf-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .attachments-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem;
  }

  .wf-stepper-track {
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }

  /* Operational Table & Data Tables */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
  }

  .data-table th, .data-table td {
    padding: 0.6rem 0.75rem;
    font-size: 0.76rem;
    white-space: nowrap;
  }

  .data-table td.cell-subject {
    white-space: normal;
    min-width: 200px;
  }

  /* Modal Windows on Mobile & Tablet */
  .modal-window {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 92vh !important;
    margin: 1rem auto !important;
    border-radius: var(--radius-md) !important;
  }

  .modal-header {
    padding: 0.85rem 1rem !important;
  }

  .modal-title {
    font-size: 1.05rem !important;
  }

  .modal-body {
    padding: 1rem !important;
  }

  .modal-footer {
    padding: 0.75rem 1rem !important;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .modal-footer .btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
  }

  /* Message Comments Modal Quick Actions Stack */
  #messageCommentsModal .modal-body {
    padding: 0.85rem !important;
  }
}

/* Extra Small Phones (< 480px) */
@media (max-width: 479px) {
  .dash-kpi-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .header-actions {
    gap: 0.35rem;
  }

  .staff-switcher-select {
    max-width: 105px;
    font-size: 0.7rem;
    padding: 4px 6px;
  }

  .btn {
    font-size: 0.78rem;
    padding: 0.45rem 0.75rem;
  }
}

