/* Reset & Base Styles - Removed global resets to avoid breaking theme */
.terms-and-conditions-wrapper {
  -webkit-font-smoothing: antialiased;
}

/* Hide scrollbar for sidebar */
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Layout Wrappers */
.terms-and-conditions-wrapper {
  padding: 4rem 2rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  word-wrap: break-word;
  overflow-wrap: break-word;
  /* Removed overflow: hidden to ensure sticky works correctly */
}

.flex-center {
  display: flex;
  justify-content: center;
  width: 100%;
}

.container {
  max-width: 1200px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.layout {
  width: 100%;
  display: flex;
  flex-direction: row;
  /* Always side-by-side */
  gap: 4rem;
  align-items: flex-start;
  overflow: visible !important;
  /* Critical for sticky to work */
}

/* Sidebar Styles */
/* Force parents to have visible overflow so sticky works */
.elementor-widget-terms_conditions_widget,
.elementor-widget-terms_conditions_widget .elementor-widget-container {
  overflow: visible !important;
}

.sidebar {
  width: max-content;
  /* Exact width of text */
  flex-shrink: 0;
  overflow-y: auto;
  position: sticky;
  top: 80px;
  /* Increased top offset to avoid overlapping headers */
  z-index: 10;
  /* Lower z-index to stay below fixed layout elements like headers */
  max-height: calc(100vh - 100px);
  height: fit-content;
  padding-right: 1rem;
}

/* Admin bar offset - standard WP admin bar is 32px */
.admin-bar .sidebar {
  top: 112px;
  /* 32px admin bar + 80px gap */
}

.section-num {
  font-variant-numeric: tabular-nums;
  display: inline-block;
}

.sidebar aside {
  padding: 0.5rem 0;
}

.sidebar h3 {
  font-weight: 500;
  font-size: 15px;
  margin-bottom: 10px;
  letter-spacing: -0.025em;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  border-left: 2px solid #E5E7EB;
  margin-left: 0.25rem;
}

/* Sidebar Navigation Links */
.nav-link {
  text-align: left;
  font-size: 15px;
  line-height: 1.4;
  transition: color 0.2s, border-color 0.2s;
  border-left: 2px solid transparent;
  margin-left: -2px;
  padding-left: 1rem;
  font-weight: 500;
  color: #6B7280;
  margin: 10px 0px;
  white-space: nowrap;
  /* Prevent text from wrapping */
  touch-action: manipulation;
  /* Better touch handling */
  -webkit-tap-highlight-color: transparent;
  /* Remove default mobile tap highlight */
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  display: block;
}

.nav-link:first-child {
  margin-top: 0;
}

.nav-link.active {
  border-left-width: 2px;
  border-left-color: #000000;
  color: #000000;
}

.nav-link:hover {
  border-left-width: 2px;
  border-left-color: #000000;
}

.nav-link:not(.active):hover,
.nav-link:not(.active):active,
.nav-link:not(.active):focus {
  color: #000000;
  border-color: #000000;
}

/* Main Content Styles */
.main-content {
  flex: 1;
  max-width: 100%; /* Allow it to shrink below 720px */
  min-width: 0; /* Important for flex items */
  overflow-wrap: break-word;
}

.content-section {
  margin-top: 4rem;
}

.content-section:first-child {
  margin-top: 0;
}

.content-section h2 {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 20px;
  line-height: 1.15;
}

.content-section p {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 0px;
  color: #2D2D2D;
}

.content-section strong {
  font-weight: 700;
  color: #000000;
}

.content-section a {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: color 0.2s;
  display: inline;
}

.content-section a:hover {
  color: #6B7280;
}


/* Tablet Styles */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .terms-and-conditions-wrapper {
    min-width: auto;
    padding: 3rem 2rem;
  }

  .layout.stack-on-tablet {
    flex-direction: column;
    gap: 2rem;
  }

  .layout.stack-on-tablet .sidebar {
    width: 100%;
    max-height: none;
    position: relative;
    top: 0 !important;
    margin-bottom: 2rem;
    padding-right: 0;
  }

  /* Prevent sidebar from taking too much space when not stacked */
  .layout:not(.stack-on-tablet) .sidebar {
    max-width: 30%;
    width: auto;
  }

  .layout:not(.stack-on-tablet) .main-content {
    flex: 1;
    min-width: 0;
  }
}

/* Mobile Styles */
@media screen and (max-width: 768px) {
  .terms-and-conditions-wrapper {
    min-width: auto;
    padding: 2rem 1rem;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    bottom: auto;
    left: auto;
    z-index: 100;
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 1rem;
    overflow: hidden;
    margin-bottom: 2rem;
  }

  .sidebar h3 {
    margin-bottom: 0;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
  }

  .sidebar h3::after {
    content: "";
    width: 12px;
    height: 12px;
    background-image: url("../icons/chevron-down-black.svg");
    background-size: contain;
    background-repeat: no-repeat;
    transition: transform 0.3s ease;
    display: inline-block;
  }

  .sidebar.is-expanded h3::after {
    transform: rotate(180deg);
  }

  .sidebar.is-expanded {
    height: 36vh;
    display: flex;
    flex-direction: column;
  }

  .sidebar aside {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
  }

  .sidebar nav {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, margin-top 0.3s ease;
    border-left: none;
    margin-left: 0;
    margin-top: 0;
  }

  .sidebar.is-expanded nav {
    max-height: none;
    overflow-y: auto;
    flex: 1;
    margin-top: 1rem;
    border-left: 2px solid #E5E7EB;
    margin-left: 0.25rem;
    padding-right: 8px;
  }

  #main-content-824485d {
    position: relative;
    z-index: 1;
    padding-bottom: 0;
  }

  .layout {
    flex-direction: column;
  }
}