/* ═══════════════════════════════════════════════════════
   mobile.css — PWA, Bottom Nav, Skeleton loaders, Onboarding
   ═══════════════════════════════════════════════════════ */

/* ── Bottom Nav — hidden on desktop ── */
#bottom-nav { display: none; }
.bnav-more-menu { position: fixed; bottom: 68px; right: 12px; z-index: 9999; background: var(--bg-card, #1e1e1e); border: 1px solid var(--border); border-radius: 12px; padding: 8px; min-width: 190px; max-height: 70vh; overflow-y: auto; -webkit-overflow-scrolling: touch; box-shadow: 0 -4px 24px rgba(0,0,0,.7); display: flex; flex-direction: column; gap: 2px; }
.bnav-more-menu[hidden] { display: none !important; }
.bnav-more-menu button { background: none; border: none; color: var(--text); text-align: left; padding: 10px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; white-space: nowrap; }
.bnav-more-menu button:hover { background: var(--bg-hover); }

/* ── Mobile (≤ 620px) ── */
@media (max-width: 620px) {
  html, body { overflow-x: hidden; }
  #bottom-nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; bottom: 0; left: 0; right: 0; width: 100%; max-width: none !important; margin-left: 0 !important; justify-content: initial !important; box-sizing: border-box; overflow: hidden; z-index: 500; background: var(--bg-card); border-top: 1px solid var(--border); padding: 0 0 env(safe-area-inset-bottom, 0px) 0; height: 56px; align-items: stretch; }
  .bnav-btn { width: 100%; max-width: 100%; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 4px 2px; transition: color 0.15s; min-height: 48px; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
  #bnav-more-btn { display: flex !important; visibility: visible !important; opacity: 1 !important; }
  .bnav-btn:active { background: var(--bg-hover); }
  .bnav-btn.active { color: var(--accent); }
  .bnav-icon { font-size: 20px; line-height: 1; }
  .bnav-label { font-size: 9px; font-weight: 500; letter-spacing: 0.3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  header nav { display: none !important; }
  header { padding: 6px 10px; gap: 4px; height: auto; min-height: 48px; }
  header .header-left h1 { display: none; }
  header .header-left #badge-status { display: none; }
  #project-selector { margin-right: 6px !important; padding: 5px 8px !important; font-size: 12px !important; max-width: 130px; }
  .header-actions { gap: 4px; }
  .header-actions button { font-size: 15px; padding: 4px 6px; }
  #btn-logout { font-size: 11px; padding: 4px 8px; }
  .tab-content.active { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 12px); }
  .login-box { padding: 24px 20px; }
  #auth-user, #auth-pass, #auth-key { font-size: 16px; padding: 10px 12px; }
  #btn-auth { font-size: 16px; padding: 12px; }
  #content-table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .project-card, .notes-card, .planner-card { -webkit-tap-highlight-color: transparent; }
  .modal-content { max-height: 90vh; border-radius: 16px 16px 0 0; position: fixed; bottom: 0; left: 0; right: 0; margin: 0; width: 100% !important; max-width: 100% !important; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .bnav-btn { position: relative; }
  .bnav-btn.active::after { content: ''; position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%); width: 5px; height: 5px; background: var(--accent); border-radius: 50%; }
  .bnav-btn.active .bnav-icon { display: inline-block; transform: scale(1.15); transition: transform 0.15s ease; }
  .bnav-icon { transition: transform 0.15s ease; }
  .modal-content { max-height: calc(100dvh - 56px); overflow: hidden; }
  .modal-body { -webkit-overflow-scrolling: touch; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); }
  .modal-content input, .modal-content textarea, .modal-content select { font-size: 16px; }
}

/* ── Mobile Collapsible Sections ── */
.mobile-collapse-toggle { display: none; }
@media (max-width: 767px) {
  .mobile-collapse-toggle {
    display: flex; width: 100%; justify-content: space-between; align-items: center;
    padding: 10px 14px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text);
    cursor: pointer; margin-bottom: 6px; -webkit-tap-highlight-color: transparent;
  }
  .mobile-collapse-toggle:active { background: var(--bg-hover); }
  .mct-arrow { font-size: 11px; color: var(--text-dim); transition: transform 0.2s; }
  .mobile-collapsed { display: none !important; }
}

/* Tablet nav scrollable */
@media (max-width: 900px) {
  header nav { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  header nav::-webkit-scrollbar { display: none; }
}

/* ── Skeleton Loaders ── */
@keyframes skel-shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skel { display: block; border-radius: 4px; background: linear-gradient(90deg, var(--bg-hover, #f0f0f0) 25%, var(--border, #e0e0e0) 50%, var(--bg-hover, #f0f0f0) 75%); background-size: 200% 100%; animation: skel-shimmer 1.5s ease-in-out infinite; margin-bottom: 6px; }
.skel-title { height: 15px; width: 55%; }
.skel-text  { height: 12px; width: 88%; }
.skel-short { width: 40% !important; }
.skeleton-row { padding: 12px 0; border-bottom: 1px solid var(--border, #eee); }
.skeleton-card { padding: 14px 12px; background: var(--bg-card, #fff); border-radius: 8px; border: 1px solid var(--border, #eee); }
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; padding: 16px; }
.skeleton-list { padding: 0 4px; }

/* ── Onboarding Overlay ── */
#onboarding-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center; padding: 16px; }
#onboarding-overlay[hidden] { display: none; }
.ob-card { background: var(--bg-card, #1a1d2e); border: 1px solid var(--border, #2a2d3e); border-radius: 16px; padding: 36px 40px; width: 100%; max-width: 440px; box-shadow: 0 24px 64px rgba(0,0,0,0.6); display: flex; flex-direction: column; gap: 20px; }
.ob-progress { display: flex; gap: 8px; justify-content: center; }
.ob-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border, #2a2d3e); transition: background 0.2s, transform 0.2s; }
.ob-dot.active { background: var(--accent, #6c63ff); transform: scale(1.3); }
.ob-dot.done { background: var(--accent, #6c63ff); opacity: 0.5; }
.ob-step { display: flex; flex-direction: column; gap: 14px; }
.ob-icon { font-size: 2.8rem; text-align: center; }
.ob-step h2 { font-size: 1.4rem; font-weight: 700; color: var(--text, #e8eaf6); margin: 0; text-align: center; }
.ob-desc { font-size: 0.95rem; color: var(--text-muted, #888); text-align: center; line-height: 1.5; margin: 0; }
.ob-step input[type="text"], .ob-step input[type="password"] { width: 100%; box-sizing: border-box; padding: 10px 14px; background: var(--bg-input, #0f1117); border: 1px solid var(--border, #2a2d3e); border-radius: 8px; color: var(--text, #e8eaf6); font-size: 0.95rem; outline: none; }
.ob-step input:focus { border-color: var(--accent, #6c63ff); }
.ob-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.ob-btn { padding: 9px 22px; border-radius: 8px; font-size: 0.9rem; font-weight: 600; cursor: pointer; border: none; transition: opacity 0.15s, transform 0.1s; }
.ob-btn:active { transform: scale(0.97); }
.ob-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ob-primary { background: var(--accent, #6c63ff); color: #fff; }
.ob-primary:hover:not(:disabled) { opacity: 0.85; }
.ob-secondary { background: var(--bg-input, #0f1117); color: var(--text, #e8eaf6); border: 1px solid var(--border, #2a2d3e); }
.ob-secondary:hover { border-color: var(--accent, #6c63ff); }
.ob-ghost { background: transparent; color: var(--text-muted, #888); border: 1px solid transparent; }
.ob-ghost:hover { color: var(--text, #e8eaf6); }
.ob-status { font-size: 0.88rem; min-height: 1.2em; color: var(--text-muted, #888); text-align: center; }
.ob-success { color: #4caf50 !important; }
.ob-error   { color: #f44336 !important; }
.ob-themes { display: flex; gap: 12px; justify-content: center; }
.ob-theme-btn { flex: 1; padding: 14px 12px; border-radius: 10px; border: 2px solid var(--border, #2a2d3e); background: var(--bg-input, #0f1117); color: var(--text, #e8eaf6); font-size: 0.98rem; font-weight: 600; cursor: pointer; transition: border-color 0.15s; }
.ob-theme-btn:hover { border-color: var(--accent, #6c63ff); }
.ob-theme-btn.selected { border-color: var(--accent, #6c63ff); background: rgba(108,99,255,0.12); }
@media (max-width: 480px) { .ob-card { padding: 24px 20px; } .ob-step h2 { font-size: 1.2rem; } }

/* ── PWA Install Banner ── */
.pwa-banner { position: fixed; bottom: 0; left: 0; right: 0; z-index: 9000; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--surface, #1a1d2e); border-top: 1px solid var(--border, #2a2d3e); box-shadow: 0 -4px 20px rgba(0,0,0,.4); font-size: 14px; color: var(--text, #e2e8f0); flex-wrap: wrap; }
.pwa-banner-actions { display: flex; gap: 8px; align-items: center; }
.pwa-install-btn { font-size: 13px; padding: 6px 14px; }
.pwa-dismiss-btn { background: none; border: none; cursor: pointer; color: var(--text-muted, #94a3b8); font-size: 16px; padding: 4px; }
.push-settings-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border, #2a2d3e); }