/* Page layout */
.page-layout {
  display: flex;
  /* min-height: 92vh;
  max-height: 92vh; */
  gap: 0.5em;
  margin: 0 auto;
  padding: 0.5em;
  border-radius: 10px;
  background-color: #f5f6fa;
  font-family: Arial, sans-serif;
}

#app {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

/* Fixed aside with steps */
.step-bar {
  width: 18em;
  flex-shrink: 0;
  background: #f8f9fa;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.progress-header {
  padding-bottom: 15px;
  margin-bottom: 15px;
  border-bottom: 1px solid #dee2e6;
}

.progress-header h4 {
  margin: 0;
  color: var(--main-color);
  font-weight: 600;
}

.step-bar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.step-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e9ecef;
  transition: all 0.3s ease;
}

.step-item:last-child {
  border-bottom: none;
}

.step-item.active {
  background: var(--main-color-accent-dark);
  margin: 0 -15px;
  padding: 12px 15px;
  border-radius: 8px;
}

.step-item.active .step-info .step-title {
  color: white;
}

.step-item.completed .step-number {
  background: var(--main-color-accent-darkest);
  color: white;
}

.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--main-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-weight: bold;
  font-size: 14px;
  flex-shrink: 0;
}

.step-info {
  display: flex;
  flex-direction: column;
}

.step-title {
  font-weight: 600;
  color: var(--main-color);
  font-size: 18px;
  margin-bottom: 2px;
}

.step-description {
  font-size: 12px;
  color: #6c757d;
  line-height: 1.3;
}

/* Main content area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 10px;
  padding: 0.5em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.menu-text {
  font-size: 18px;
}

/* .content-header {
  margin-bottom: 25px;
} */

.list-group-item {
  margin-bottom: 30px;
  border-radius: 6px;
}

.content-header h3,
h2 {
  color: var(--main-color);
  margin: 0 0 8px 0;
  font-weight: 600;
  font-size: 1.5rem;
}

.content-header p {
  color: #6c757d;
  margin: 0;
  font-size: 14px;
}

.form-container {
  flex: 1;
}

/* Loading state */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: #6c757d;
}

.loading-state .spinner-border {
  margin-bottom: 15px;
}

/* Navigation buttons */
.navigation-buttons {
  display: flex;
  justify-content: space-between;
  padding-top: 20px;
  border-top: 1px solid #e9ecef;
}

.navigation-buttons .btn {
  min-width: 120px;
}

/* Responsive design */
@media (max-width: 768px) {
  .page-layout {
    flex-direction: column-reverse;
    gap: 20px;
  }

  .step-bar {
    width: 100%;
    order: 2;
  }

  .main-content {
    order: 1;
  }

  .step-item {
    padding: 10px 0;
  }

  .big-btn-text {
    text-transform: uppercase;
  }

}

/* === Collapsible Step Bar Extension === */

/* Smooth transition for sidebar width and padding */
.step-bar {
  transition: width 0.3s ease, min-width 0.3s ease, padding 0.3s ease;
  overflow: hidden;
  position: relative;
}

/* Collapsed state */
.step-bar.collapsed {
  width: 4em;
  min-width: 4em;
}

/* Hide step info smoothly */
.step-bar.collapsed .step-info {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* Step items centered when collapsed */
.step-bar.collapsed .step-item {
  justify-content: center;
}

/* Step numbers only, tooltip enabled */
.step-bar.collapsed .step-number {
  margin-right: 0;
}

/* Hide text in collapsed state */
.step-bar.collapsed .step-title,
.step-bar.collapsed .step-description,
.step-bar.collapsed .progress-header h4 {
  display: none;
}

/* Header layout with chevron */
.progress-header {
  display: flex;
  align-items: center;
  padding-bottom: 15px;
  margin-bottom: 15px;
  border-bottom: 1px solid #dee2e6;
}

/* Chevron container setup */
.chevron_container {
  --color: #a5a5b0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  user-select: none;
  fill: var(--main-color-accent);
  margin-left: 1em;
}

/* Chevron appearance and animation */
.chevron_container svg {
  transition: transform 0.3s ease;
}

/* Keep chevron visible even if header text is hidden */
.step-bar.collapsed .chevron_container {
  margin: 0.5em auto;
  justify-content: center;
  display: flex;
}

/* --- Privacy link anchored at bottom of the sidebar --- */
.step-bar {
  position: relative; /* makes bottom anchoring possible */
  padding-bottom: 60px; /* leave room for the link */
}

.privacy-link {
  position: absolute;
  bottom: 12px;
  left: 20px;
  right: 20px;
  text-align: center;
  z-index: 22;
}

/* anchor base */
.privacy-link-anchor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  color: var(--main-color);
  font-size: 0.9rem;
  background: #f8f9fa;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.privacy-link-anchor:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--main-color-accent-darkest);
}

/* icon setup */
.privacy-icon {
  width: 18px;
  height: 18px;
  fill: var(--main-color-accent);
}

/* --- Collapsed mode behavior --- */
.step-bar.collapsed .privacy-text {
  display: none;
}

.step-bar.collapsed .privacy-icon {
  width: 22px;
  height: 22px;
}

.step-bar.collapsed .privacy-link {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

.step-bar.collapsed .privacy-link-anchor {
  padding: 8px;
  border-radius: 10px;
  background: transparent;
}

/* Tooltip when collapsed */
.step-bar.collapsed .privacy-link-anchor:hover::after {
  content: "Политика за поверителност";
  position: absolute;
  bottom: 80%;
  left: 230%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 0.75rem;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  animation: tooltipFadeIn 0.2s forwards;
  z-index: 23;
}

/* Tooltip triangle */
.step-bar.collapsed .privacy-link-anchor:hover::before {
  content: "";
  position: absolute;
  bottom: 50%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.85) transparent transparent transparent;
  opacity: 0;
  animation: tooltipFadeIn 0.2s forwards;
}

/* =============================== */
/* REQUEST PAGE NAVBAR = SIDEBAR   */
/* =============================== */

body[data-page="request"] .navbar-cstm {
  position: absolute;
  top: 0;
  left: 0;
  height: 4.2em;
  background-color: var(--main-color);
  transition: width 0.3s ease, left 0.3s ease;
  z-index: 120;
}


/* --- When sidebar is collapsed --- */
body[data-page="request"] .step-bar.collapsed ~ .navbar-cstm,
body[data-page="request"].sidebar-collapsed .navbar-cstm {
  width: 4em; /* same as collapsed sidebar */
}

/* --- Navbar content alignment --- */
body[data-page="request"] .navbar-cstm .container {
  justify-content: center;
}

body[data-page="request"] .navbar-cstm .navbar-brand {
  flex-direction: column;
  text-align: center;
}

body[data-page="request"] .navbar-cstm img {
  margin: 0 auto;
}

/* --- Main layout adjustment --- */


/* --- Make sure main content fills remaining width --- */
body[data-page="request"] .main-content {
  justify-content: space-between;
}

/* =============================== */
/* NAVBAR CONTENT COLLAPSE BEHAVIOR */
/* =============================== */

body[data-page="request"] .navbar-cstm .navbar-brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  /* gap: 0.5em; */
}

body[data-page="request"] .navbar-cstm .slogan-text {
  display: inline-block;
  font-size: 1rem;
  color: white;
  transition: opacity 0.3s ease, transform 0.3s ease;
  margin: 0;
  padding: 0;
}

/* Collapsed sidebar → logo only, centered */
body[data-page="request"].sidebar-collapsed .navbar-cstm .navbar-brand {
  justify-content: center;
}

/* body[data-page="request"].sidebar-collapsed .navbar-cstm .navbar-brand img {
  width: 70px;
  transform: scale(1.05);
} */

body[data-page="request"].sidebar-collapsed .navbar-cstm .slogan-text {
  opacity: 0;
  transform: translateX(-10px);
  pointer-events: none;
  visibility: hidden;
}

body[data-page="request"] #logo {
  width: 80px;
  height: auto;
  transition: width 0.3s ease, transform 0.3s ease;
}

/* When sidebar is collapsed */
body[data-page="request"].sidebar-collapsed .navbar-cstm .navbar-brand {
  justify-content: center;
  align-items: center;
  height: 100%;
  width: 100%;
}

body[data-page="request"].sidebar-collapsed #logo {
  display: block;
  margin: 0 auto;
  width: 60px; /* adjust between 55–65px depending on preference */
  height: auto;
  transform: none;
}
body[data-page="request"].sidebar-collapsed #logo {
  transform: translatey(21px) translateX(-35px)
}


/* ===================================================== */
/* MAKE MAIN-CONTENT ALIGN WITH TOP OF NAVBAR (BLUE BAR)  */
/* ===================================================== */

body[data-page="request"] .step-bar {
  position: relative;
  margin-top: 4.2em; /* push below the blue navbar */
  flex-shrink: 0;
  height: calc(100vh - 5.2em);
}

/* ============================================ */
/* MAIN CONTENT FLEX LAYOUT (HEADER–BODY–FOOTER) */
/* ============================================ */

body[data-page="request"] .main-content {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 1.0em);
  border-radius: 10px;
  overflow: hidden; /* ensures no scroll overlap */
}

/* --- Header (10%) --- */
body[data-page="request"] .main-content .content-header {
  padding: 0 1em;
  min-height: 30px; /* fallback if screen is small */
}

/* --- Step container (80%) --- */
body[data-page="request"] .main-content #step-container {
  flex: 1 1 80%;
  overflow-y: auto;
  /* padding: 0.5em 0.8em; */
}

/* --- Navigation buttons (10%) --- */
body[data-page="request"] .main-content .navigation-buttons {
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #e9ecef;
  min-height: 30px; /* fallback height */
}

/* Optional smooth spacing and consistency */
body[data-page="request"] .main-content > * {
  box-sizing: border-box;
}

/* --- Make spinner/overflow areas adapt too --- */
body[data-page="request"] #form-content {
  height: 100%;
  overflow-y: auto;
}


/* ====================================================== */
/* STEP CONTAINER + ACCORDION HEIGHT OPTIMIZATION          */
/* ====================================================== */

/* Let #step-container take all the middle 80% height you set earlier */
body[data-page="request"] #step-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Let #form-content stretch full height */
body[data-page="request"] #form-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Accordion should fill available space */
body[data-page="request"] #form-content .accordion {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Inner accordion items: allow scrolling of tables inside */
body[data-page="request"] #form-content .accordion-item {
  flex-shrink: 0;
}

/* Collapsible area inside accordion: scrollable tables */
body[data-page="request"] #form-content .accordion-collapse {
  max-height: 100%;
  overflow-y: auto;
}
body[data-page="request"] #form-content .accordion-collapse {
  overflow-y: visible !important;
  max-height: none !important;
}

/* Table container inside accordion: expand nicely */
body[data-page="request"] #form-content .table-container {
  overflow-y: auto;
  max-height: 50vh;
}

/* ====================================================== */
/* GRAND TOTAL FIXED AT BOTTOM OF THE FORM-CONTAINER       */
/* ====================================================== */

/* Make the entire form-content area split vertically: accordion + footer */
body[data-page="request"] #form-content {
  display: flex;
  flex-direction: column;
}

/* Push accordion to fill available space above the footer */
body[data-page="request"] #form-content .accordion {
  flex: 1 1 auto;
  overflow-y: auto;
}

/* Fix the totals row to bottom inside the visible area */
body[data-page="request"] #all-grand-total {
  flex-shrink: 0;
  margin-top: auto;
  background: #f8f9fa;
  border-top: 1px solid #dee2e6;
  padding: 0.4em 0.5em 0 0.5em;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1em;
  z-index: 50;
  position: sticky;
  bottom: 0;
}

/* Slight shadow to separate totals visually */
body[data-page="request"] #all-grand-total {
  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
}
