/**
 * HST shell skin for Staticprofit.
 *
 * Ported from the options_limits platform:
 *   series_tools_python/options_limits_backtest/frontend/src/index.css
 *
 * HST is styled as an options_limits "instance": it inherits the platform's blue-500
 * accent and adopts MetricAlgo azzurro (48 190 217) as its instance colour, driving the
 * same gradient/glow system the options frontend uses — top accent bar, body radial glow,
 * sidebar gradient, card glow, cyan highlights.
 *
 * Compatibility contract — every rule is scoped under `body.hst-shell`. Nothing here can
 * reach the metrix, ma_options or seriestrategy shells, and ma_limits_tokens.css is never
 * modified. Loaded only when config('sp_view.hst_modern_theme') is true.
 */

/* =========================================================
   TOKENS — options palette + HST instance colour
   ========================================================= */
body.hst-shell {
  /* options_limits accents */
  --hst-accent: 59 130 246;        /* blue-500  */
  --hst-accent-hover: 37 99 235;   /* blue-600  */

  /* MetricAlgo azzurro — the HST instance colour */
  --hst-instance: 48 190 217;
  --hst-cyan: 0 229 255;
  --hst-cyan-deep: 0 184 204;
  --hst-cyan-pale: 111 243 255;

  /* instance glow strengths (options drives these per-instance; HST picks a calm set) */
  --hst-body-glow: 0.07;
  --hst-card-glow: 0.06;
  --hst-sidebar-strong: 0.10;
  --hst-sidebar-soft: 0.02;
  --hst-sidebar-border: 0.22;
  --hst-shell-strong: 0.10;
  --hst-shell-soft: 0.04;

  /* surfaces — identical to the options dark ramp */
  --hst-bg: 10 14 23;
  --hst-bg-raised: 17 24 39;
  --hst-surface: 31 41 55;
  --hst-surface-hover: 55 65 81;
  --hst-border: 55 65 81;
  --hst-border-strong: 75 85 99;
  --hst-text: 229 231 235;
  --hst-text-dim: 156 163 175;
  --hst-text-muted: 107 114 128;

  --hst-radius: 0.5rem;
  --hst-radius-lg: 0.75rem;
}

/* =========================================================
   RETUNE THE OPTIONS SKIN INSIDE HST
   HST pages already render inside .ma-limits-skin; overriding the accent tokens
   here re-themes every page without touching the pages or the shared file.
   ========================================================= */
body.hst-shell .ma-limits-skin {
  --color-accent-primary: var(--hst-accent);
  --color-accent-hover: var(--hst-accent-hover);
  --color-accent-cyan: var(--hst-instance);
  --color-accent-cyan-dark: var(--hst-cyan-deep);
  --sidebar-bg: 17 24 39;
  --sidebar-active: 10 14 23;
  --sidebar-hover: 31 41 55;
}

/* =========================================================
   SHELL — body glow + top accent bar (options signature)
   ========================================================= */
body.hst-shell {
  background-color: rgb(var(--hst-bg));
  background-image: radial-gradient(
    circle at top right,
    rgb(var(--hst-instance) / var(--hst-body-glow)) 0%,
    transparent 34%
  );
  background-attachment: fixed;
  color: rgb(var(--hst-text));
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.hst-shell::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    rgb(var(--hst-instance) / 0.95) 0%,
    rgb(var(--hst-cyan-deep) / 0.78) 100%
  );
  box-shadow: 0 0 22px rgb(var(--hst-instance) / 0.45);
  pointer-events: none;
  z-index: 9999;
}

body.hst-shell ::selection {
  background: rgb(var(--hst-instance) / 0.30);
}

body.hst-shell .page,
body.hst-shell .page-main,
body.hst-shell .main-content {
  background: transparent;
}

/* Header — instance gradient washing out to the right, as in .instance-shell-header */
body.hst-shell .app-header.header {
  background-color: rgb(var(--hst-bg-raised) / 0.92);
  background-image: linear-gradient(
    90deg,
    rgb(var(--hst-instance) / var(--hst-shell-strong)) 0%,
    rgb(var(--hst-instance) / var(--hst-shell-soft)) 28%,
    transparent 60%
  );
  border-bottom: 1px solid rgb(var(--hst-border));
  backdrop-filter: blur(10px);
}

/* Sidebar — vertical instance gradient + inset edge, as in .sidebar */
body.hst-shell .app-sidebar {
  background-color: rgb(var(--hst-bg-raised));
  background-image: linear-gradient(
    180deg,
    rgb(var(--hst-instance) / var(--hst-sidebar-strong)) 0%,
    rgb(var(--hst-instance) / var(--hst-sidebar-soft)) 100%
  );
  box-shadow: inset -1px 0 0 rgb(var(--hst-instance) / var(--hst-sidebar-border));
  border-right: 0;
}

body.hst-shell .app-sidebar .header-brand-img {
  max-height: 34px;
  width: auto;
}

/* =========================================================
   SIDEBAR NAVIGATION
   ========================================================= */
body.hst-shell .side-menu__item,
body.hst-shell .slide-item,
body.hst-shell .sub-side-menu__item {
  border-radius: var(--hst-radius);
  color: rgb(var(--hst-text-dim));
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

body.hst-shell .side-menu__item:hover,
body.hst-shell .slide-item:hover,
body.hst-shell .sub-side-menu__item:hover {
  background: rgb(var(--hst-instance) / 0.10);
  color: rgb(var(--hst-text));
}

body.hst-shell .side-menu__item.active,
body.hst-shell .slide.is-expanded > .side-menu__item {
  background: linear-gradient(
    90deg,
    rgb(var(--hst-instance) / 0.22) 0%,
    rgb(var(--hst-instance) / 0.06) 100%
  );
  color: #fff;
  box-shadow: inset 3px 0 0 0 rgb(var(--hst-cyan));
}

body.hst-shell .side-menu__item.active .side-menu__icon,
body.hst-shell .side-menu__item:hover .side-menu__icon {
  color: rgb(var(--hst-cyan));
}

body.hst-shell .side-menu h3,
body.hst-shell .side-menu .sub-category h3 {
  color: rgb(var(--hst-text-muted));
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
}

/* =========================================================
   SURFACES — card glow in the instance colour
   ========================================================= */
body.hst-shell .card,
body.hst-shell .panel {
  background: rgb(var(--hst-surface));
  border: 1px solid rgb(var(--hst-border));
  border-radius: var(--hst-radius-lg);
  box-shadow: 0 10px 30px rgb(var(--hst-instance) / var(--hst-card-glow));
}

body.hst-shell .card:hover {
  border-color: rgb(var(--hst-instance) / 0.35);
}

body.hst-shell .card-header {
  background: transparent;
  border-bottom: 1px solid rgb(var(--hst-border));
}

body.hst-shell .card-title {
  color: rgb(var(--hst-text));
  font-weight: 600;
}

/* =========================================================
   BUTTONS
   ========================================================= */
body.hst-shell .btn {
  border-radius: var(--hst-radius);
  font-weight: 500;
  transition: all 0.2s ease;
}

/* Primary = options blue, flat and solid (matches .btn-primary) */
body.hst-shell .btn-primary {
  background: rgb(var(--hst-accent));
  border-color: rgb(var(--hst-accent));
  color: #fff;
  box-shadow: none;
}

body.hst-shell .btn-primary:hover,
body.hst-shell .btn-primary:focus {
  background: rgb(var(--hst-accent-hover));
  border-color: rgb(var(--hst-accent-hover));
  color: #fff;
}

body.hst-shell .btn-primary:focus-visible {
  outline: 2px solid rgb(var(--hst-accent));
  outline-offset: 2px;
}

/* Call-to-action = the cyan gradient + glow from the options landing treatment */
body.hst-shell .btn-hst-cta,
body.hst-shell .ma-options-auth-btn-primary {
  background: linear-gradient(135deg, #6ff3ff 0%, #00e5ff 50%, #00b8cc 100%);
  border: 0;
  color: #06232b;
  font-weight: 600;
  box-shadow: 0 4px 15px rgb(var(--hst-cyan) / 0.30);
}

body.hst-shell .btn-hst-cta:hover,
body.hst-shell .ma-options-auth-btn-primary:hover {
  background: linear-gradient(135deg, #6ff3ff 0%, #00e5ff 40%, #00b8cc 100%);
  color: #06232b;
  box-shadow: 0 8px 25px rgb(var(--hst-cyan) / 0.40);
}

body.hst-shell .btn-outline-primary,
body.hst-shell .btn-link {
  color: rgb(var(--hst-instance));
  border-color: rgb(var(--hst-instance) / 0.5);
}

body.hst-shell .btn-outline-primary:hover {
  background: rgb(var(--hst-instance) / 0.12);
  color: rgb(var(--hst-cyan-pale));
  border-color: rgb(var(--hst-instance));
}

/* =========================================================
   FORM CONTROLS
   ========================================================= */
body.hst-shell .form-control,
body.hst-shell .form-select,
body.hst-shell .input-group-text {
  background: rgb(var(--hst-bg-raised));
  border-color: rgb(var(--hst-border));
  color: rgb(var(--hst-text));
  border-radius: var(--hst-radius);
}

body.hst-shell .form-control:focus,
body.hst-shell .form-select:focus {
  background: rgb(var(--hst-bg-raised));
  border-color: rgb(var(--hst-instance));
  box-shadow: 0 0 0 3px rgb(var(--hst-instance) / 0.20);
  color: rgb(var(--hst-text));
}

body.hst-shell .form-control::placeholder {
  color: rgb(var(--hst-text-muted));
}

/* The header symbol search ships with .bg-warning; align it to the shell. */
body.hst-shell #symbol_srch.bg-warning {
  background: rgb(var(--hst-bg-raised)) !important;
  border: 1px solid rgb(var(--hst-border));
  color: rgb(var(--hst-text));
}

body.hst-shell #symbol_srch.bg-warning:focus {
  border-color: rgb(var(--hst-instance));
  box-shadow: 0 0 0 3px rgb(var(--hst-instance) / 0.20);
}

body.hst-shell #symbol_srch_toggle .fe-search {
  color: rgb(var(--hst-cyan)) !important;
}

/* =========================================================
   HIGHLIGHTS
   ========================================================= */
body.hst-shell a {
  color: rgb(var(--hst-instance));
}

body.hst-shell a:hover {
  color: rgb(var(--hst-cyan-pale));
}

body.hst-shell .text-primary {
  color: rgb(var(--hst-instance)) !important;
}

/* Gradient headline text, as in .landing-gradient-text */
body.hst-shell .hst-gradient-text {
  background: linear-gradient(135deg, #6ff3ff 0%, #00e5ff 50%, #00b8cc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

body.hst-shell .badge.bg-primary,
body.hst-shell .badge-primary {
  background: rgb(var(--hst-accent)) !important;
  color: #fff;
}

body.hst-shell .table > :not(caption) > * > * {
  border-color: rgb(var(--hst-border));
}

body.hst-shell .table thead th {
  color: rgb(var(--hst-text-dim));
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 11px;
}

body.hst-shell .dropdown-menu {
  background: rgb(var(--hst-surface));
  border: 1px solid rgb(var(--hst-border));
  border-radius: var(--hst-radius);
}

body.hst-shell .dropdown-item:hover,
body.hst-shell .dropdown-item:focus {
  background: rgb(var(--hst-instance) / 0.12);
  color: rgb(var(--hst-text));
}

body.hst-shell .ma-platform-switcher {
  background: rgb(var(--hst-surface));
  border: 1px solid rgb(var(--hst-instance) / 0.35);
  border-radius: var(--hst-radius);
}

/* =========================================================
   APP LINK — cross-platform entry to app.metricalgo.com
   ========================================================= */
body.hst-shell .hst-applink-item {
  list-style: none;
}

body.hst-shell .hst-applink {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 12px 4px;
  padding: 10px 12px;
  border-radius: var(--hst-radius);
  border: 1px solid rgb(var(--hst-instance) / 0.35);
  background: linear-gradient(
    135deg,
    rgb(var(--hst-instance) / 0.18) 0%,
    rgb(var(--hst-instance) / 0.05) 100%
  );
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

body.hst-shell .hst-applink:hover {
  border-color: rgb(var(--hst-cyan) / 0.6);
  box-shadow: 0 0 18px rgb(var(--hst-cyan) / 0.22);
}

body.hst-shell .hst-applink__logo {
  height: 18px;
  width: auto;
  flex: 0 0 auto;
}

body.hst-shell .hst-applink__text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

body.hst-shell .hst-applink__title {
  font-size: 12px;
  font-weight: 600;
  color: rgb(var(--hst-text));
}

body.hst-shell .hst-applink__sub {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgb(var(--hst-cyan));
}

body.hst-shell .hst-applink__out {
  margin-left: auto;
  font-size: 11px;
  color: rgb(var(--hst-text-muted));
}

/* =========================================================
   AUTH (nouser) SURFACES
   ========================================================= */
body.hst-shell .ma-options-auth-card {
  background: rgb(var(--hst-surface));
  border: 1px solid rgb(var(--hst-border));
  border-radius: var(--hst-radius-lg);
  box-shadow: 0 20px 48px rgb(2 8 23 / 0.45),
              0 10px 30px rgb(var(--hst-instance) / var(--hst-card-glow));
}

body.hst-shell .ma-options-auth-logo img {
  max-height: 52px;
  width: auto;
}

body.hst-shell .ma-options-auth-logo-sub {
  color: rgb(var(--hst-cyan));
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
}

body.hst-shell .ma-options-auth-link {
  color: rgb(var(--hst-instance));
}

body.hst-shell .ma-options-auth-orbs .ma-orb-1 {
  background: radial-gradient(circle, rgb(var(--hst-cyan) / 0.18), transparent 70%);
}

body.hst-shell .ma-options-auth-orbs .ma-orb-2 {
  background: radial-gradient(circle, rgb(var(--hst-accent) / 0.16), transparent 70%);
}

body.hst-shell .ma-options-auth-orbs .ma-orb-3 {
  background: radial-gradient(circle, rgb(var(--hst-instance) / 0.12), transparent 70%);
}

/* =========================================================
   BRAND LOCKUP
   ========================================================= */
body.hst-shell .hst-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

body.hst-shell .hst-brand__mark {
  height: 26px;
  width: auto;
}

body.hst-shell .hst-brand__tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgb(var(--hst-cyan));
  border: 1px solid rgb(var(--hst-cyan) / 0.45);
  border-radius: 4px;
  padding: 2px 6px;
  line-height: 1;
}

/* =========================================================
   SCROLLBARS — match the options skin
   ========================================================= */
body.hst-shell ::-webkit-scrollbar { width: 8px; height: 8px; }
body.hst-shell ::-webkit-scrollbar-track { background: rgb(var(--hst-bg-raised)); }
body.hst-shell ::-webkit-scrollbar-thumb {
  background: rgb(var(--hst-surface-hover));
  border-radius: 4px;
}
body.hst-shell ::-webkit-scrollbar-thumb:hover { background: rgb(var(--hst-border-strong)); }

/* =========================================================
   MOTION
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  body.hst-shell *,
  body.hst-shell *::before,
  body.hst-shell *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
