/* ===== Base ===== */
html, body {
  font-family: Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #333;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;           /* page itself does not scroll */
}


/* ===== Typography ===== */
h1 { font-size: 24px; font-weight: 700; margin: 0 0 10px;  color: #003366; }
h2 { font-size: 20px; font-weight: 700; margin: 20px 0 10px; color: #005599; }
h3 { font-size: 18px; font-weight: 700; margin: 15px 0 8px;  color: #005599; }
h4 { font-size: 16px; font-weight: 600; margin: 12px 0 6px;  color: #005599; }
h5 { font-size: 15px; font-weight: 600; margin: 10px 0 5px;  color: #005599; }
p  { margin: 0 0 12px; }


.normal-text   { font-size: 16px; text-align: left; }
.indent, .indented-text { margin-left: 36px; }


/* ---- Fixed header + scroller (no white band) ---- */
:root { --header-h: 80px; }         /* JS will sync real height */

.fixed-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);          /* explicit */
  background: #f0f0f0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  z-index: 1000;
  gap: 20px;
}

.fixed-header h1 {
  font-size: 1.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  flex: 1;
  min-width: 0;
}

/* The ONLY scroll container */
.content {
  position: fixed;
  top: calc(var(--header-h) + 10px);              /* start right below header */
  left: 0;
  right: 0;
  bottom: 0;                         /* stretch to bottom */
  padding-left: 8px;
  padding-top: 6px;
  box-sizing: border-box;
  overflow-y: auto;
  /*scroll-padding-top: var(--header-h);*/
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
}


.text-with-image {
    display: flex;
    align-items: center;
    gap: 10px; /* Adjusts spacing between text and image */
}

.text-with-image img {
    max-height: 100%;
    max-width: 100%;
    vertical-align: middle;
}

/* ===== Header Buttons ===== */
.header-buttons {
    display: flex;
    align-items: center;
    gap: 10px; /* Adds spacing between buttons */
}

.header-buttons button {
    width: 40px;
    height: 40px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.header-buttons button:hover {
    background-color: #e0e0e0;
}

.header-buttons button:disabled { opacity: .5; cursor: default; }

/* Make sure the buttons and search don't get crowded */
.header-buttons, .search-container {
    flex-shrink: 0; /* Prevents these elements from shrinking */


/* Default Pin Button */
#pin-btn {
    width: 40px;
    height: 40px;
    background-image: url("../help_protrev_workflow_files/pin-icon.png");
    background-size: contain; /* Scale the image */
    background-repeat: no-repeat;
    background-position: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff; /* Default unpinned color */
    cursor: pointer;
    transition: background-color 0.3s;
}

/* Pinned (Latched) State */
#pin-btn.latched {
    background-color: #ffd700; /* Gold when pinned */
}

/* ---- Search UI in the fixed header ---- */
.search-container {
  position: relative;               /* so the dropdown can anchor */
  display: flex;
  align-items: center;
  gap: 8px;
}

#search-box {
  appearance: none;
  font-size: 14px;                  /* smaller font */
  line-height: 1.2;
  height: 32px;                     /* fixed, tidy height */
  padding: 6px 10px;
  border: 1px solid #bbb;
  border-radius: 8px;
  background: #fff;                 /* solid background */
  color: #222;
  width: 260px;                     /* adjust as needed */
  box-shadow: inset 0 1px 2px rgba(0,0,0,.05);
}

#search-box::placeholder { color: #888; }

#search-results {
  display: none;                     /* hidden until populated */
  position: fixed;                   /* anchor to viewport */
  top: calc(var(--header-h) + 42px); /* below header + search box */
  right: 10px;
  width: 60vw;                       /* 60% of viewport */
  max-width: 800px;                  /* cap for large screens */
  min-width: 320px;                  /* keep readable on small screens */
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  max-height: 40vh;
  overflow-y: auto;
  overflow-x: hidden;                /* no sideways scrollbars */
  padding: 6px;
  z-index: 2000;
  font-size: 14px;
}

/* Compact heading/body spacing inside the results panel */
#search-results h1,
#search-results h2,
#search-results h3,
#search-results h4,
#search-results h5,
#search-results p {
  margin: 6px 0 4px;
}

/* Base styling for each result entry (any direct child) */
#search-results > * {
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}

#search-results .is-heading {
  color: #005599;                /* heading color */
  border-left: 3px solid #cfe5ff;
  padding-left: 6px;             /* space from the border */
  font-weight: 700;
}

/* Alternate row shading */
#search-results > *:nth-child(odd)  { background-color: #f9f9ff; }
#search-results > *:nth-child(even) { background-color: #ffffff; }

/* Hover effect */
#search-results > *:hover { background-color: #e6f0ff; }

/* Highlighted match */
#search-results mark.__hit {
  background: #ffe9a8;
  padding: 0 2px;
}

/* Optional: on very narrow viewports, use nearly full width */
@media (max-width: 600px) {
  #search-results {
    right: 6px;
    left: 6px;          /* stretch, but keep small gutters */
    width: auto;        /* override 60vw */
    max-width: none;
  }
}

