/* ─── GSI Search ─── Site-wide + Learn Hub search ─── */

/* ── Overlay ── */
.gsi-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: min(20vh, 160px);
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.gsi-search-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* ── Modal ── */
.gsi-search-modal {
  width: 100%;
  max-width: 620px;
  margin: 0 16px;
  background: #0F2629;
  border: 1px solid rgba(232, 197, 71, 0.15);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  transform: translateY(-12px) scale(0.97);
  transition: transform 0.2s ease;
  overflow: hidden;
}
.gsi-search-overlay.open .gsi-search-modal {
  transform: translateY(0) scale(1);
}

/* ── Input area ── */
.gsi-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(26, 58, 63, 0.8);
}
.gsi-search-input-wrap svg {
  flex-shrink: 0;
  color: #E8C547;
  opacity: 0.7;
}
.gsi-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #F0EDE4;
  font-size: 15px;
  font-family: inherit;
  letter-spacing: -0.01em;
}
.gsi-search-input::placeholder {
  color: #6B7B6B;
}
.gsi-search-kbd {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(26, 58, 63, 0.8);
  color: #6B7B6B;
  font-size: 11px;
  font-family: inherit;
  white-space: nowrap;
}

/* ── Results area ── */
.gsi-search-results {
  max-height: min(50vh, 420px);
  overflow-y: auto;
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 197, 71, 0.15) transparent;
}
.gsi-search-results::-webkit-scrollbar { width: 4px; }
.gsi-search-results::-webkit-scrollbar-thumb { background: rgba(232, 197, 71, 0.15); border-radius: 4px; }

.gsi-search-group-label {
  padding: 8px 12px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6B7B6B;
}

.gsi-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}
.gsi-search-item:hover,
.gsi-search-item.active {
  background: rgba(232, 197, 71, 0.08);
}
.gsi-search-item-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(26, 58, 63, 0.6);
  color: #E8C547;
}
.gsi-search-item-icon.article {
  background: rgba(232, 197, 71, 0.1);
  color: #E8C547;
}
.gsi-search-item-icon.video {
  background: rgba(220, 38, 38, 0.1);
  color: #f87171;
}
.gsi-search-item-text {
  flex: 1;
  min-width: 0;
}
.gsi-search-item-title {
  font-size: 13px;
  font-weight: 600;
  color: #F0EDE4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gsi-search-item-desc {
  font-size: 11px;
  color: #6B7B6B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.gsi-search-item-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(26, 58, 63, 0.6);
  color: #A0ADA0;
}

/* ── Empty state ── */
.gsi-search-empty {
  padding: 32px 20px;
  text-align: center;
  color: #6B7B6B;
  font-size: 13px;
}
.gsi-search-empty strong {
  display: block;
  color: #A0ADA0;
  margin-bottom: 4px;
}

/* ── Footer ── */
.gsi-search-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-top: 1px solid rgba(26, 58, 63, 0.6);
  font-size: 11px;
  color: #6B7B6B;
}
.gsi-search-footer-keys {
  display: flex;
  align-items: center;
  gap: 12px;
}
.gsi-search-footer-keys span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.gsi-search-footer-keys kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 4px;
  border: 1px solid rgba(26, 58, 63, 0.8);
  font-size: 10px;
  font-family: inherit;
  color: #A0ADA0;
}

/* ── Nav search trigger button ── */
.gsi-search-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(26, 58, 63, 0.6);
  background: rgba(15, 38, 41, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #A0ADA0;
  cursor: pointer;
  transition: all 0.2s ease;
}
.gsi-search-trigger:hover {
  border-color: rgba(232, 197, 71, 0.3);
  color: #E8C547;
  background: rgba(15, 38, 41, 0.8);
}

/* ── Learn Hub inline search bar ── */
.gsi-lh-search-wrap {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
}
.gsi-lh-search {
  width: 100%;
  padding: 12px 44px 12px 44px;
  border-radius: 12px;
  border: 1px solid rgba(26, 58, 63, 0.8);
  background: rgba(15, 38, 41, 0.6);
  color: #F0EDE4;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.gsi-lh-search:focus {
  border-color: rgba(232, 197, 71, 0.35);
  box-shadow: 0 0 0 3px rgba(232, 197, 71, 0.08);
}
.gsi-lh-search::placeholder {
  color: #6B7B6B;
}
.gsi-lh-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #E8C547;
  opacity: 0.5;
  pointer-events: none;
}
.gsi-lh-search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(26, 58, 63, 0.8);
  color: #A0ADA0;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.gsi-lh-search-clear.visible { display: flex; }

/* ── Learn Hub search results dropdown ── */
.gsi-lh-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 360px;
  overflow-y: auto;
  background: #0F2629;
  border: 1px solid rgba(26, 58, 63, 0.8);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  z-index: 100;
  display: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 197, 71, 0.15) transparent;
}
.gsi-lh-results.open { display: block; }
.gsi-lh-results::-webkit-scrollbar { width: 4px; }
.gsi-lh-results::-webkit-scrollbar-thumb { background: rgba(232, 197, 71, 0.15); border-radius: 4px; }

.gsi-lh-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-decoration: none;
  transition: background 0.15s ease;
  cursor: pointer;
}
.gsi-lh-result-item:hover {
  background: rgba(232, 197, 71, 0.08);
}
.gsi-lh-result-item + .gsi-lh-result-item {
  border-top: 1px solid rgba(26, 58, 63, 0.4);
}
.gsi-lh-result-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 14px;
}
.gsi-lh-result-icon.article {
  background: rgba(232, 197, 71, 0.1);
  color: #E8C547;
}
.gsi-lh-result-icon.video {
  background: rgba(220, 38, 38, 0.1);
  color: #f87171;
}
.gsi-lh-result-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  color: #F0EDE4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gsi-lh-result-type {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6B7B6B;
}

/* ── Light page overrides ── */
.gsi-light-page .gsi-search-overlay {
  background: rgba(0, 0, 0, 0.35);
}
.gsi-light-page .gsi-search-modal {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.15);
}
.gsi-light-page .gsi-search-input-wrap {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}
.gsi-light-page .gsi-search-input {
  color: #111827;
}
.gsi-light-page .gsi-search-input::placeholder {
  color: #9ca3af;
}
.gsi-light-page .gsi-search-kbd {
  border-color: rgba(0, 0, 0, 0.12);
  color: #9ca3af;
}
.gsi-light-page .gsi-search-group-label {
  color: #6b7280;
}
.gsi-light-page .gsi-search-item:hover,
.gsi-light-page .gsi-search-item.active {
  background: rgba(0, 0, 0, 0.04);
}
.gsi-light-page .gsi-search-item-icon {
  background: rgba(0, 0, 0, 0.05);
  color: #E8C547;
}
.gsi-light-page .gsi-search-item-title {
  color: #111827;
}
.gsi-light-page .gsi-search-item-desc {
  color: #6b7280;
}
.gsi-light-page .gsi-search-item-badge {
  background: rgba(0, 0, 0, 0.05);
  color: #6b7280;
}
.gsi-light-page .gsi-search-empty {
  color: #9ca3af;
}
.gsi-light-page .gsi-search-empty strong {
  color: #6b7280;
}
.gsi-light-page .gsi-search-footer {
  border-top-color: rgba(0, 0, 0, 0.08);
  color: #9ca3af;
}
.gsi-light-page .gsi-search-footer-keys kbd {
  border-color: rgba(0, 0, 0, 0.12);
  color: #6b7280;
}
.gsi-light-page .gsi-search-trigger {
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.6);
  color: #6b7280;
}
.gsi-light-page .gsi-search-trigger:hover {
  border-color: rgba(0, 0, 0, 0.2);
  color: #111827;
  background: rgba(255, 255, 255, 0.9);
}

/* ── Mobile tweaks ── */
@media (max-width: 767px) {
  .gsi-search-overlay { padding-top: 12px; }
  .gsi-search-modal { max-width: 100%; margin: 0 8px; border-radius: 12px; }
  .gsi-search-kbd { display: none; }
  .gsi-search-footer-keys { display: none; }
  .gsi-search-trigger {
    width: 40px;
    height: 40px;
  }
}
