.cnp-search-modal {
  --cs-primary: var(--cnp-primary, #005B8F);
  --cs-primary-dark: var(--cnp-primary-dark, #003B5C);
  --cs-primary-soft: #EAF3F9;
  --cs-heading: var(--cnp-heading, #111827);
  --cs-ink: var(--cnp-ink, #1F2933);
  --cs-muted: var(--cnp-muted, #5F6B7A);
  --cs-meta: var(--cnp-meta, #6B7280);
  --cs-line: var(--cnp-line, #E5EAF0);
  --cs-t: .18s cubic-bezier(.4, 0, .2, 1);
  font-family: "Lato", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Sit the panel near the top - a search palette belongs under the cursor,
   not floating in the middle of a long page. */
.cnp-search-modal .modal-dialog {
  max-width: 640px;
  margin-top: 8vh;
  margin-bottom: 8vh;
  align-items: flex-start;
}
.cnp-search-modal .modal-content {
  border: 0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 70px -30px rgba(9, 24, 41, .6), 0 2px 8px rgba(9, 24, 41, .08);
}
/* Slide the palette down a touch on open instead of Bootstrap's default */
.cnp-search-modal.fade .modal-dialog { transform: translateY(-14px) scale(.99); }
.cnp-search-modal.show .modal-dialog { transform: none; }


/* ------------------------------------------------------------
   Search field
   ------------------------------------------------------------ */
.cnp-search-modal .cs-field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--cs-line);
}
.cnp-search-modal .cs-field-icon {
  flex: 0 0 auto;
  font-size: 17px;
  color: var(--cs-primary);
}
.cnp-search-modal .cs-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font-size: 19px;
  font-weight: 600;
  color: var(--cs-heading);
  padding: 4px 0;
  line-height: 1.4;
}
.cnp-search-modal .cs-input::placeholder { color: #9AA7B4; font-weight: 400; }
/* kill the browser's own clear/decoration on type=search */
.cnp-search-modal .cs-input::-webkit-search-decoration,
.cnp-search-modal .cs-input::-webkit-search-cancel-button,
.cnp-search-modal .cs-input::-webkit-search-results-button { -webkit-appearance: none; display: none; }

.cnp-search-modal .cs-clear {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: #EEF2F6;
  color: var(--cs-muted);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--cs-t), color var(--cs-t);
}
.cnp-search-modal .cs-clear:hover { background: #DEE5EC; color: var(--cs-heading); }

.cnp-search-modal .cs-close {
  flex: 0 0 auto;
  border: 1px solid var(--cs-line);
  background: #F7F9FB;
  border-radius: 7px;
  padding: 4px 9px;
  cursor: pointer;
  transition: border-color var(--cs-t), background var(--cs-t);
}
.cnp-search-modal .cs-close:hover { background: #EEF2F6; border-color: #CFD8E1; }
.cnp-search-modal .cs-esc {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--cs-muted);
}


/* ------------------------------------------------------------
   Type filter
   ------------------------------------------------------------ */
.cnp-search-modal .cs-tabs {
  display: flex;
  gap: 6px;
  padding: 12px 18px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--cs-line);
  background: #FBFCFD;
}
.cnp-search-modal .cs-tabs::-webkit-scrollbar { display: none; }
.cnp-search-modal .cs-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  border: 1px solid transparent;
  background: none;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--cs-muted);
  cursor: pointer;
  transition: background var(--cs-t), color var(--cs-t), border-color var(--cs-t);
}
.cnp-search-modal .cs-tab i { font-size: 12.5px; opacity: .85; }
.cnp-search-modal .cs-tab:hover { background: #EFF3F7; color: var(--cs-heading); }
.cnp-search-modal .cs-tab.is-active {
  background: var(--cs-primary);
  border-color: var(--cs-primary);
  color: #fff;
}
.cnp-search-modal .cs-tab.is-active i { opacity: 1; }


/* ------------------------------------------------------------
   Body - results and the three empty/loading states
   ------------------------------------------------------------ */
.cnp-search-modal .cs-body {
  max-height: min(52vh, 430px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.cnp-search-modal .cs-body::-webkit-scrollbar { width: 10px; }
.cnp-search-modal .cs-body::-webkit-scrollbar-thumb {
  background: #D7DEE6;
  border: 3px solid #fff;
  border-radius: 999px;
}

/* Result rows */
.cnp-search-modal .cs-results { padding: 8px; }
.cnp-search-modal .cs-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 11px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: background var(--cs-t);
}
.cnp-search-modal .cs-result:hover,
.cnp-search-modal .cs-result.is-active {
  background: var(--cs-primary-soft);
  text-decoration: none;
}
.cnp-search-modal .cs-result.is-active { box-shadow: inset 0 0 0 1px #C7DEEC; }

.cnp-search-modal .cs-thumb {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 9px;
  border: 1px solid var(--cs-line);
  background: #fff center / contain no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cnp-search-modal .cs-thumb--initial {
  background: linear-gradient(135deg, #005B8F, #0A7BB8);
  border-color: transparent;
  color: #fff;
  font-family: "Roboto Slab", Georgia, serif;
  font-size: 17px;
  font-weight: 700;
}

.cnp-search-modal .cs-result-main { flex: 1 1 auto; min-width: 0; }
.cnp-search-modal .cs-result-name {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--cs-heading);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cnp-search-modal .cs-result-name mark {
  background: #FFF0B8;
  color: inherit;
  padding: 0;
  border-radius: 2px;
}
.cnp-search-modal .cs-result-name .cs-tick { color: var(--cs-primary); font-size: 12px; margin-left: 4px; }
.cnp-search-modal .cs-result-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--cs-meta);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cnp-search-modal .cs-result-meta i { font-size: 11px; opacity: .8; margin-right: 3px; }
.cnp-search-modal .cs-go {
  flex: 0 0 auto;
  color: #B4C0CC;
  font-size: 13px;
  opacity: 0;
  transition: opacity var(--cs-t), transform var(--cs-t);
}
.cnp-search-modal .cs-result:hover .cs-go,
.cnp-search-modal .cs-result.is-active .cs-go { opacity: 1; transform: translateX(2px); color: var(--cs-primary); }

/* "See all N results" row */
.cnp-search-modal .cs-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 6px 3px 3px;
  padding: 11px;
  border-radius: 10px;
  background: #F5F8FA;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--cs-primary);
  text-decoration: none;
  transition: background var(--cs-t);
}
.cnp-search-modal .cs-more:hover,
.cnp-search-modal .cs-more.is-active { background: var(--cs-primary-soft); text-decoration: none; }
.cnp-search-modal .cs-more.is-active { box-shadow: inset 0 0 0 1px #C7DEEC; }

/* Loading skeleton */
.cnp-search-modal .cs-loading { padding: 8px; }
.cnp-search-modal .cs-skeleton { display: flex; gap: 12px; align-items: center; padding: 10px 11px; }
.cnp-search-modal .cs-sk-thumb,
.cnp-search-modal .cs-sk-line {
  background: linear-gradient(90deg, #EDF1F5 25%, #F6F8FA 37%, #EDF1F5 63%);
  background-size: 400% 100%;
  animation: cs-shimmer 1.3s ease-in-out infinite;
  border-radius: 6px;
}
.cnp-search-modal .cs-sk-thumb { width: 42px; height: 42px; border-radius: 9px; flex: 0 0 auto; }
.cnp-search-modal .cs-sk-lines { flex: 1 1 auto; display: block; }
.cnp-search-modal .cs-sk-line { display: block; height: 11px; margin-bottom: 7px; }
.cnp-search-modal .cs-sk-line.short { width: 42%; margin-bottom: 0; height: 9px; }
@keyframes cs-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) {
  .cnp-search-modal .cs-sk-thumb,
  .cnp-search-modal .cs-sk-line { animation: none; }
}

/* No-results */
.cnp-search-modal .cs-empty { text-align: center; padding: 34px 24px 30px; }
.cnp-search-modal .cs-empty > i { font-size: 30px; color: #C7D2DD; }
.cnp-search-modal .cs-empty-title { margin: 12px 0 4px; font-size: 15.5px; font-weight: 700; color: var(--cs-heading); }
.cnp-search-modal .cs-empty-title b { color: var(--cs-primary); }
/* Typographic quotes live here so search-modal.js can stay pure ASCII. */
.cnp-search-modal .cs-empty-q::before { content: "\201C"; }
.cnp-search-modal .cs-empty-q::after  { content: "\201D"; }
.cnp-search-modal .cs-empty-sub { margin: 0 0 16px; font-size: 13.5px; color: var(--cs-meta); line-height: 1.6; }
.cnp-search-modal .cs-empty-link {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--cs-primary);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
}
.cnp-search-modal .cs-empty-link:hover { background: var(--cs-primary-dark); color: #fff; }

/* Idle - popular links + recent searches */
.cnp-search-modal .cs-idle { padding: 16px 18px 18px; }
.cnp-search-modal .cs-idle-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--cs-meta);
}
.cnp-search-modal .cs-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }
.cnp-search-modal .cs-chips a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--cs-line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--cs-ink);
  text-decoration: none;
  transition: all var(--cs-t);
}
.cnp-search-modal .cs-chips a i { color: var(--cs-primary); font-size: 12px; }
.cnp-search-modal .cs-chips a:hover {
  border-color: var(--cs-primary);
  background: var(--cs-primary-soft);
  color: var(--cs-primary);
  text-decoration: none;
}

.cnp-search-modal .cs-recent { margin-top: 20px; }
.cnp-search-modal .cs-recent-clear {
  border: 0;
  background: none;
  padding: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--cs-primary);
  cursor: pointer;
}
.cnp-search-modal .cs-recent-clear:hover { text-decoration: underline; }
.cnp-search-modal .cs-recent-list { margin: 0; padding: 0; list-style: none; }
.cnp-search-modal .cs-recent-list button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: none;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--cs-ink);
  text-align: left;
  cursor: pointer;
  transition: background var(--cs-t);
}
.cnp-search-modal .cs-recent-list button:hover { background: #F2F6F9; color: var(--cs-primary); }
.cnp-search-modal .cs-recent-list i { color: #A9B4C0; font-size: 12px; }


/* ------------------------------------------------------------
   Footer keyboard hints
   ------------------------------------------------------------ */
.cnp-search-modal .cs-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  border-top: 1px solid var(--cs-line);
  background: #FBFCFD;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--cs-meta);
}
.cnp-search-modal .cs-foot kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  margin-right: 3px;
  border: 1px solid var(--cs-line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fff;
  color: var(--cs-ink);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
}
.cnp-search-modal .cs-foot-tip { margin-left: auto; }


/* ------------------------------------------------------------
   Responsive - full-height sheet on phones
   ------------------------------------------------------------ */
@media (max-width: 575.98px) {
  .cnp-search-modal .modal-dialog { margin: 0; max-width: none; min-height: 100%; }
  .cnp-search-modal .modal-content { border-radius: 0; min-height: 100vh; }
  .cnp-search-modal .cs-body { max-height: none; flex: 1 1 auto; }
  .cnp-search-modal .cs-field { padding: 13px 14px; }
  .cnp-search-modal .cs-input { font-size: 16px; } /* >=16px stops iOS zoom-on-focus */
  .cnp-search-modal .cs-tabs { padding: 10px 14px; }
  .cnp-search-modal .cs-idle { padding: 14px; }
  .cnp-search-modal .cs-foot { display: none; }
}
