/* viDeliver - Shared Standard Mobile Viewport & App Shell Layout
 * Supports iOS & Android PWAs (Chrome, Safari, Firefox, Edge).
 * Guarantees Top Header and Bottom Navigation are ALWAYS visible simultaneously,
 * while only the middle content area scrolls.
 */

:root {
  --header-height: 52px;
  --bottom-nav-height: 56px;
}

/* 1. Viewport Base: Allows natural vertical scrolling while keeping sticky headers active */
*, *::before, *::after {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

input,
textarea,
select,
[contenteditable="true"],
[contenteditable=""] {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
  -webkit-touch-callout: default !important;
}

html {
  min-height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body {
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow: visible;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* 2. App Shell: Dynamic Viewport Height (100dvh) */
.app-shell, .page {
  width: 100% !important;
  max-width: 430px !important;
  margin: 0 auto !important;
  height: 100vh !important;
  height: 100dvh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  position: relative !important;
  padding-bottom: 0 !important; /* Managed by bottom-nav flex */
}

/* 3. Header: Pinned at top, compact, notch/safe-area aware */
.header, header.header {
  flex-shrink: 0 !important;
  padding-top: max(10px, env(safe-area-inset-top)) !important;
  padding-bottom: 12px !important;
  padding-left: 14px !important;
  padding-right: 14px !important;
  z-index: 50 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

/* Header typography tightening */
.header-top {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  min-height: 32px !important;
}

.header-title, .header-title-text {
  font-size: 16px !important;
  font-weight: 700 !important;
}

.header-sub, .header-date {
  font-size: 11px !important;
  margin-top: 2px !important;
}

/* Fixed sub-headers, strips, filter bars directly below header */
.stats-strip, .view-mode-tabs, .toolbar-wrap, .sched-tabs-wrap, .summary-grid, .info-banner, .save-bar, .bottom-panel {
  flex-shrink: 0 !important;
}

.stats-strip {
  position: relative !important;
  z-index: 55 !important;
}

/* 4. Middle Content Container: Scrolls smoothly with momentum */
.content, .main-scroll-view, .agent-content, main.content, .scroll-content {
  flex: 1 1 auto !important;
  min-height: 0 !important; /* Critical for flex child scrolling */
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  padding-bottom: 20px !important;
}


/* Custom Scrollbar for sleek UI */
.content::-webkit-scrollbar,
.main-scroll-view::-webkit-scrollbar,
.scroll-content::-webkit-scrollbar {
  width: 4px;
}
.content::-webkit-scrollbar-thumb,
.main-scroll-view::-webkit-scrollbar-thumb,
.scroll-content::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.2);
  border-radius: 4px;
}

/* 5. Bottom Navigation Bar: Pinned directly at bottom of flex shell */
.bottom-nav, nav.bottom-nav {
  flex-shrink: 0 !important;
  position: relative !important; /* No longer fixed to avoid viewport clipping */
  bottom: auto !important;
  left: auto !important;
  transform: none !important;
  width: 100% !important;
  max-width: 430px !important;
  height: var(--bottom-nav-height) !important;
  padding-bottom: env(safe-area-inset-bottom) !important;
  background: #FFFFFF !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-around !important;
  z-index: 100 !important;
  border-top: 1px solid rgba(226, 232, 240, 0.9) !important;
  box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.04) !important;
}

.bottom-nav .nav-item, nav.bottom-nav .nav-item {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  height: 100% !important;
  text-decoration: none !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  gap: 3px !important;
}

.bottom-nav .nav-item i, nav.bottom-nav .nav-item i {
  font-size: 17px !important;
}
