/* Bootstrap 5 layout (inc/layout/*), modelled on the ChurchPortal rebuild: dark sidebar and top
   bar, light content area, plain Bootstrap components. Loaded after bluehorizon.css, custom.css
   and site.css. */

:root {
  --v2-sidebar-width: 260px;
  --v2-sidebar-bg: #1f2429;
  --v2-sidebar-text: rgba(255, 255, 255, 0.78);
  --v2-sidebar-muted: rgba(255, 255, 255, 0.45);
  --v2-sidebar-hover: rgba(255, 255, 255, 0.08);
  --v2-sidebar-active: rgba(255, 255, 255, 0.14);
  --v2-topbar-bg: #2b3035;
  --v2-content-bg: #f4f5f7;
}

body.v2 {
  background: var(--v2-content-bg);
  min-height: 100vh;
}

/* bluehorizon.css removes focus outlines everywhere; keyboard users need them back */
.v2 :focus-visible {
  outline: 2px solid #86b7fe !important;
  outline-offset: 2px;
}

.v2-skip {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 1080;
  padding: 0.5rem 1rem;
  background: #fff;
}

.v2-shell {
  display: flex;
  min-height: 100vh;
}

.v2-main {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

/* ---------- Sidebar ---------- */

.v2-sidebar {
  --bs-offcanvas-width: var(--v2-sidebar-width);
  --bs-offcanvas-bg: var(--v2-sidebar-bg);
  --bs-offcanvas-color: var(--v2-sidebar-text);
  color: var(--v2-sidebar-text);
}

@media (min-width: 992px) {
  /* Paint the sidebar column the full height of long pages, behind the sticky sidebar */
  .v2-shell {
    background: linear-gradient(to right, var(--v2-sidebar-bg) var(--v2-sidebar-width), transparent 0);
  }

  .v2-sidebar.offcanvas-lg {
    position: sticky;
    top: 0;
    display: flex;
    flex: 0 0 var(--v2-sidebar-width);
    flex-direction: column;
    width: var(--v2-sidebar-width);
    height: 100vh;
    background-color: var(--v2-sidebar-bg) !important; /* Bootstrap clears it at this width */
  }
}

.v2-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.v2-brand-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #fff;
  font-weight: 600;
  line-height: 1.15;
  text-decoration: none;
}

.v2-brand-link:hover {
  color: #fff;
}

.v2-brand-link small {
  display: block;
  color: var(--v2-sidebar-muted);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.v2-nav {
  flex: 1 1 auto;
  padding: 1rem 0.75rem 2rem;
  overflow-y: auto;
}

.v2-greeting {
  margin: 0 0 0.75rem;
  padding: 0 0.75rem;
  color: #fff;
  font-weight: 600;
}

.v2-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.45rem 0.75rem;
  border-radius: 0.375rem;
  color: var(--v2-sidebar-text);
  font-size: 0.925rem;
  text-align: left;
}

.v2-sidebar .nav-link:hover,
.v2-sidebar .nav-link:focus-visible {
  background: var(--v2-sidebar-hover);
  color: #fff;
}

.v2-sidebar .nav-link.active {
  background: var(--v2-sidebar-active);
  color: #fff;
  font-weight: 600;
}

.v2-sidebar .nav-link .fa-fw {
  opacity: 0.85;
}

.v2-sidebar .nav-link.v2-child {
  padding-left: 2.35rem;
  font-size: 0.875rem;
}

.v2-group-toggle {
  border: 0;
  background: none;
}

.v2-chevron {
  margin-left: auto;
  font-size: 0.65rem;
  transition: transform 0.2s;
}

.v2-group-toggle.collapsed .v2-chevron {
  transform: rotate(-90deg);
}

.v2-heading {
  padding: 1.1rem 0.75rem 0.35rem;
  color: var(--v2-sidebar-muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  list-style: none;
  text-transform: uppercase;
}

.v2-divider {
  margin: 0.6rem 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  list-style: none;
}

/* ---------- Top bar ---------- */

/* Its own layer above sticky page headers (Bootstrap's sticky-top is 1020), so its dropdowns
   open over them; below the mobile menu (1040+) and modals */
.v2-topbar {
  position: relative;
  z-index: 1030;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 56px;
  padding: 0.6rem 1.25rem;
  background: var(--v2-topbar-bg);
  color: #fff;
}

.v2-topbar-title {
  overflow: hidden;
  font-size: 1.05rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v2-readings {
  min-width: 16rem;
}

.v2-viewas {
  min-width: 20rem;
  max-height: 70vh;
  overflow-y: auto;
}

.v2-viewas-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.v2-viewas-grid .dropdown-item {
  overflow: hidden;
  font-size: 0.875rem;
  text-overflow: ellipsis;
}

/* ---------- Content ---------- */

.v2-content {
  flex: 1 1 auto;
  padding: 1.5rem;
}

@media (max-width: 575.98px) {
  .v2-content {
    padding: 1rem 0.75rem;
  }
}

.v2 .card {
  margin-bottom: 1rem;
  border: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.08);
}

.v2 .card-header {
  border-bottom-color: rgba(0, 0, 0, 0.06);
  font-weight: 600;
}

.v2-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--bs-border-color);
  background: #fff;
  color: var(--bs-secondary-color);
  font-size: 0.8rem;
}

.v2-footer a {
  color: inherit;
}
