/* AlgoBK Pro — thin 32px footer bar + full-height app shell */

:root {
  --footer-bar-height: 32px;
}

/* ── Thin footer: exact 32px; no tall black band above the text ── */
.site-footer {
  position: relative !important;
  z-index: 50;
  flex: 0 0 var(--footer-bar-height) !important;
  flex-grow: 0 !important;
  flex-shrink: 0 !important;
  height: var(--footer-bar-height) !important;
  max-height: var(--footer-bar-height) !important;
  min-height: var(--footer-bar-height) !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  box-sizing: border-box;
  background: var(--color-chrome, #11161F) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none !important;
  color: var(--color-text-3, #7c8899);
  font-family: var(--font-sans, 'Inter', sans-serif);
  overflow: hidden;
}

/* Public pages scroll behind a footer that stays anchored to the viewport. */
body:not(.app-shell) {
  padding-bottom: var(--footer-bar-height);
}

body:not(.app-shell) > .site-footer {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
}

body.app-shell .main-body > .site-footer,
body.app-shell .page-window-body > .site-footer {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  flex: 0 0 var(--footer-bar-height) !important;
  height: var(--footer-bar-height) !important;
  max-height: var(--footer-bar-height) !important;
  min-height: var(--footer-bar-height) !important;
}

.site-footer .site-footer-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  width: 100%;
  padding: 0 12px;
  box-sizing: border-box;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.site-footer-brand-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-2, #A8B3C7);
}

.site-footer-copy,
.site-footer-meta {
  margin: 0;
  font-size: 10px;
  color: var(--color-text-3, #7c8899);
}

/* Fixed-dark pages (landing/login/register/anon error pages) resolve
   --color-text-3 to #6B7280, only 3.34:1 against this bar's #1B1D42 —
   fails WCAG AA. Override there with a lighter shade that keeps the muted
   footer look but clears 4.5:1. Scoped to fixed-dark so the theme-able
   app-shell footer (light/dark toggle) is untouched. */
html[data-theme-policy="fixed-dark"] .site-footer-copy,
html[data-theme-policy="fixed-dark"] .site-footer-meta {
  color: #828CA0;
}

.site-footer-sep {
  opacity: 0.4;
}

/* Content fills all space above the 32px footer */
body.app-shell .main-body,
body.app-shell .page-window-body {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.app-shell .main-body > .content:not(.page-window-content),
body.app-shell .page-window-body > .page-window-content,
body.app-shell .page-window-body > main.page-window-content {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  max-height: none !important;
  height: auto !important;
  overflow-y: auto !important;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 12px !important;
}

/* Strategy Hub + Dashboard: edge-to-edge full page */
body.app-shell .main-page-window .content:has(.strategy-workspace),
body.app-shell .main-page-window .content:has(.dash-pro),
body.app-shell .main-page-window .content:has(.dashboard) {
  padding-left: 0 !important;
  padding-right: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 12px !important;
}

body.auth-page .site-footer {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  background: var(--color-chrome, #11161F) !important;
}

@media (max-width: 768px) {
  .site-footer .site-footer-bar {
    flex-wrap: wrap;
    white-space: normal;
    font-size: 10px;
    gap: 4px 6px;
  }
}

/* App shell — sidebar + main share exact viewport height */
body.app-shell {
  display: flex;
  align-items: stretch;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
}

body.app-shell > .sidebar {
  position: relative;
  flex-shrink: 0;
  width: 240px;
  align-self: stretch;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
}

body.app-shell > .main {
  flex: 1;
  min-width: 0;
  margin-left: 0 !important;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.auth-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.auth-page.login-landing-page {
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
}

body.auth-page .auth-shell {
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  padding: 24px 0;
}

body.auth-page.login-landing-page .auth-shell {
  flex: none;
  display: block;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  width: 100%;
  max-width: none;
  overflow: visible;
}

@media (max-width: 768px) {
  body.app-shell > .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body.app-shell > .sidebar .sidebar-logo {
    flex-shrink: 0;
  }

  body.app-shell > .sidebar .sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.app-shell > .sidebar .sidebar-bottom {
    flex-shrink: 0;
  }

  body.app-shell > .main .main-body,
  body.app-shell > .main .page-window-body {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }

  body.app-shell > .main .main-body > .content:not(.page-window-content),
  body.app-shell > .main .page-window-body > main.page-window-content,
  body.app-shell > .main .page-window-body > .content.page-window-content {
    flex: 1 1 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.app-shell > .main .main-body > .site-footer,
  body.app-shell > .main .page-window-body > .site-footer {
    position: relative !important;
    flex: 0 0 var(--footer-bar-height) !important;
    height: var(--footer-bar-height) !important;
    max-height: var(--footer-bar-height) !important;
    width: 100% !important;
    margin: 0 !important;
  }
}
