/* ═══════════════════════════════════════════════════════
   Hanak Search — Expanding pill with lightbox results
   ═══════════════════════════════════════════════════════ */

/* ─── Trigger: Oval "Hledat" pill ───────────────────── */
#hanak-search-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  height: 48px;
  width: 120px;
  padding: 0 22px 0 18px;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(20, 20, 20, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-family: system-ui, -apple-system, sans-serif;
  font-weight: 500;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              border-radius 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.3s ease,
              box-shadow 0.3s ease,
              opacity 0.3s ease;
  transform-origin: bottom right;
  overflow: hidden;
}

#hanak-search-trigger * { pointer-events: none; }

#hanak-search-trigger svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

#hanak-search-trigger span {
  white-space: nowrap;
  transition: opacity 0.15s;
}

#hanak-search-trigger:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.1);
}

/* Expanded = looks like the search bar */
#hanak-search-trigger.hs-expanded {
  width: 520px;
  max-width: calc(100vw - 48px);
  height: 52px;
  border-color: rgba(197, 163, 106, 0.3);
  box-shadow: 0 4px 32px rgba(0,0,0,0.3), 0 0 0 1px rgba(197, 163, 106, 0.15);
}

#hanak-search-trigger.hs-expanded span {
  opacity: 0;
}

/* Collapsing back = reverse animation */
#hanak-search-trigger.hs-collapsing {
  width: 120px;
  height: 48px;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              border-radius 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.3s ease,
              box-shadow 0.3s ease,
              opacity 0.3s ease;
}

#hanak-search-trigger.hs-collapsing span {
  opacity: 1;
}

#hanak-search-trigger.hs-gone {
  opacity: 0;
  pointer-events: none;
}

/* ─── Search Container ──────────────────────────────── */
#hanak-search-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

#hanak-search-container.hs-active {
  opacity: 1;
  pointer-events: all;
}

/* ─── Results Panel (above the bar) ─────────────────── */
.hs-results-panel {
  width: 520px;
  max-width: calc(100vw - 48px);
  max-height: 0;
  overflow: hidden;
  background: rgba(18, 18, 18, 0.65);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 64px rgba(0,0,0,0.35);
  margin-bottom: 8px;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease;
  opacity: 0;
}

.hs-results-panel.has-results {
  max-height: 420px;
  opacity: 1;
}

.hs-results-scroll {
  max-height: 380px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.hs-results-scroll::-webkit-scrollbar { width: 5px; }
.hs-results-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

/* ─── Footer inside results ─────────────────────────── */
.hs-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.hs-footer-hint {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.2);
}

.hs-footer-hint kbd {
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 9px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-family: system-ui;
}

.hs-footer-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.15);
  font-variant-numeric: tabular-nums;
}

/* ─── Search Bar ────────────────────────────────────── */
.hs-bar {
  width: 520px;
  max-width: calc(100vw - 48px);
  height: 52px;
  background: rgba(20, 20, 20, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 26px;
  border: 1px solid rgba(197, 163, 106, 0.3);
  box-shadow: 0 4px 32px rgba(0,0,0,0.3), 0 0 0 1px rgba(197, 163, 106, 0.15);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 12px;
}

.hs-icon {
  width: 20px;
  height: 20px;
  color: #c5a36a;
  flex-shrink: 0;
}

.hs-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-size: 16px;
  font-family: system-ui, -apple-system, sans-serif;
  letter-spacing: -0.01em;
}

.hs-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.hs-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}

.hs-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

/* ─── Result Item ───────────────────────────────────── */
.hs-result {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  gap: 12px;
  text-decoration: none;
  color: #fff;
  transition: background 0.12s ease;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.hs-result:first-child { border-radius: 16px 16px 0 0; }
.hs-result:last-child { border-radius: 0 0 16px 16px; }

.hs-result:hover,
.hs-result.hs-active {
  background: rgba(255, 255, 255, 0.04);
  border-left-color: #c5a36a;
}

.hs-result-thumb {
  width: 52px;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hs-result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hs-result-thumb-icon {
  font-size: 18px;
  opacity: 0.5;
}

.hs-result-body {
  flex: 1;
  min-width: 0;
}

.hs-result-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.3;
}

.hs-result-title mark {
  background: none;
  color: #c5a36a;
  font-weight: 600;
}

.hs-result-cat {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  margin-top: 1px;
}

.hs-result-score {
  font-size: 11px;
  font-weight: 600;
  color: #c5a36a;
  opacity: 0.7;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: right;
}

.hs-result-arrow {
  width: 14px;
  height: 14px;
  color: rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
  transition: color 0.12s, transform 0.15s;
}

.hs-result:hover .hs-result-arrow,
.hs-result.hs-active .hs-result-arrow {
  color: #c5a36a;
  transform: translateX(2px);
}

/* ─── Lightbox ──────────────────────────────────────── */
.hs-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 0.25s ease;
  cursor: pointer;
}

.hs-lightbox.hs-lb-active {
  opacity: 1;
}

.hs-lightbox-content {
  max-width: 85vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: default;
}

.hs-lightbox-img {
  max-width: 85vw;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

.hs-lightbox-info {
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
}

.hs-lightbox-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.hs-lightbox-link {
  font-size: 12px;
  color: #c5a36a;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.hs-lightbox-link:hover {
  opacity: 1;
  text-decoration: underline;
}

/* ─── Empty / Loading ───────────────────────────────── */
.hs-empty {
  padding: 24px 18px;
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
  font-size: 13px;
}

.hs-loading {
  padding: 20px;
  display: flex;
  justify-content: center;
}

.hs-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-top-color: #c5a36a;
  border-radius: 50%;
  animation: hs-spin 0.6s linear infinite;
}

@keyframes hs-spin {
  to { transform: rotate(360deg); }
}

/* ─── Mobile ────────────────────────────────────────── */
@media (max-width: 640px) {
  #hanak-search-container {
    right: 12px;
    bottom: 12px;
  }

  #hanak-search-trigger {
    bottom: 16px;
    right: 16px;
  }

  #hanak-search-trigger.hs-expanded {
    width: calc(100vw - 32px);
  }

  .hs-bar,
  .hs-results-panel {
    width: calc(100vw - 24px);
  }

  .hs-results-panel.has-results {
    max-height: 320px;
  }

  .hs-lightbox-img {
    max-width: 95vw;
    max-height: 65vh;
  }
}
