/* Make the whole page fill the viewport */
html,
body {
  height: 100%;
}

/* Layout / base */
body {
  background: #ffffff;
  color: #333;
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;

  display: flex;
  flex-direction: column;   /* topbar -> main -> footer */
}

/* Top bar fixed height */
.topbar {
  flex: 0 0 3rem;
  height: 3rem;
  border-bottom: 1px solid #dee2e6;
  background: #f8f9fa;
}

.topbar-logo-circle {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #0d6efd;
}

/* Main wrapper takes remaining height between topbar & footer */
.page-wrapper {
  flex: 1 1 auto;
  padding: 0;
}

/* Ensure the bootstrap row fills available height */
.page-wrapper .row {
  height: 100%;
}

/* Sidebar and content share that height */
.sidebar {
  height: 100%;
  border-right: 1px solid #ddd;
  overflow-y: auto;   /* scroll only if sidebar itself gets too tall */
}

.content-area {
  height: 100%;
  background: #ffffff;
  display: flex;
  flex-direction: column;
}

/* Sidebar nav */
.side-title {
  font-size: 1.05rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.sidebar .nav-link {
  border-radius: 0.4rem;
  margin-bottom: 0.3rem;
  color: #495057;
  padding: 0.45rem 0.75rem;
  display: flex;
  align-items: center;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    padding-left 0.2s ease,
    box-shadow 0.2s ease;
}

.sidebar .nav-link:hover {
  background-color: #e9ecef;
  color: #212529;
  padding-left: 1.1rem;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.02);
}

.sidebar .nav-link.active {
  background-color: #ffffff;
  color: #0d6efd;
  font-weight: 600;
  border-left: 3px solid #0d6efd;
  padding-left: 1.15rem;
}

/* iframe fills the content area with no scroll */
.display-frame {
  flex: 1 1 auto;
  width: 100%;
  border: none;
  background: #ffffff;
}

/* Footer sits at the bottom, always visible, no scroll needed */
.footer {
  flex: 0 0 auto;
  padding: 0.75rem;
  text-align: center;
  font-size: 0.85rem;
  color: #999;
  border-top: 1px solid #eee;
}

/* Subpages (inside iframe) */
.subpage-body {
  padding: 1rem 1.5rem;
  margin: 0;
  overflow: hidden;  /* prevents inner scrollbars */
}

.page-title {
  font-size: 1.4rem;
  font-weight: 600;
}

.subtitle {
  color: #666;
}

.placeholder {
  padding: 2rem;
  text-align: center;
  background: #f7f7f7;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* Breadcrumb smaller */
.breadcrumb-sm {
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
}

/* Responsive tweaks */
@media (max-width: 767.98px) {
  .sidebar {
    min-height: auto;
  }

  .display-frame {
    min-height: 70vh;
  }
}

.auto-fit-img {
  width: 100%;
  height: auto;
  max-height: calc(100vh - 12rem); /* fits within visible area */
  object-fit: contain; /* never crops */
  display: block;
  margin: 0 auto;
}

