/* REALORA shared shell and routed-view design system. */
:root {
  color-scheme: dark;
  --realora-bg: #05070c;
  --realora-surface: #0a0d15;
  --realora-card: #11141c;
  --realora-card-raised: #171c26;
  --realora-border: #263040;
  --realora-text: #f5f7fb;
  --realora-muted: #9ca3af;
  --realora-dim: #717b8b;
  --realora-gold: #d7a241;
  --realora-gold-hover: #e8b84a;
  --realora-danger: #ef4444;
  --realora-success: #22c55e;
  --realora-radius-sm: 10px;
  --realora-radius-md: 14px;
  --realora-radius-lg: 20px;
  --realora-shadow: 0 18px 48px rgba(0, 0, 0, .28);
}

/* Hide the Leaflet branding flag/credit; keep the required map-data credit visible. */
.leaflet-attribution-flag { display: none !important; }
.leaflet-container .leaflet-control-attribution {
  padding: 1px 5px !important;
  border-top-left-radius: 6px;
  background: rgba(5, 7, 12, .78) !important;
  color: #d1d5db !important;
  font-size: 9px !important;
  line-height: 1.4 !important;
}
.leaflet-container .leaflet-control-attribution a {
  color: #e8b84a !important;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Consistent heart appearance across cards and detail views. */
.like-heart {
  display: inline-block;
  flex: 0 0 14px;
  width: 14px !important;
  min-width: 14px;
  height: 14px !important;
  color: currentColor;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  vertical-align: middle;
}
.like-heart.is-liked {
  color: #ef4444 !important;
  fill: #ef4444 !important;
  stroke: #ef4444 !important;
}

/* Home shell: preserve the centered layout and leave room for sticky navigation. */
.app-container {
  min-width: 0;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

#page-home {
  padding-bottom: max(112px, calc(env(safe-area-inset-bottom) + 100px));
}

.bottom-nav {
  position: fixed;
  z-index: 10010;
  left: 50%;
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 10px));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: max-content;
  max-width: calc(100vw - 24px);
  margin: 0;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 999px;
  background: #10141d;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .48), inset 0 1px rgba(255, 255, 255, .05);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transform: translateX(-50%);
}

.bottom-nav.is-hidden { display: none !important; }

.bottom-nav .nav-item {
  position: relative;
  display: inline-flex;
  flex: 0 0 48px;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 48px;
  min-width: 48px;
  height: 48px;
  margin: 0;
  padding: 0 13px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(236, 240, 247, .68);
  cursor: pointer;
  font: 600 13px/1 'Plus Jakarta Sans', Vazirmatn, sans-serif;
  text-decoration: none;
  white-space: nowrap;
  transition: width .28s cubic-bezier(.2,.8,.2,1), flex-basis .28s cubic-bezier(.2,.8,.2,1), color .2s ease, background-color .2s ease, transform .2s ease;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav .nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, .07);
}

.bottom-nav .nav-item:active { transform: scale(.96); }

.bottom-nav .nav-item.active {
  flex-basis: 110px;
  width: 110px;
  color: #f1c46e;
  background: rgba(215, 162, 65, .16);
}

.bottom-nav .nav-item.nav-upload.active { flex-basis: 112px; width: 112px; }

.bottom-nav .nav-icon {
  display: block;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  font-size: 22px;
  transform-origin: center;
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
}

.bottom-nav .nav-item.active .nav-icon { transform: scale(1.1); }
.bottom-nav #navExplore.active .nav-icon { transform: scale(1.1) rotate(-10deg); }

.bottom-nav .nav-label {
  display: block;
  flex: 0 1 auto;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-width .28s ease, opacity .18s ease .04s;
}

.bottom-nav .nav-item.active .nav-label { max-width: 76px; opacity: 1; }
.bottom-nav .nav-upload.active .nav-label { max-width: 78px; }

.bottom-nav .nav-item:focus-visible {
  z-index: 1;
  outline: 2px solid #f1c46e;
  outline-offset: 3px;
}

@media (max-width: 360px) {
  .bottom-nav { gap: 2px; padding: 6px; }
  .bottom-nav .nav-item { flex-basis: 42px; width: 42px; min-width: 42px; height: 46px; padding-inline: 10px; }
  .bottom-nav .nav-item.active { flex-basis: 92px; width: 92px; }
  .bottom-nav .nav-item.nav-upload.active { flex-basis: 96px; width: 96px; }
  .bottom-nav .nav-icon { width: 21px; height: 21px; flex-basis: 21px; }
}

@media (min-width: 768px) {
  .bottom-nav { bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px)); }
}

/* Routed page host is the only scrolling viewport; legacy page body rules are
   intentionally neutralized so each view uses the same full-screen frame. */
#modalIframe {
  --bg-base: var(--realora-bg) !important;
  --bg-main: var(--realora-bg) !important;
  --bg-dark: var(--realora-bg) !important;
  --app-bg: var(--realora-surface) !important;
  --bg-card: var(--realora-card) !important;
  --bg-card-section: var(--realora-card) !important;
  --card-bg: var(--realora-card) !important;
  --bg-surface: var(--realora-card) !important;
  --bg-surface-light: var(--realora-card-raised) !important;
  --card-inner: var(--realora-card-raised) !important;
  --card-border: var(--realora-border) !important;
  --border-color: var(--realora-border) !important;
  --text-main: var(--realora-text) !important;
  --text-white: var(--realora-text) !important;
  --text-primary: var(--realora-text) !important;
  --text-secondary: var(--realora-muted) !important;
  --text-muted: var(--realora-muted) !important;
  --text-dim: var(--realora-dim) !important;
  --primary-gold: var(--realora-gold) !important;
  --primary-color: var(--realora-gold) !important;
  --primary-color-hover: var(--realora-gold-hover) !important;
  --accent-gold: var(--realora-gold) !important;
  --gold: var(--realora-gold) !important;
  --gold-color: var(--realora-gold) !important;
  --accent-purple: var(--realora-gold) !important;
  --accent-purple-light: var(--realora-gold-hover) !important;
  --accent-purple-dark: #a67627 !important;
  --accent-gradient: linear-gradient(135deg, #f0bd59 0%, #c48b31 100%) !important;
  --border-radius-sm: var(--realora-radius-sm) !important;
  --border-radius-md: var(--realora-radius-md) !important;
  --border-radius-lg: var(--realora-radius-lg) !important;
  box-sizing: border-box !important;
  display: block !important;
  position: relative;
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scroll-padding-bottom: 16px;
  background: var(--realora-bg) !important;
  color: var(--realora-text);
  font-family: 'Plus Jakarta Sans', Vazirmatn, sans-serif;
  scrollbar-color: #343b49 transparent;
  scrollbar-width: thin;
}

.modal-overlay.dock-visible #modalIframe {
  padding-bottom: calc(104px + env(safe-area-inset-bottom)) !important;
  scroll-padding-bottom: calc(112px + env(safe-area-inset-bottom));
}

#modalIframe::-webkit-scrollbar { width: 8px; }
#modalIframe::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #343b49;
  background-clip: padding-box;
}
#modalIframe::-webkit-scrollbar-track { background: transparent; }

#modalIframe .mobile-frame,
#modalIframe .app-container {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 1200px !important;
  height: auto !important;
  min-height: 100% !important;
  max-height: none !important;
  margin-inline: auto !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

#modalIframe .mobile-frame {
  overflow: visible !important;
  background: transparent;
}

#modalIframe .scroll-content,
#modalIframe .content-area {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  -webkit-overflow-scrolling: auto;
}

/* The route host owns vertical scrolling. Preserve explicitly bounded UI panels
   (chat history, lists inside open dialogs) as their own small scroll regions. */
#modalIframe .messages-container,
#modalIframe .internal-modal-content,
#modalIframe .photo-details-content {
  min-height: 0;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

#modalIframe .messages-container { max-height: min(52dvh, 620px); }

#modalIframe button,
#modalIframe input,
#modalIframe select,
#modalIframe textarea {
  font-family: inherit;
}

#modalIframe input,
#modalIframe select,
#modalIframe textarea {
  max-width: 100%;
  accent-color: var(--realora-gold);
}

#modalIframe :is(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--realora-gold) !important;
  outline-offset: 3px;
}

#modalIframe button,
#modalIframe [role="button"] {
  -webkit-tap-highlight-color: transparent;
}

#modalIframe button:disabled,
#modalIframe [aria-disabled="true"] {
  cursor: not-allowed !important;
  opacity: .58;
}

#modalIframe img,
#modalIframe video,
#modalIframe canvas,
#modalIframe svg {
  max-width: 100%;
}

#modalIframe .btn {
  min-width: 0;
  max-width: 100%;
  font-family: inherit;
}

#modalIframe .top-app-bar,
#modalIframe .profile-header,
#modalIframe .header,
#modalIframe .stories-header {
  border-color: rgba(255, 255, 255, .08);
}

#modalIframe .card,
#modalIframe .profile-card,
#modalIframe .settings-group,
#modalIframe .section-card {
  border-color: var(--realora-border);
}

/* Upload has two compact map controls beside a flexible search field. */
#modalIframe .app-container .input-group > .btn {
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  padding-inline: 0;
}
#modalIframe .app-container .location-search-row > .location-action-btn {
  flex: 0 0 42px;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
}
#modalIframe .app-container .input-group > div[style*="flex:1"],
#modalIframe .app-container .input-group > div[style*="flex: 1"] {
  min-width: 0;
}
#modalIframe .app-container .form-control {
  min-width: 0;
}

@media (max-width: 480px) {
  #modalIframe .app-container {
    padding-inline: 12px !important;
  }
  #modalIframe .mobile-frame {
    padding-inline: 0 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #modalIframe *,
  #modalIframe *::before,
  #modalIframe *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
