/* Responsive breakpoints:
 * Desktop  (1280px+): full sidebar, all columns visible
 * Tablet   (768-1279px): icon-only sidebar (52px), view tabs overflow
 * Phone    (375-767px): sidebar hidden, bottom navigation, simplified columns
 */

/* ── Tablet ────────────────────────────────────────────────────────────── */
@media (max-width: 1279px) and (min-width: 768px) {
  .sidebar {
    width: var(--sidebar-collapsed-width);
  }

  .sidebar-logo, .sidebar-workspace-name, .sidebar-section,
  .sidebar-item span, .sidebar-footer .avatar-info {
    display: none;
  }

  .sidebar-item {
    padding: 8px;
    justify-content: center;
  }

  .sidebar-item .space-dot { width: 12px; height: 12px; }

  .sidebar-footer {
    justify-content: center;
    padding: 8px;
  }

  .view-tabs { display: none; }
  .view-tabs-overflow { display: flex !important; }

  .list-header-row,
  .task-row {
    grid-template-columns: 24px 110px 1fr 90px;
  }

  /* Hide due date and priority columns on tablet */
  .col-due, .col-priority { display: none; }
}

/* ── Phone ─────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .sidebar { display: none; }

  .main-content { padding-bottom: 56px; }

  /* Bottom navigation bar */
  .bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--surface-1);
    border-top: 1px solid var(--border);
    z-index: 50;
    align-items: center;
    justify-content: space-around;
    padding: 0 4px;
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
    text-decoration: none;
  }

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

  .task-panel { width: 100%; }

  .list-header-row,
  .task-row {
    grid-template-columns: 24px 100px 1fr 28px;
  }

  .col-due, .col-estimate { display: none; }

  .topbar { padding: 0 52px 0 52px; }
  .topbar .breadcrumb { font-size: 11px; }

  .view-tabs { display: none; }
  /* Hide secondary toolbar buttons on mobile — keep only the primary "New Task" button */
  .topbar-actions .btn-ghost { display: none; }
  /* Icon-only New Task button on mobile */
  .new-task-label { display: none; }

  .kanban-column { width: 85vw; }
  .board-content { padding: 8px; }
}

/* Hidden by default — shown only at specific breakpoints */
.bottom-nav { display: none; }
.view-tabs-overflow { display: none; }
.panel-mobile-back { display: none; }

/* ── Mobile hamburger (hidden on desktop) ───────────────────────────────── */
.mobile-nav-toggle { display: none; }

/* ── 3-pane shell mobile layout ─────────────────────────────────────────── */
@media (max-width: 767px) {
  /* Top search bar collides with the hamburger on narrow screens; full search is still reachable from the nav. */
  .topsearch { display: none; }

  /* The workspace switcher lives ONLY in the top bar (it was moved out of the submenu drawer), so
     it must stay visible on mobile — otherwise there's no way to change companies on a phone.
     Pad the bar left to clear the fixed hamburger, and drop the secondary quick-action icons
     (all reachable from the profile menu / bottom nav) so the switcher + avatar fit. */
  .tshell-topbar { padding-left: 54px; }
  .tshell-toolbar-icons { display: none; }

  /* Hamburger button */
  .mobile-nav-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    position: fixed;
    top: 8px;
    left: 10px;
    z-index: 600;
    width: 36px;
    height: 36px;
    background: var(--surface-1, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  }
  .mobile-nav-toggle span {
    display: block;
    height: 2px;
    width: 18px;
    background: var(--text-primary, #1e293b);
    border-radius: 2px;
    transition: transform .2s, opacity .2s;
  }

  /* Rail + submenu: off-screen by default, slide in when nav-open */
  .rail {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 510;
  }
  .submenu {
    position: fixed;
    top: 0; bottom: 0;
    left: 0;
    transform: translateX(calc(-100% - var(--rail-width, 54px)));
    transition: transform .25s ease;
    z-index: 509;
  }
  .tshell.nav-open .rail {
    transform: translateX(0);
  }
  .tshell.nav-open .submenu {
    transform: translateX(var(--rail-width, 54px));
  }

  /* Backdrop behind the nav drawer */
  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 508;
  }

  /* Main content takes full width since nav is overlaid */
  .tmain { width: 100%; }

  /* Task detail panel: full-screen on mobile (rail+submenu are off-screen) */
  .task-panel-overlay { left: 0; }
  /* Show the in-panel back button on mobile */
  .panel-mobile-back { display: flex !important; }

  /* Props bar: single column on mobile so label + value don't overflow narrow screens */
  .task-props-bar { grid-template-columns: 1fr !important; }
  .task-props-bar .prop-row:nth-child(3n),
  .task-props-bar .prop-row:nth-child(2n) { border-right: none; }
}
