/* ============================================================================
   Platform-wide "hide sidebar" control.

   Pages opt in with {% include "components/sidebar_toggle.html" %}. The
   collapsed state lives on <html class="ia-sb-hidden"> so sidebar-toggle.js can
   restore it from localStorage before the sidebar paints.

   Every left navigation rail in the platform is listed in the collapse rules
   below; a page with a bespoke rail can opt in by adding data-ia-sidebar to it
   instead of adding another class here (the JS matches the same selector list).
   ========================================================================== */

/* ── The button ─────────────────────────────────────────────────────────── */
.ia-sb-toggle {
  position: fixed;
  top: 14px;
  left: 236px;               /* pre-measure default; JS pins it to the real edge */
  z-index: 1200;             /* over .app-sidebar (1000) and .app-navbar (999) */
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: #0b57d0;      /* matches the rail accent in css/sidebar-theme.css */
  color: #ffffff;
  cursor: pointer;
  opacity: 0.9;
  box-shadow: 0 2px 8px rgba(11, 87, 208, 0.35);
  transition: left 0.3s ease, opacity 0.15s ease, background 0.15s ease;
}

.ia-sb-toggle:hover,
.ia-sb-toggle:focus-visible {
  opacity: 1;
  background: #0842a0;
}

.ia-sb-toggle:focus-visible {
  outline: 2px solid #1b1b1f;
  outline-offset: 2px;
}

.ia-sb-toggle svg {
  width: 16px;
  height: 16px;
  display: block;
}

.ia-sb-toggle .ia-sb-ic-show { display: none; }
html.ia-sb-hidden .ia-sb-toggle .ia-sb-ic-show { display: block; }
html.ia-sb-hidden .ia-sb-toggle .ia-sb-ic-hide { display: none; }

/* ── Collapsed state ────────────────────────────────────────────────────
   Desktop only: below 993px the rails are already off-canvas drawers with
   their own hamburgers, and hiding them here would leave those drawers
   permanently empty. The button itself is hidden at the same breakpoint.  */
@media (min-width: 993px) {
  html.ia-sb-hidden [data-ia-sidebar],
  html.ia-sb-hidden .app-sidebar,      /* base_app.html + business_plan/strategy_builder chat */
  html.ia-sb-hidden .ss-aside,         /* solarsizer_ai landing + _base_ss */
  html.ia-sb-hidden .ia-main-sidebar,  /* components/sidebar_standalone.html */
  html.ia-sb-hidden .hd-sidebar,       /* home_design */
  html.ia-sb-hidden .sb-sidebar,       /* startup_builder _base_sb */
  html.ia-sb-hidden .chat-sidebar {    /* business_plan project_chat */
    display: none !important;
  }

  /* Rails that are position:fixed leave a gutter on the main column. */
  html.ia-sb-hidden .app-main,
  html.ia-sb-hidden .ss-main-col {
    margin-left: 0 !important;
  }

  /* home_design's shell is a grid, not a margin offset. */
  html.ia-sb-hidden .hd-shell {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 992px) {
  .ia-sb-toggle { display: none; }
}

@media print {
  .ia-sb-toggle { display: none; }
}
