/* OncoEdge unified app shell – fixed header/footer with dynamic height vars */

:root {
  --oe-header-h: 64px;
  --oe-footer-h: 56px;
  --oe-subheader-h: 0px;
  --oe-safe-top: env(safe-area-inset-top, 0px);
  --oe-safe-bottom: env(safe-area-inset-bottom, 0px);
  --oe-sidebar-width: min(320px, 88vw);
  --oe-content-max: 1440px;
  --oe-content-pad: clamp(1rem, 3vw, 2rem);
  --oe-z-header: 200;
  --oe-z-footer: 200;
  --oe-z-sidebar: 250;
  --oe-z-overlay: 240;
  --oe-z-loader: 3000;

  /* Elevation — restrained, layered (no muddy blur shadows) */
  --oe-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.06);
  --oe-shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.06);
  --oe-shadow-md: 0 8px 24px -6px rgba(0, 0, 0, 0.18), 0 2px 6px -2px rgba(0, 0, 0, 0.08);
  --oe-shadow-inset-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --oe-border-subtle: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] {
  --oe-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --oe-shadow-sm: 0 2px 8px -2px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --oe-shadow-md: 0 8px 24px -6px rgba(15, 23, 42, 0.1), 0 2px 6px -2px rgba(15, 23, 42, 0.05);
  --oe-shadow-inset-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  --oe-border-subtle: rgba(15, 23, 42, 0.08);
}

.oe-app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100vw;
  position: relative;
  overflow: hidden;
}

/* --- Chrome (header / subheader / footer) --- */
.oe-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--oe-z-header);
  background: var(--banner-glass-bg);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--oe-border-subtle);
  box-shadow: var(--oe-shadow-xs);
  padding: 0.625rem var(--oe-content-pad) 0.625rem clamp(0.35rem, 1.2vw, 0.75rem);
  padding-top: calc(0.625rem + var(--oe-safe-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: nowrap;
}

.oe-header__brand,
.oe-header__brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1 1 auto;
  margin-left: -0.15rem;
  text-decoration: none;
  color: inherit;
}

.oe-header__logo {
  height: clamp(36px, 7vw, 44px);
  width: auto;
  flex-shrink: 0;
}

.oe-header__title {
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.oe-header__controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.oe-header__controls--desktop {
  display: flex;
}

.oe-subheader {
  position: fixed;
  top: var(--oe-header-h);
  left: 0;
  right: 0;
  z-index: calc(var(--oe-z-header) - 1);
  background: var(--banner-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--oe-border-subtle);
  padding: 0.5rem var(--oe-content-pad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.8rem, 2vw, 0.95rem);
  color: var(--muted-text);
  box-shadow: none;
}

.oe-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--oe-z-footer);
  background: var(--banner-bg);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border-top: 1px solid var(--oe-border-subtle);
  box-shadow: 0 -1px 0 var(--oe-border-subtle);
  padding: 0.75rem var(--oe-content-pad);
  padding-bottom: calc(0.75rem + var(--oe-safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

.oe-footer__inner {
  width: 100%;
  max-width: var(--oe-content-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.oe-footer__copyright {
  font-size: clamp(0.72rem, 1.8vw, 0.85rem);
  text-align: center;
  color: var(--muted-text);
}

.oe-footer__copyright img {
  height: 18px;
  vertical-align: middle;
  opacity: 0.9;
}

/* --- Main content — full width utilisation --- */
.oe-main {
  flex: 1;
  margin-top: calc(var(--oe-header-h) + var(--oe-subheader-h) + var(--oe-safe-top));
  margin-bottom: calc(var(--oe-footer-h) + var(--oe-safe-bottom));
  min-height: 0;
  overflow: hidden;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.oe-main__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
  padding: var(--oe-content-pad);
}

.oe-main__inner {
  width: 100%;
  max-width: var(--oe-content-max);
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.oe-main__scroll--full .oe-main__inner {
  max-width: var(--oe-content-max);
  margin-left: auto;
  margin-right: auto;
}

/* Premium surface card */
.oe-surface {
  background: var(--glass-card-bg);
  border: 1px solid var(--glass-card-border);
  border-radius: 16px;
  box-shadow: var(--oe-shadow-sm), var(--oe-shadow-inset-highlight);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
}

.oe-card--fill {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: clamp(1rem, 2.5vw, 1.5rem);
}

.oe-card--fill .oe-card__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.oe-app[data-variant="landing"] .oe-subheader--nav {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.oe-app[data-variant="minimal"] .oe-header,
.oe-app[data-variant="minimal"] .oe-footer {
  display: none;
}

.oe-app[data-variant="minimal"] .oe-main {
  margin-top: 0;
  margin-bottom: 0;
}

.oe-app[data-variant="contouring-workspace"] {
  --oe-header-h: 50px;
  --oe-footer-h: 0px;
}

.oe-app[data-variant="contouring-workspace"] .oe-footer {
  display: none;
}

.oe-app[data-variant="contouring-workspace"] .oe-header {
  min-height: var(--oe-header-h);
  padding: 0 1rem;
}

.oe-app[data-variant="contouring-workspace"] .oe-header__logo {
  height: 32px;
}

.oe-app[data-variant="contouring-workspace"] .oe-header__title {
  font-size: 1.1rem;
}

.oe-app[data-variant="contouring-workspace"] .oe-main {
  margin-top: calc(var(--oe-header-h) + var(--oe-safe-top));
  margin-bottom: 0;
  overflow: hidden;
  padding: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#ct-workspace-container {
  flex: 1;
  min-height: 0;
}

.oe-floating-controls {
  position: fixed;
  top: calc(1rem + var(--oe-safe-top));
  right: var(--oe-content-pad);
  z-index: var(--oe-z-header);
  display: flex;
  gap: 0.5rem;
}

@media (max-width: 768px) {
  :root {
    --oe-content-pad: clamp(0.75rem, 4vw, 1rem);
    --oe-header-h: 56px;
    --oe-footer-h: 48px;
  }

  .oe-header__controls--desktop {
    display: none;
  }

  .oe-header__hamburger {
    display: flex;
  }

  .oe-main__scroll {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }
}

@media (min-width: 769px) {
  .oe-header__hamburger {
    display: none;
  }
}

@media (min-width: 1200px) {
  :root {
    --oe-content-max: 1600px;
  }
}
