/* Cloakd — mobile styles: <=700px layout, bottom nav, FAB, slide-in detail,
   mobile-only helpers. Extracted from index.html. */

/* ── Mobile-only elements (hidden on desktop, shown via media query) ── */
.mobile-topbar     { display: none; }
.mobile-back-btn   { display: none; }
.mobile-bottom-nav { display: none; }
.mobile-fab        { display: none; }

/* ── Mobile layout ≤700px ── */
@media (max-width: 700px) {
  /* Auth card goes edge-to-edge */
  .auth-bg  { padding: 0; align-items: flex-start; }
  .auth-card {
    border-radius: 0; border: none;
    min-height: 100dvh; max-width: 100%; width: 100%;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }

  /* App shell: layers rather than columns */
  .app-shell {
    flex-direction: column;
    height: 100dvh;
    position: relative;
    overflow: hidden;
  }

  /* Nav rail hides on mobile — bottom-tab nav takes its place */
  .nav-rail { display: none; }

  /* Sidebar = full-screen list view (behind main) */
  .sidebar {
    position: absolute;
    inset: 0;
    width: 100%;
    min-width: 0;
    border-right: none;
    z-index: 10;
    padding-top: 56px; /* space for fixed topbar */
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    overflow-y: auto;
  }

  /* Main panel = full-screen detail view, slides in from right */
  .main {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: var(--bg);
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    padding: 72px 16px calc(72px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
  }

  /* Slide sidebar out / main in when detail mode is active */
  .app-shell.mobile-detail .sidebar { transform: translateX(-100%); }
  .app-shell.mobile-detail .main    { transform: translateX(0); }

  /* Suppress desktop-only chrome inside the panels */
  .sidebar .logo    { display: none; }
  .sidebar-footer   { display: none; }
  .sidebar-tabs     { display: none; }

  /* Mobile top bar */
  .mobile-topbar {
    display: flex !important;
    align-items: center;
    gap: 4px;
    height: 56px;
    padding: 0 12px 0 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    padding-top: env(safe-area-inset-top, 0px);
  }
  .mobile-topbar-logo { flex: 1; display: flex; align-items: center; gap: 9px; }

  /* Back button at top of main panel on mobile */
  .mobile-back-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 14px;
    font-family: var(--sans);
    cursor: pointer;
    padding: 0;
    margin-bottom: 18px;
  }

  /* Bottom navigation */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 200;
  }
  .mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 9px;
    font-family: var(--sans);
    font-weight: 500;
    transition: color 0.15s;
    padding: 8px 0 6px;
    letter-spacing: 0.02em;
  }
  .mobile-nav-btn.active { color: var(--accent); }

  /* FAB (add button) */
  .mobile-fab {
    display: flex !important;
    position: fixed;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    right: 18px;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(91,124,250,0.5);
    z-index: 150;
    transition: transform 0.12s, opacity 0.15s;
  }
  .mobile-fab:active { transform: scale(0.92); }

  /* Don't show the FAB in detail mode (detail has its own action buttons) */
  .app-shell.mobile-detail .mobile-fab { opacity: 0; pointer-events: none; }

  /* Main header: stack on narrow screens */
  .main-header { flex-direction: column; gap: 10px; }
  .main-header > div:last-child { display: flex; flex-wrap: wrap; gap: 8px; }

  /* Modals: nearly full-screen */
  .modal-overlay .modal { width: 96vw; max-height: 88dvh; overflow-y: auto; }
}
