/**
 * desktop.css — Desktop & tablet responsive layout
 *
 * Quiet Power design: premium dark sidebar panel with gold accents.
 * The desktop sidebar matches the concept's refined dark panel aesthetic.
 *
 * Breakpoints:
 *   < 640px    → Mobile (default, no changes)
 *   640-1024px → Tablet: side rail (collapsed icons), single column padded
 *   > 1024px   → Desktop: side rail expanded + 2-column (main + aside)
 */

/* ── CSS variables for layout ────────────────────────────────────── */

:root {
  --jb-rail-width-collapsed: 68px;
  --jb-rail-width-expanded: 220px;
  --jb-aside-width: 380px;
}

/* ── Tablet: collapsed side rail ─────────────────────────────────── */

@media (min-width: 640px) {
  /* Side rail: vertical dock — dark panel */
  #tabbar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: auto;
    width: var(--jb-rail-width-collapsed);
    height: 100vh;
    flex-direction: column;
    justify-content: flex-start;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 20px 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    border-top: none;
    border-right: 1px solid rgba(255,255,255,0.05);
    background: rgba(12,18,15,0.95);
    -webkit-backdrop-filter: saturate(120%) blur(32px);
    backdrop-filter: saturate(120%) blur(32px);
    z-index: 200;
    gap: 2px;
  }

  /* Tab items: vertical stack, icon only */
  .tabbar-item {
    flex: 0 0 auto;
    width: 100%;
    padding: 14px 0;
    font-size: 0;
    border-radius: 0;
  }

  .tabbar-item span {
    display: none;
  }

  .tabbar-item.active::after {
    top: 50%;
    left: 0;
    right: auto;
    transform: translateY(-50%);
    width: 2.5px;
    height: 22px;
    border-radius: 0 2px 2px 0;
    background: var(--accent-1);
    opacity: 0.9;
  }

  /* FAB in side rail: flow inside vertical rail when nested in tabbar */
  #tabbar > .tabbar-fab {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    margin-top: 10px;
    margin-bottom: 10px;
    width: 42px;
    height: 42px;
    flex: 0 0 42px !important;
    align-self: center;
    border-radius: 14px;
    z-index: auto;
  }
  #tabbar > .tabbar-fab:active { transform: scale(0.92) !important; }
  #tabbar > .tabbar-fab.open { transform: scale(1.04) !important; }

  /* Body-level FAB: fixed at bottom of side rail area */
  body > .tabbar-fab {
    position: fixed !important;
    bottom: 20px !important;
    left: calc(var(--jb-rail-width-collapsed) / 2 - 21px) !important;
    right: auto !important;
    z-index: 250;
    margin: 0 !important;
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }
  body > .tabbar-fab:active { transform: scale(0.92) !important; }
  body > .tabbar-fab.open { transform: scale(1.04) !important; }

  /* Content: offset for rail */
  #content {
    margin-left: var(--jb-rail-width-collapsed);
    padding-bottom: 32px;
    max-width: 720px;
    margin-right: auto;
  }

  /* Remove bottom padding that was for mobile tabbar */
  #content,
  .view-wrapper {
    padding-bottom: 32px !important;
  }

  /* Chat overlay: side panel instead of full-screen */
  .co-overlay {
    inset: auto 0 auto auto;
    width: var(--jb-aside-width);
    height: 100vh;
    border-radius: 0;
  }

  .co-overlay .co-container {
    border-radius: 0;
    border-left: 1px solid rgba(255,255,255,0.05);
  }
}

/* ── Desktop: expanded side rail + 2-column layout ───────────────── */

@media (min-width: 1024px) {
  /* Expanded rail with labels — premium dark panel */
  #tabbar {
    width: var(--jb-rail-width-expanded);
    padding: 24px 0;
  }

  .tabbar-item {
    flex-direction: row;
    justify-content: flex-start;
    padding: 13px 20px;
    gap: 14px;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.4);
    letter-spacing: 0.01em;
  }

  .tabbar-item.active {
    color: var(--accent-1);
    background: rgba(255,255,255,0.025);
  }

  .tabbar-item span {
    display: inline;
  }

  /* Content: expand into 2-column layout */
  #content {
    margin-left: var(--jb-rail-width-expanded);
    max-width: calc(100vw - var(--jb-rail-width-expanded) - var(--jb-aside-width));
    padding: 28px 36px;
  }

  /* Aside panel for chat: always visible */
  .co-overlay .co-container {
    box-shadow: -4px 0 24px rgba(8,16,12,0.15);
  }

  /* Feature grid: 2 columns on desktop */
  .landing-features,
  .hm-features,
  .view-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* Wider card grids */
  .jb-data-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--jb-space-md);
  }

  /* DataTable always shows as table on desktop */
  .jb-data-table { display: table !important; }
  .jb-data-cards { display: none !important; }
}

/* ── Ultra-wide: constrain max width ─────────────────────────────── */

@media (min-width: 1440px) {
  #content {
    max-width: 900px;
    margin-right: auto;
  }
}
