/* ============================================
   GLOBAL THEME VARIABLES
============================================ */

:root {
  --app-bg: #1B1D3C;
  --app-border: 1px solid rgba(255, 255, 255, 0.15);

  /* Height of the header bar (approx – used for rail overlay) */
  --header-height: 68px;

  --header-shadow: 0 6px 0px -2px rgba(0, 0, 0, 0.45);
  --sidebar-shadow: 6px 0 5px -2px rgba(0, 0, 0, 0.45);

  --app-nav-accent: #FFD93D;
  --accent: var(--app-nav-accent);
  --nav-hover: rgba(255, 255, 255, 0.05);
  --nav-active-bg: rgba(255, 255, 255, 0.08);
}

/* ============================================
   BASE TYPOGRAPHY
============================================ */

body {
  font-weight: 200;
  background: var(--app-bg);
  color: #ffffff;
  margin: 0;
}

h1, h2, h3, h4, h5, h6 { font-weight: 100; }
button, .btn { font-weight: 200; }

/* ============================================
   SIDEBAR (RIGHT SHADOW + RIGHT BORDER)
============================================ */

/* ============================================
   SIDEBAR (RIGHT SHADOW + RIGHT BORDER)
============================================ */

.sidebar {
  /* Product pages can set --accent for their content; navigation stays on the app theme. */
  --accent: var(--app-nav-accent);
  font-family: var(--bs-body-font-family, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");
  font-size: 16px;
  font-weight: 200;
  line-height: 1.5;
  color: #fff;
  -webkit-font-smoothing: auto;
  width: 64px;
  height: 100%;
  background-color: var(--app-bg);
  overflow: visible;

  border-right: var(--app-border);
  box-shadow: var(--sidebar-shadow);

  position: relative;
  z-index: 10;

  flex: 0 0 64px;

  transition:
    width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    flex-basis 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.3s ease,
    box-shadow 0.3s ease;
}

.sidebar, .sidebar * { box-sizing: border-box; }

.sidebar .sidebar-section-heading {
  position: relative;
  min-height: 23px;
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 100;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 4px;
  padding-left: 24px;
  margin: 8px 0;
  display: flex;
  align-items: center;
}
.sidebar .sidebar-section-heading .sidebar-icon,
.sidebar .sidebar-section-heading .legacy-flask-section-icon {
  position: absolute;
  left: 0;
  top: 0;
}

.sidebar .sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.sidebar .sidebar-links-nav { padding: 0; margin-top: 0; }
.sidebar .sidebar-links-nav.mb-4 { margin-bottom: 24px !important; }
.sidebar .sidebar-links-nav .nav-link {
  display: block;
  font: inherit;
  line-height: 1.5;
  text-decoration: none;
}
.sidebar .sidebar-links-nav .nav-link:focus-visible,
.sidebar .sidebar-toggle-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sidebar .nav-link.text-white { color: #fff; }
.sidebar .nav-link.text-secondary { color: #6c757d; }
.sidebar .sidebar-toggle-btn { font: inherit; color: #fff; }
.sidebar .legacy-flask-toggle-icon { width: 20px; height: 20px; }
.sidebar .legacy-flask-section-icon {
  width: 18px; height: 18px; margin-right: 6px; color: #fff; flex: 0 0 18px;
}
.sidebar .legacy-flask-nav-with-icon { display: flex; align-items: center; gap: 6px; }
.sidebar .legacy-flask-nav-icon { width: 18px; height: 18px; color: #fff; flex: 0 0 18px; }

/* Sidebar expanded (open) */
.sidebar.sidebar-open {
  width: 300px;
  flex: 0 0 300px;
  overflow: hidden;
}

/* Sidebar logos */

.sidebar-logo-expanded { display: none; }
.sidebar-logo-collapsed { display: block; }

.sidebar.sidebar-open .sidebar-logo-expanded { display: block; }
.sidebar.sidebar-open .sidebar-logo-collapsed { display: none; }

/* Sidebar content bits */

.sidebar .sidebar-icon {
  width: 18px;
  height: 18px;
  margin-right: 6px;
}

.sidebar .sidebar-label { display: none; opacity: 0; transition: opacity 0.2s ease 0.1s; }
.sidebar .sidebar-links-nav { display: none; opacity: 0; transition: opacity 0.2s ease 0.1s; }

.sidebar.sidebar-open .sidebar-label { display: inline; opacity: 1; }
.sidebar.sidebar-open .sidebar-links-nav { display: block; opacity: 1; }

/* Toggle button */
.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 10px 0 6px 0;
  margin-left: -6px;
  cursor: pointer;
  width: 64px;
  flex-shrink: 0;
  min-height: 36px;
}

.sidebar-toggle-btn:hover {
  opacity: 0.7;
}

.sidebar.sidebar-open .sidebar-toggle-btn {
  justify-content: flex-end;
  width: 100%;
  padding: 10px 12px 6px;
}

/* ============================================
   NAV PILLS
============================================ */

.nav-pills .nav-link {
  background-color: transparent;
  color: #E0E0E0;
  border-radius: 8px;
  padding: 10px 16px;
  transition: all 0.2s ease-in-out;
}

.nav-pills .nav-link:hover {
  background-color: var(--nav-hover);
  color: #FFFFFF;
}

.nav-pills .nav-link.active {
  background-color: var(--nav-active-bg);
  color: #FFFFFF;
  font-weight: 200;
  box-shadow: inset 2px 2px 6px rgba(0, 0, 0, 0.3);
  border-left: 3px solid var(--accent);
}

/* ============================================
   RAIL MODE: no longer needed — handled by base .sidebar (64px)
   and .sidebar.sidebar-open (300px) at any screen size
============================================ */

@media (max-width: 600px) {
  .sidebar.sidebar-open {
    width: 100vw;
    flex: 0 0 100vw;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100%;
    z-index: 9999;
    transform: translateX(0);
    transition:
      transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
      width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar:not(.sidebar-open) {
    transform: translateX(0);
  }

  .tabs-stackable {
    flex-wrap: wrap;
  }
  .tabs-stackable .nav-item {
    flex: 1 1 100%;
  }
  .tabs-stackable .nav-link {
    width: 100%;
    text-align: center;
  }
}

/* ============================================
   HEADER LAYOUT
   - header-sidebar-slot → NO SHADOW, bottom border
   - #app-header → bottom border + bottom shadow
============================================ */

/* Slot above sidebar */

.header-sidebar-slot {
  width: 64px;
  background: var(--app-bg);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  box-shadow: none !important;
  border-bottom: var(--app-border);

  position: relative;
  transition: width 0.25s ease;
}

.header-sidebar-slot.header-sidebar-open {
  width: 300px;
}

/* Logos mirror sidebar behaviour */

.header-logo-expanded { height: 40px; }
.header-logo-collapsed { display: none; height: 32px; }

.header-sidebar-slot .header-logo-expanded { display: none; }
.header-sidebar-slot .header-logo-collapsed { display: block; }

.header-sidebar-slot.header-sidebar-open .header-logo-expanded { display: block; }
.header-sidebar-slot.header-sidebar-open .header-logo-collapsed { display: none; }

/* ── home-page-rail: marker class for home page sidebar ── */
/* Collapse/expand handled by .sidebar-collapsed class */

/* ============================================
   HEADER ABOVE CONTENT
============================================ */

#app-header {
  flex-grow: 1;
  display: flex;
  align-items: center;
  background-color: var(--app-bg);
  position: relative;

  z-index: 100;  /* header sits ABOVE sidebar */

  border-bottom: var(--app-border);
  box-shadow: var(--header-shadow);
}

/* ============================================
   TOOLBAR (hamburger etc.)
============================================ */

#header-toolbar { position: relative; }

.header-menu-toggle {
  position: absolute;
  opacity: 0;
}

.header-menu-icon {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.3);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.header-menu-icon span {
  font-size: 20px;
}

.header-menu-panel {
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: center;
}

@media (max-width: 900px) {
  .header-menu-icon { display: flex; }

  .header-menu-panel {
    display: none;
    position: absolute;
    top: 110%;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    min-width: 220px;

    background-color: var(--app-bg);
    border-radius: 12px;
    box-shadow: var(--header-shadow);
    z-index: 3000;
  }

  .header-menu-toggle:checked ~ .header-menu-panel {
    display: flex;
  }

  .header-menu-panel > div {
    width: 100%;
  }
}

/* assets/header.css (for example) */

/* Default: desktop toolbar visible, hamburger hidden */
.header-toolbar-desktop {
  display: flex;
}

.header-toolbar-mobile {
  display: none;
}

/* On smaller screens (e.g. < 992px), hide desktop and show hamburger */
@media (max-width: 991.98px) {
  .header-toolbar-desktop {
    display: none !important;
  }

  .header-toolbar-mobile {
    display: flex !important;
  }
}



