/* ===== Base ===== */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: #ffffff !important;
  color: #111111 !important;
}

body { overflow: hidden; }          /* keep body locked */


/* ===== 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;
   color-scheme: light;
}

.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: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;                         /* stretch to bottom */
  padding: 10px 0 0 8px;
  background: #ffffff !important;
  color: #111111 !important;
  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 */
}

/* ===== Header controls: make select + input match ===== */
:root{
  --ctrl-h: 38px;
  --ctrl-radius: 10px;
  --ctrl-border: 1px solid #cfcfcf;
  --ctrl-bg: #fff;
  --ctrl-shadow: 0 2px 6px rgba(0,0,0,0.08);
  --ctrl-pad-x: 14px;
  --ctrl-font: 16px;
}

/* Apply same baseline styling to both */
.fixed-header select,
.fixed-header input[type="text"]{
  height: var(--ctrl-h);
  border: var(--ctrl-border);
  border-radius: var(--ctrl-radius);
  background: var(--ctrl-bg);
  box-shadow: var(--ctrl-shadow);
  font-size: var(--ctrl-font);
  padding: 0 var(--ctrl-pad-x);
  outline: none;
}

/* A subtle “focused” state so both behave similarly */
.fixed-header select:focus,
.fixed-header input[type="text"]:focus{
  border-color: #7aa7d9;
  box-shadow: 0 0 0 3px rgba(122,167,217,0.25), var(--ctrl-shadow);
}



/* ---- TOC dropdown in the fixed header ---- */
.toc-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Make the select feel like the input */
#toc-select{
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 38px; /* room for arrow */
  width: clamp(160px, 25vw, 340px); /* your line is good here */
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, #333 50%),
    linear-gradient(135deg, #333 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}


#toc-select:focus {
  outline: none;
}


/* ---- 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: clamp(220px, 28vw, 420px);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.05);
}

#search-box::placeholder { color: #888; }

/* Search dropdown panel */
#search-results{
  position: absolute;

  /* anchor to the RIGHT edge of the search box */
  right: 0;
  left: auto;

  top: calc(100% + 8px);

  width: max(100%, 520px);   /* wider than the input, but not smaller */
  border: 1.5px solid #9aa7bd;   /* stronger outline */
  border-radius: 12px;
  background: #fff;

  box-shadow:
    0 12px 28px rgba(0,0,0,0.18),   /* main drop shadow */
    0 2px 6px rgba(0,0,0,0.12);    /* edge definition */

  z-index: 2000;
  max-height: 60vh;
  overflow-y: auto;
}

/* 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: #f2f4fa; }
#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;
  }
}

