/* ==========================================================================
   Ledgerline dashboard shell — STRUCTURE ONLY
   Adapts the Bootstrap 5.3 "Dashboard" example layout (top navbar + fixed
   sidebar) on top of the existing Ledgerline visual language.

   This file holds layout/sizing only. Colors come from whichever theme
   stylesheet is paired with it (dashboard-dark.css or dashboard-light.css),
   via the --ll-chrome-* custom properties defined there.
   ========================================================================== */

:root {
  --ll-navbar-h: 52px;
  --ll-ticker-h: 33px;
  --ll-sidebar-w: 200px;
}

/* ---- top navbar ---- */
.ll-navbar {
  top: var(--ll-ticker-h);
  z-index: 1030;
  min-height: var(--ll-navbar-h);
  background: var(--ll-chrome-bg);
  border-bottom: 1px solid var(--ll-chrome-border);
}

.ll-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--ll-chrome-brand) !important;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}
.ll-brand .logo-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ll-chrome-brand); }

@media (min-width: 768px) {
  .ll-brand { width: var(--ll-sidebar-w); flex: 0 0 var(--ll-sidebar-w); }
}

.ll-navbar .navbar-toggler {
  top: 0.35rem;
  right: 1rem;
  border-color: var(--ll-chrome-toggler-border);
}
.ll-navbar .navbar-toggler:focus { box-shadow: 0 0 0 3px var(--ll-chrome-focus); }
.ll-navbar .navbar-toggler-icon { background-image: var(--ll-chrome-toggler-icon); }

.ll-theme-toggle {
  background: transparent;
  border: 1px solid var(--ll-chrome-toggler-border);
  color: var(--ll-chrome-muted);
  border-radius: 999px;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.ll-theme-toggle:hover { color: var(--ll-chrome-text-strong); background: var(--ll-chrome-hover-bg); }

.ll-notif-wrap { position: relative; }
.ll-notif-bell {
  background: transparent;
  border: 1px solid var(--ll-chrome-toggler-border);
  color: var(--ll-chrome-muted);
  border-radius: 999px;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
  cursor: pointer;
  position: relative;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.ll-notif-bell:hover { color: var(--ll-chrome-text-strong); background: var(--ll-chrome-hover-bg); }
.ll-notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 999px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.ll-notif-dropdown {
  display: none;
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 340px; max-height: 420px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0,0,0,0.25);
  z-index: 1050; overflow: hidden;
  flex-direction: column;
}
.ll-notif-dropdown.open { display: flex; }
.ll-notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 590; color: var(--text);
}
.ll-notif-mark-all { background: none; border: none; color: var(--accent); font-size: 12px; cursor: pointer; padding: 0; }
.ll-notif-mark-all:hover { text-decoration: underline; }
.ll-notif-list { overflow-y: auto; max-height: 360px; }
.ll-notif-empty { padding: 24px 16px; text-align: center; font-size: 13px; color: var(--muted); }
.ll-notif-item {
  display: block; padding: 12px 14px; text-decoration: none;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background 0.15s;
}
.ll-notif-item:last-child { border-bottom: none; }
.ll-notif-item:hover { background: var(--hover-tint); }
.ll-notif-item.unread { background: rgba(0,113,227,0.05); }
.ll-notif-item-top { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.ll-notif-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.ll-notif-dot.danger { background: var(--red); }
.ll-notif-dot.warning { background: var(--warn); }
.ll-notif-title { font-size: 13px; font-weight: 590; color: var(--text); }
.ll-notif-message { font-size: 12px; color: var(--muted); line-height: 1.4; margin-left: 12px; }
.ll-notif-date { font-size: 11px; color: var(--muted); margin-left: 12px; margin-top: 2px; display: block; }

.ll-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  font-family: var(--font-display);
  flex-shrink: 0;
}

/* ---- sidebar ---- */
.ll-sidebar {
  position: fixed;
  top: calc(var(--ll-ticker-h) + var(--ll-navbar-h));
  bottom: 0;
  left: 0;
  z-index: 100;
  padding: 0;
  background: var(--ll-chrome-bg);
  border-right: 1px solid var(--ll-chrome-border);
}

@media (min-width: 768px) {
  /* Explicit fixed width instead of relying on Bootstrap's col-md-3/col-lg-2
     percentage classes — predictable regardless of viewport size, and no
     longer dependent on the Bootstrap CDN's CSS having actually loaded. */
  .ll-sidebar { width: var(--ll-sidebar-w); }
}

@media (max-width: 767.98px) {
  .ll-sidebar {
    top: calc(var(--ll-ticker-h) + var(--ll-navbar-h));
    width: 260px;
    box-shadow: 4px 0 24px var(--ll-chrome-shadow);
  }
  /* Own reliable fallback for the collapse behavior: don't depend entirely
     on the Bootstrap CDN's CSS having loaded successfully (slow connection,
     ad blocker, corporate proxy) to hide the sidebar on narrow screens. */
  #sidebarMenu.ll-sidebar:not(.show) { display: none; }
  #sidebarMenu.ll-sidebar.show {
    display: block;
    width: 100%;
    max-width: 300px;
  }
}

.ll-sidebar .sidebar-sticky {
  position: relative;
  height: calc(100vh - var(--ll-ticker-h) - var(--ll-navbar-h));
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 1.5rem;
}

.ll-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-text);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ll-chrome-muted);
  padding: 8px 18px;
  border-radius: 0;
  transition: color 0.15s, background 0.15s;
}
.ll-sidebar .nav-link i { font-size: 15px; width: 16px; text-align: center; color: inherit; }

.ll-sidebar .nav-link.ll-subitem { padding-left: 20px; font-weight: 400; font-size: 13px; }

.ll-sidebar .nav-link:hover { color: var(--ll-chrome-text-strong); background: var(--ll-chrome-hover-bg); }

.ll-sidebar .nav-link.active {
  color: var(--ll-chrome-active-text);
  background: var(--ll-chrome-active-bg);
}
.ll-sidebar .nav-link.active i { color: var(--ll-chrome-active-text); }

.ll-signout-link {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.ll-sidebar-heading {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ll-chrome-heading);
}
.ll-sidebar-heading.px-3, .ll-sidebar-user.px-3 { padding-left: 16px !important; padding-right: 16px !important; }

.ll-sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.ll-sidebar-username {
  font-family: var(--font-text);
  font-size: 13px;
  font-weight: 600;
  color: var(--ll-chrome-text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- main content column ---- */
/* Horizontal position/width is handled by Bootstrap's own grid classes
   (col-md-9 ms-sm-auto col-lg-10) on the <main> element in _base.html —
   the fixed sidebar is intentionally taken out of flow, and ms-sm-auto
   pushes main flush against it. Only vertical spacing is customized here. */
.ll-main {
  padding: 0 0 3rem;
  min-height: calc(100vh - var(--ll-ticker-h) - var(--ll-navbar-h));
}

@media (min-width: 768px) {
  /* Matches the sidebar's explicit width above instead of Bootstrap's
     ms-sm-auto grid offset, so the two always line up exactly. */
  .ll-main { margin-left: var(--ll-sidebar-w); width: calc(100% - var(--ll-sidebar-w)); flex: 0 0 calc(100% - var(--ll-sidebar-w)); max-width: calc(100% - var(--ll-sidebar-w)); }
}

/* ---- standalone auth pages (login/register): navbar, no sidebar ---- */
.ll-auth-navbar {
  display: flex;
  align-items: center;
  top: 0;
  position: sticky;
  justify-content: space-between;
  height: var(--ll-navbar-h);
}
.ll-auth-navlink {
  color: var(--ll-chrome-muted);
  font-size: 13px;
  font-weight: 500;
  transition: color 0.15s;
}
.ll-auth-navlink:hover { color: var(--ll-chrome-text-strong); }

/* Content inside <main> is centered within the available width (sidebar
   excluded) with a comfortable max-width, instead of stretching edge-to-edge
   or hugging the left side — matching modern dashboard patterns where the
   content column itself is centered, while text within it stays left-aligned. */
.ll-main .footnote { padding-left: 1.5rem; text-align: center; }

.ll-main > .hero {
  text-align: left;
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.25rem 2rem 1.5rem;
}
.ll-main > .hero h1 { font-size: 34px; }
.ll-main > .hero.compact { padding: 1.75rem 2rem 1rem; }
.ll-main > .hero.compact h1 { font-size: 26px; margin-bottom: 6px; }
.ll-main > .hero p.lede { margin: 0; max-width: 520px; }

.ll-main > .totals-grid,
.ll-main > .stats-wrap,
.ll-main > .modules {
  max-width: 820px;
  margin: 0 auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

.ll-main > .two-pane {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 2rem 0;
}

.ll-main > .log-wrap { max-width: none; margin: 0; padding: 2rem; }

.ll-main > .two-col {
  max-width: 1280px;
  margin: 0 auto 1.5rem;
  padding-left: 2rem;
  padding-right: 2rem;
}

.ll-main > .mission-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 0.5rem 2rem 3rem;
}

.ll-main > .breach-banner {
  max-width: 820px;
  margin: 0 auto 1.5rem;
  padding-left: 2rem;
  padding-right: 2rem;
}

.ll-main > .exposure-widget {
  max-width: 820px;
  margin: 0 auto 1.5rem;
  padding-left: 2rem;
  padding-right: 2rem;
}

/* ---- forms (Trade Size Calculator, Add Asset, Edit Profile) ---- */
.ll-main > .page-wrap {
  display: flex;
  justify-content: center;
  padding: 2.25rem 2rem 4rem;
}
.ll-main > .page-wrap > .page {
  width: 100%;
  max-width: 640px;
  margin: 0;
}
.ll-main > .page-wrap > .page.page-wide {
  max-width: 1040px;
}
