/* =========================================================================
   search.css — quick-search palette styling (paired with search.js).
   Uses the course design tokens (:root vars) with safe fallbacks so it
   still looks right if a page defines fewer variables. Theme-agnostic,
   RTL-friendly, honors prefers-reduced-motion.
   ========================================================================= */

/* ---- floating trigger button --------------------------------------- */
#pk-fab {
  position: fixed;
  inset-block-end: 20px;
  inset-inline-end: 20px;
  z-index: 60;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid var(--line, rgba(255, 255, 255, .12));
  background: linear-gradient(135deg, var(--teal, #22D3B0), var(--blue, #5B8DEF));
  color: #04231D;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow, 0 16px 44px -18px rgba(0, 0, 0, .65));
  display: grid;
  place-items: center;
  transition: transform .15s ease, filter .15s ease;
}
#pk-fab:hover { transform: translateY(-2px) scale(1.05); filter: brightness(1.08); }
#pk-fab:active { transform: translateY(0) scale(.98); }
#pk-fab:focus-visible { outline: 2px solid var(--amber, #F6B73C); outline-offset: 3px; }
@media (max-width: 560px) {
  #pk-fab { width: 46px; height: 46px; inset-block-end: 16px; inset-inline-end: 16px; }
}

/* ---- overlay ------------------------------------------------------- */
.pk-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(40px, 12vh, 140px) 16px 16px;
  background: rgba(8, 7, 20, .62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.pk-overlay[hidden] { display: none; }

/* ---- panel --------------------------------------------------------- */
.pk-panel {
  width: 100%;
  max-width: 620px;
  max-height: min(70vh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--panel, #241F50);
  color: #EEEDFB;
  border: 1px solid var(--line, rgba(255, 255, 255, .12));
  border-radius: var(--r, 18px);
  box-shadow: var(--shadow, 0 16px 44px -18px rgba(0, 0, 0, .65));
  overflow: hidden;
  font-family: "Cairo", "Heebo", sans-serif;
}
html[data-lang="he"] .pk-panel { font-family: "Heebo", "Cairo", sans-serif; }

/* entrance animation (skipped under reduced-motion) */
.pk-overlay.pk-shown .pk-panel { animation: pk-pop .16s ease-out; }
@keyframes pk-pop {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* ---- search head --------------------------------------------------- */
.pk-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line, rgba(255, 255, 255, .12));
}
.pk-ico { font-size: 1.15rem; opacity: .8; flex-shrink: 0; }
.pk-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: #EEEDFB;
  font: inherit;
  font-size: 1.05rem;
  padding: 4px 0;
}
.pk-input::placeholder { color: var(--muted, #9694C0); }

/* ---- results list -------------------------------------------------- */
.pk-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  flex: 1;
}
.pk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  cursor: pointer;
  color: #DCDAF3;
}
.pk-lvl {
  flex-shrink: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted, #9694C0);
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line, rgba(255, 255, 255, .12));
  border-radius: 6px;
  padding: 2px 7px;
  min-width: 26px;
  text-align: center;
}
.pk-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .96rem;
  font-weight: 600;
}
/* nested-heading feel: deeper headings indent slightly */
.pk-l3 .pk-label { font-weight: 400; opacity: .92; }
.pk-l3 { padding-inline-start: 22px; }

.pk-item.pk-active {
  background: linear-gradient(135deg, var(--teal, #22D3B0), var(--blue, #5B8DEF));
  color: #04231D;
}
.pk-item.pk-active .pk-lvl { color: #04231D; background: rgba(255, 255, 255, .25); border-color: transparent; }
.pk-item.pk-active .pk-label { opacity: 1; }

.pk-empty {
  list-style: none;
  padding: 22px 14px;
  text-align: center;
  color: var(--muted, #9694C0);
  font-size: .95rem;
}

/* ---- footer hint --------------------------------------------------- */
.pk-hint {
  padding: 9px 16px;
  border-top: 1px solid var(--line, rgba(255, 255, 255, .12));
  color: var(--muted, #9694C0);
  font-size: .74rem;
  text-align: center;
}

/* ---- landing highlight on the jumped-to element -------------------- */
.pk-flash {
  animation: pk-flash 1.4s ease-out;
  border-radius: var(--r, 18px);
}
@keyframes pk-flash {
  0%   { box-shadow: 0 0 0 3px var(--amber, #F6B73C); }
  100% { box-shadow: 0 0 0 3px rgba(246, 183, 60, 0); }
}

/* ---- reduced motion ------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  #pk-fab,
  .pk-overlay.pk-shown .pk-panel,
  .pk-flash { animation: none; transition: none; }
  #pk-fab:hover { transform: none; }
}
