/**
 * OEG Tool Overlay - Simple & Clean
 */

/* ==========================================================================
   OVERLAY
   ========================================================================== */

.oeg-tool-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.oeg-tool-overlay.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Backdrop */
.oeg-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
  backdrop-filter: blur(0px);
  transition: backdrop-filter 0.3s ease;
}

.oeg-tool-overlay.visible .oeg-overlay-backdrop {
  backdrop-filter: blur(4px);
}

/* Modal */
.oeg-overlay-container {
  box-sizing: border-box;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 90%;
  max-width: 550px;
  max-height: 90vh;
  background: #fff;
  border-radius: 12px;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  /* overflow stays visible so the prev/next nav arrows (positioned at
     left:-60px / right:-60px) are not clipped. The content-wrapper below
     is the element that actually handles internal scrolling, so the
     container never grows beyond max-height. */
  overflow: visible;
}

.oeg-tool-overlay.visible .oeg-overlay-container {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* Close Button */
.oeg-overlay-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  font-size: 22px;
  cursor: pointer;
  border-radius: 50%;
  z-index: 10;
}

/* Navigation Arrows */
.oeg-overlay-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  z-index: 10;
  padding: 10px;
}

.oeg-overlay-nav svg {
  width: 64px;
  height: 64px;
}

.oeg-overlay-nav-prev {
  left: -60px;
}

.oeg-overlay-nav-next {
  right: -60px;
}

/* Content wrapper — the only scroll container.
   Capped at 90vh (border-box, padding included) so the whole overlay
   always fits inside the viewport. overflow-y:auto lets tall tools
   (e.g. Jupyter) scroll, but the scrollbar itself is hidden below. */
.oeg-overlay-content-wrapper {
  box-sizing: border-box;
  padding: 28px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  /* Hide the scrollbar on every browser while keeping scrolling
     functional. The user can still scroll with wheel / trackpad /
     keyboard; the bar simply never renders. */
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* legacy IE / old Edge */
}

.oeg-overlay-content-wrapper::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;                  /* Chrome / Safari / Edge */
}

/* ==========================================================================
   HEADER
   ========================================================================== */

.oeg-overlay-header {
  margin-bottom: 20px;
}

.oeg-overlay-subline {
  font-family: "ZBW-Binary", sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #666;
  margin-bottom: 2px;
  line-height: 1.3;
}

.oeg-overlay-header h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
  color: #111;
  line-height: 1.3;
}

.oeg-overlay-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.oeg-category-badge {
  display: inline-block;
  padding: 2px 10px;
  font-size: 12px;
  background: #eef3f8;
  color: #2c5f8a;
  border-radius: 12px;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

/* The footer is a single, non-wrapping row: badges on the left, the
   "Zum Tool" button pinned to the right. The badges container below is
   allowed to shrink (min-width:0) so that when every badge is present
   they wrap *inside* their own area instead of forcing the button onto
   a second line. The button is held at natural width and pushed right
   via margin-left:auto (see .oeg-btn-primary). */
.oeg-overlay-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
  flex-wrap: nowrap;
}

.oeg-overlay-footer .oeg-overlay-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  /* Take available width but shrink below content size (min-width:0)
     so the badges wrap onto extra lines here rather than bumping the
     visit button down to a new footer row. */
  flex: 0 1 auto;
  min-width: 0;
}

.oeg-overlay-footer .filter-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #555;
}

/* Visit Website button in footer.
   flex:0 0 auto keeps it at its natural width (never shrinks, even
   when badges crowd the row); margin-left:auto pins it to the right
   edge so the position never shifts, whether badges render or not. */
.oeg-overlay-footer .oeg-btn-primary {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 8px 16px;
  background: #0073aa;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

/* ==========================================================================
   BODY & INFO
   ========================================================================== */

.oeg-overlay-body {
  margin-top: 20px;
}

.oeg-overlay-info {
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.oeg-overlay-info > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 14px;
  line-height: 1.6;
}

.oeg-overlay-info > div + div {
  margin-top: 10px;
}

.oeg-overlay-info strong {
  color: #555;
  font-weight: 600;
  min-width: 120px;
}

.oeg-overlay-info a {
  color: #0073aa;
  text-decoration: none;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 600px) {
  .oeg-overlay-container {
    width: 95%;
    max-height: 95vh;
    border-radius: 10px;
  }

  .oeg-overlay-content-wrapper {
    padding: 20px;
  }

  .oeg-overlay-header h1 {
    font-size: 19px;
  }

  .oeg-overlay-subline {
    font-size: 12px;
  }

  .oeg-overlay-info strong {
    min-width: 100px;
  }
}

@media (max-width: 480px) {
  .oeg-overlay-container {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    top: 0;
    left: 0;
    transform: none;
  }

  .oeg-tool-overlay.visible .oeg-overlay-container {
    transform: none;
  }

  .oeg-overlay-content-wrapper {
    padding: 18px 16px;
  }

  .oeg-overlay-nav-prev {
    left: 8px;
  }

  .oeg-overlay-nav-next {
    right: 8px;
  }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .oeg-tool-overlay,
  .oeg-overlay-container,
  .oeg-overlay-backdrop,
  .oeg-overlay-close,
  .oeg-overlay-nav,
  .oeg-btn-primary,
  .oeg-btn-secondary {
    transition: opacity 0.15s ease;
  }

  .oeg-overlay-backdrop {
    transition: backdrop-filter 0.15s ease;
  }

  .oeg-tool-overlay.visible .oeg-overlay-container {
    transform: translate(-50%, -50%) scale(0.95);
  }
}


/* Print */
@media print {
  .oeg-tool-overlay {
    display: none !important;
  }
}
