/* Mobile Shell — separate render path for phone/tablet */

:root {
  /* Override base font to 16px on mobile to prevent iOS zoom on input focus */
}

.mobile-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.mobile-view-container {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Widget fills the view */
.mobile-view-container > .block {
  border: none;
  border-radius: 0;
  background: transparent;
  height: 100%;
}
.mobile-view-container > .block > .block-body {
  height: 100%;
}

/* ── Tab Bar ── */

.mobile-tab-bar {
  display: flex;
  position: sticky;
  bottom: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-panel, #1a1a1a);
  border-top: 1px solid var(--border, #333);
  z-index: 100;
  flex-shrink: 0;
}

.mobile-tab {
  flex: 1;
  min-height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-muted, #888);
  font-size: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  padding: 4px 0;
}

.mobile-tab--active {
  color: var(--accent, #646cff);
}

.mobile-tab-icon {
  font-size: 22px;
  line-height: 1;
}

.mobile-tab-label {
  font-size: 10px;
  line-height: 1;
}

/* ── Back Bar ── */

.mobile-back-bar {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border, #333);
  flex-shrink: 0;
}

.mobile-back-btn {
  background: none;
  border: none;
  color: var(--accent, #646cff);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

/* ── Render Error Fallback ── */
/* Shown in place of a widget that threw during render (mobile-shell.js
   _renderActiveView) — keeps the tab bar/back bar visible and gives the
   user a next step instead of a blank pane. */
.mobile-render-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  padding: 24px;
  gap: 8px;
  color: var(--text-muted, #888);
}

.mobile-render-error-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text, #eee);
}

.mobile-render-error-body {
  font-size: 13px;
  max-width: 320px;
}

/* ── Mobile Overrides ── */

/* Hide desktop-only elements when mobile shell is active */
body:has(.mobile-shell) .widget-sidebar,
body:has(.mobile-shell) .add-bar {
  display: none;
}

/* Focus indicators for accessibility */
.mobile-tab:focus-visible,
.mobile-back-btn:focus-visible {
  box-shadow: var(--focus-ring, 0 0 0 2px #646cff);
  outline: none;
}

/* Ensure 16px font on mobile to prevent iOS zoom */
@media (max-width: 768px) {
  :root {
    font-size: 16px;
  }
}
