/* -----------------------------------------------------------
   LAYOUT
----------------------------------------------------------- */
.richtlijnen-wrapper {
  display: flex;
  gap: 20px;
}

.richtlijnen-left {
  flex: 0 0 20%;
  padding: 20px;
}

.richtlijnen-right {
  flex: 1;
}

/* Mobile filter toggle button (hidden on desktop) */
.mobile-filters-toggle {
  display: none;
  margin-bottom: 12px;
  background: rgba(var(--main-color));
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  box-sizing: border-box;
  width: 100%;
  text-align: left;
  gap: 10px;
}

.mobile-filters-toggle .mf-label {
  flex: 1 1 auto;
}

.mobile-filters-toggle .mf-indicator {
  margin-left: 8px;
  opacity: 0.95;
}


/* Mobile: stack filters above content and make them collapsible */
@media (max-width: 768px) {
  .richtlijnen-wrapper {
    flex-direction: column;
    gap: 12px;
  }

  .mobile-filters-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Make the toggle sticky and prominent so it doesn't get overlapped */
  .mobile-filters-toggle {
    position: sticky;
    top: 12px;
    z-index: 1200;
    box-shadow: 0 6px 18px rgba(16,24,40,0.06);
    background: rgba(var(--main-color));
    color: #fff;
    justify-content: space-between;
    padding: 12px 14px;
  }

  /* Show filters above content by default order, but keep them collapsed */
  .richtlijnen-left {
    order: -1;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 280ms ease, padding 200ms ease;
    padding: 0 20px;
    border-radius: 8px;
  }

  .richtlijnen-left.open {
    max-height: 1200px; /* large enough to contain filters */
    padding: 12px 20px;
    background: #fff;
    border: 1px solid rgba(var(--main-color));
    margin-top: 8px;
  }

  .richtlijnen-right {
    order: 0;
  }

  /* Make regel layout single-column on narrow screens */
  .regel-short-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .omschrijving-richtlijn-short {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: 1 1 auto;
  }

  .afbeeldingen-inline {
    max-width: 100%;
  }
}


/* -----------------------------------------------------------
   TABS
----------------------------------------------------------- */
.sweco-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #ddd;
  margin: -28px 0 15px;
  padding-bottom: 4px;
  overflow-x: auto;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  padding-top: 56px;
  background-color: #fff;
}

/* Mobile: make category tabs a single horizontal scroll row */
@media (max-width: 768px) {
  .sweco-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    gap: 8px;
    padding-left: 12px;
    padding-right: 44px; /* space for right control */
    position: relative; /* allow absolute-positioned scroll btn inside */
  }

  .sweco-tab {
    flex: 0 0 auto;
    scroll-snap-align: start;
    white-space: nowrap;
    min-width: 96px;
  }

  /* gradient edge to hint at overflow */
  .sweco-tabs::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 0;
    bottom: 0;
    width: 36px;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 60%);
  }

  /* small round scroll controls */
  .tabs-scroll-btn {
    display: inline-flex;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1300;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 18px;
    background: rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.08);
    color: rgba(var(--main-color));
    cursor: pointer;
  }

  .tabs-scroll-btn[hidden] { display: none; }
}

.sweco-tab {
  appearance: none;
  border: 1px solid rgba(var(--main-color));
  border-bottom: none;
  background: #f0f2f5;
  padding: 10px 16px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}

.sweco-tab:hover {
  background: #eee;
}

.sweco-tab.active {
  background: rgba(var(--main-color));
  border-color: rgba(var(--main-color));
  color: #fff;
}


.sweco-tab:focus-visible {
  background: rgba(var(--tegels2-color));
  color: white;
}


.sweco-tab-content {
  display: none;
  border: 1px solid rgba(var(--main-color));
  background: #fff;
  padding: 10px;
  border-radius: 0 6px 6px 6px;
}

.sweco-tab-content.active {
  display: block;
}


/* -----------------------------------------------------------
   TREE & CATEGORIES
----------------------------------------------------------- */
.sweco-tree {
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.tree-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}

.tree-toggle-all {
  appearance: none;
  border: 1px solid rgba(var(--main-color));
  background: rgba(var(--main-color));
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background .15s, transform .15s, color .15s, box-shadow .15s;
}

.tree-toggle-all:focus-visible,
.tree-toggle-secondary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--main-color), 0.35);
}

.tree-toggle-secondary {
  background: transparent;
  color: rgba(var(--main-color));
  border-color: rgba(var(--main-color));
}

.tree-toggle-secondary:hover,
.tree-toggle-secondary:focus-visible {
  background: rgba(var(--main-color), 0.08);
}

.tree-toggle-all:hover {
  background: rgba(var(--tegels2-color));
  color: #fff
}

.omschrijving-label,
.regel-description-label {
  display: none;
}

.caret {
  display: inline-block;
  font-weight: 600;
  margin: 6px 0;
  color: rgba(var(--main-color));
  width: 100%;
  background: none;
  text-align: left;
}

.caret::before {
  content: "▶ ";
  display: inline-block;
  width: 16px;
}

.caret[aria-expanded="true"]::before {
  content: "▼ ";
}

.regel-title::before {
  content: "+ ";
  display: inline-block;
  width: 16px;
}

.regel-title[aria-expanded="true"]::before {
  content: "- ";
}

.caret:hover {
  color: rgba(var(--tegels2-color));
  background: none;
}

.nested {
  margin-left: 18px;
  padding-left: 8px;
  list-style-type: none;
}

.nested[hidden] {
  display: none;
}

.omschrijving-richtlijn-short {
  margin: 0;
}


/* -----------------------------------------------------------
   REGELS
----------------------------------------------------------- */
.regel-item {
  margin: 6px 0;
  border: 1px solid rgba(var(--main-color));
  padding-left: 10px;
  padding-bottom: 10px;
  background-color: #f0f2f5;
}

.regel-short-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-left: 22px;
}

.omschrijving-richtlijn-short {
  flex: 1 1 auto;
  min-width: 0;
}

.omschrijving-richtlijn-short li {
  list-style-type: disc;
}

.regel-description {
  margin-top: 8px;
  margin-left: 22px;
  /* padding: 14px; */
  background: #f0f2f5;
  /* border: 1px solid #e1e4e8; */
  border-radius: 10px;
}

.regel-description-label {
  margin-bottom: 12px;
}

.afbeeldingen-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 260px;
}

.afbeelding-thumb {
  display: inline-block;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  cursor: zoom-in;
}

.afbeelding-thumb img {
  display: block;
  width: 100%;
  max-width: 200px;
  max-height: 200px;
  object-fit: cover;
}

.afbeelding-thumb-caption {
  display: block;
  width: 100%;
  max-width: 200px;
  margin-top: 6px;
  padding: 4px 6px;
  font-size: 0.82rem;
  line-height: 1.3;
  color: #222;
  background: #f8f8f8;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.afbeelding-thumb:hover {
  box-shadow: 0 0 0 2px rgba(0, 118, 255, 0.2);
}

.image-viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.75);
}

.image-viewer-overlay.hidden {
  display: none;
}

.image-viewer {
  position: relative;
  width: min(980px, 100%);
  max-height: calc(100% - 40px);
  padding: 18px;
  background: #111;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: auto;
}

.image-viewer-title {
  margin: 0 0 12px;
  color: #fff;
  font-size: 0.95rem;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-viewer img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 70vh;
  margin: 0 auto;
  transform: scale(1);
  transform-origin: center center;
  transition: transform 180ms ease;
  object-fit: contain;
}

.image-viewer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}

.image-viewer button,
.image-viewer a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.92rem;
}

.image-viewer button:hover,
.image-viewer a:hover {
  background: rgba(255, 255, 255, 0.18);
}

.image-viewer-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 0;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: none;
}

.image-viewer-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.regel-title {
  cursor: pointer;
  font-weight: 600;
  color: #222;
  background: none;
  border: none;
  padding: 6px 4px;
  width: 100%;
  text-align: left;
}

.regel-title:hover {
  color: rgba(var(--tegels2-color));
  background: none;
}

.regel-title:focus-visible,
.caret:focus-visible {
  outline: 3px solid rgba(var(--main-color));
  outline-offset: 3px;
}

#versie_select:focus-visible,
#search_date:focus-visible,
.richtlijnen-filters select:focus-visible,
.richtlijnen-filters input:focus-visible {
  outline: 3px solid rgba(var(--main-color));
  outline-offset: 2px;
}

/* + / − indicator on regel titles */
.regel-title {
  display: flex;
  align-items: center;
}

.regel-toggle-indicator {
  margin-left: auto;       /* push to far right */
  font-size: 1.2em;
  font-weight: 700;
  padding-left: 12px;
  padding-right: 25px;
}

/* open state */
.regel-title[aria-expanded="true"] .regel-toggle-indicator {
  content: "−";
}

/* .regel-description {
  margin-top: 4px;
  margin-left: 16px;
  padding: 10px 10px;

  background: #fafafa;
  border-radius: 2px;
} */

.regel-description[hidden] {
  display: none;
}

.pre-description {
  font-weight: 600;
}

.sweco-no-results {
  margin-top: 20px;
  font-size: 1.5em;
}

/* -----------------------------------------------------------
   FILTERS
----------------------------------------------------------- */
.richtlijnen-filters {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 50px;
}

.filter-label {
  font-weight: 600;
  margin-top: 10px;
}

.sysid-wrapper {
  display: inline-flex;
  align-items: center;
}

.sysid-prefix {
  background: #f0f2f5;
  padding: 6.4px 10px;
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
  font-weight: 600;
  border: 1px solid #e5e7eb;
}

#search_id_number {
  border-radius: 0px;
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.richtlijnen-filters input[type="number"] {
  max-width: none;
}

.filter-group {
  border: 1px solid rgba(var(--main-color));
  border-radius: 6px;
  background: #fff;
  margin: 8px 0;
}

.filter-toggle {
  width: 100%;
  text-align: left;
  background: #f0f2f5;
  border: none;
  padding: 10px 12px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  cursor: pointer;
  border-radius: 6px 6px 0px 0px;
}

.filter-toggle:focus-visible {
  outline: 2px solid rgba(var(--tegels2-color));
  outline-offset: 2px;
}

.filter-toggle:hover .filter-title,
.filter-toggle:hover .selected-count {
  color: white;
}

.filter-toggle:hover {
  border-radius: 6px 6px 0px 0px;
}

.filter-panel {
  padding: 10px 12px;
}

.checkbox-list {
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow: auto;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 8px;
}


.checkbox-item input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(var(--main-color));   /* visible keyboard focus */
  outline-offset: 2px;
}


/* -----------------------------------------------------------
   ACTIONS
----------------------------------------------------------- */
.filter-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-actions button[type="submit"], .export-actions button[type="submit"] {
  border-radius: 6px;
}

.export-btn-secondary {
  background: #f0f2f5;
  color: rgba(var(--main-color));
  border: 1px solid rgba(var(--main-color));
}

.export-actions {
  margin-top: 20px;
}

.reset-filters-btn {
  color: #6b7280;
  text-decoration: underline;
}

.reset-filters-btn:hover {
  color: #111827;
}

.richtlijn-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.history-btn {
  background-color: rgba(var(--main-color));
  padding: 2px 5px;
  color: white;
  text-decoration: none !important;
}

.history-btn:hover {
  background-color: #07838f;
  color: white;
} 

.share-btn {
  color: white;
}

.share-btn:focus-visible {
  outline: 2px solid rgba(var(--main-color));
  outline-offset: 2px;
}


/* -----------------------------------------------------------
   REGEL LAYOUT (70/30)
----------------------------------------------------------- */
.regel-other-container {
  display: flex;
  gap: 20px;
}

.omschrijving-richtlijn {
  margin-bottom: 20px;
}

.other-info-left {
  flex: 1;
}

.other-info-right {
  flex: 0 0 30%;
}

.other-info-right h4 {
  margin-bottom: 0px;
}

/* Mobile */
@media (max-width: 768px) {
  .regel-other-container {
      flex-direction: column;
  }
  .other-info-right,
  .other-info-left {
      flex: 100%;
  }
}