/* BioStudio AI — mobile shell layout */

#os.shell-mobile {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

.mobile-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  position: relative;
  z-index: 2;
}

.mobile-status-bar {
  flex: 0 0 var(--ios-status-h, 0px);
  min-height: env(safe-area-inset-top, 0px);
  background: var(--ios-bg);
}

.mobile-stack-nav {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(72px, 1fr) minmax(0, 2fr) minmax(72px, 1fr);
  align-items: center;
  gap: 4px;
  min-height: var(--ios-nav-h);
  padding: 0 12px;
  background: var(--ios-grouped);
  border-bottom: 0.5px solid var(--ios-separator);
}

.mobile-stack-back {
  border: none;
  background: none;
  color: var(--ios-accent);
  font-size: 17px;
  font-weight: 400;
  min-height: var(--ios-touch);
  padding: 0 4px;
  cursor: pointer;
  justify-self: start;
}

.mobile-stack-title {
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: var(--ios-label);
  margin-right: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-stack-nav-spacer { width: 0; justify-self: end; }

.mobile-stack-body {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.mobile-apps-pane {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px calc(var(--ios-tab-h) + 16px);
  background: var(--ios-bg);
}

.mobile-apps-header { margin: 8px 0 20px; }
.mobile-apps-title { font-size: 34px; font-weight: 700; letter-spacing: -0.4px; }
.mobile-apps-sub { font-size: 15px; color: var(--ios-secondary); margin-top: 4px; }

.mobile-apps-section { margin-bottom: 24px; }
.mobile-apps-section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ios-secondary);
  margin: 0 4px 8px;
}

.mobile-apps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 8px;
}

.mobile-app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  padding: 8px 4px;
  cursor: pointer;
  min-height: var(--ios-touch);
}

.mobile-app-tile-icon {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  background: var(--ios-grouped);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.mobile-app-tile-label {
  font-size: 11px;
  text-align: center;
  color: var(--ios-label);
  line-height: 1.2;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-tab-bar {
  flex: 0 0 var(--ios-tab-h);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  padding-top: 6px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(249, 249, 249, 0.94);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 0.5px solid var(--ios-separator);
}

#os.shell-mobile.dark .mobile-tab-bar {
  background: rgba(28, 28, 30, 0.94);
}

.mobile-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: none;
  background: none;
  color: var(--ios-secondary);
  font-size: 10px;
  min-height: 44px;
  cursor: pointer;
  padding: 2px 4px;
}

.mobile-tab.active { color: var(--ios-accent); }

.mobile-tab-icon { display: flex; align-items: center; justify-content: center; }

/* Mobile windows live inside stack body */
#os.shell-mobile .mobile-stack-body .window {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  border: none !important;
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

#os.shell-mobile .mobile-stack-body .window.mobile-hidden {
  visibility: hidden;
  pointer-events: none;
  transform: translateX(100%);
}

#os.shell-mobile .mobile-stack-body .window .window-titlebar {
  display: none !important;
}

#os.shell-mobile .mobile-stack-body .window .resize-handle {
  display: none !important;
}

#os.shell-mobile .mobile-stack-body .window-body {
  height: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

#os.shell-mobile .mobile-stack-body .desktop-surface {
  display: none;
}

/* Hide desktop-only chrome on mobile */
#os.shell-mobile .fullscreen-message,
#os.shell-mobile .taskbar-reveal-hotspot,
#os.shell-mobile .taskbar-reveal-hint,
#os.shell-mobile .bs-display-badge {
  display: none !important;
}

@media (max-width: 360px) {
  .mobile-apps-grid { grid-template-columns: repeat(3, 1fr); }
}
