/* KAV Website — search-bar.css */

:root {
  --search-navy: #1a3a5c;
  --search-gold: #c8962e;
  --search-gold-lt: rgba(200, 150, 46, 0.12);
  --search-border: #e2e8f0;
  --search-bg-hover: #f8fafc;
  --search-text: #1e293b;
  --search-muted: #64748b;
  --search-radius: 12px;
}

/* ── Sayfa İçi Arama Çubuğu Sarmalayıcısı ───────────────────────── */
.search-bar-wrapper {
  width: min(100%, 820px);
  margin: 24px auto 32px;
  padding: 0 16px;
}

.search-bar-box {
  background: #ffffff;
  border: 1px solid var(--search-border);
  border-radius: var(--search-radius);
  box-shadow: 0 4px 20px rgba(26, 58, 92, 0.08);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-bar-box:focus-within {
  border-color: var(--search-gold);
  box-shadow: 0 6px 24px rgba(200, 150, 46, 0.18);
}

.search-bar-icon {
  width: 20px;
  height: 20px;
  stroke: var(--search-muted);
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

.search-bar-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: var(--search-text);
  outline: none;
  padding: 8px 0;
  font-family: inherit;
}

.search-bar-input::placeholder {
  color: #94a3b8;
}

/* ── Header Arama Butonu (Büyüteç) ───────────────────────── */
.search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: transparent;
  color: var(--navy, #1a3a5c);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
  margin-right: 4px;
}

.search-toggle:hover,
.search-toggle:focus-visible {
  color: var(--gold, #c8962e);
  background: rgba(26, 58, 92, 0.06);
  border-color: rgba(26, 58, 92, 0.1);
}

.search-toggle svg,
.search-close svg {
  width: 19px;
  height: 19px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Modal Overlay ────────────────────────────────────────── */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 16px 24px;
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.search-overlay.is-open {
  display: flex;
  opacity: 1;
}

/* ── Arama Paneli (Modal Dialog) ─────────────────────────── */
.search-panel {
  width: min(100%, 720px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 24px 48px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(26, 58, 92, 0.08);
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 100px);
  animation: searchPanelSlide 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes searchPanelSlide {
  from {
    opacity: 0;
    transform: translateY(-16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.search-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--search-border);
}

.search-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--search-navy);
  letter-spacing: 0.02em;
}

.search-panel-title svg {
  width: 16px;
  height: 16px;
  stroke: var(--search-gold);
  fill: none;
  stroke-width: 2.2;
}

.search-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  color: var(--search-muted);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
}

.search-close:hover,
.search-close:focus-visible {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
}

/* ── Arama Giriş Alanı (Input Container) ───────────────────── */
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1.5px solid var(--search-border);
  border-radius: 12px;
  padding: 0 14px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.search-input-wrapper:focus-within {
  border-color: var(--search-navy);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(26, 58, 92, 0.1);
}

.search-input-wrapper svg {
  width: 18px;
  height: 18px;
  stroke: var(--search-muted);
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
  margin-right: 10px;
}

.search-input-wrapper input {
  width: 100%;
  padding: 12px 0;
  border: none;
  background: transparent;
  font-size: 1.05rem;
  color: var(--search-text);
  outline: none;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}

/* Tarayıcının varsayılan 'x' (temizle) butonunu gizle */
.search-input-wrapper input::-webkit-search-decoration,
.search-input-wrapper input::-webkit-search-cancel-button,
.search-input-wrapper input::-webkit-search-results-button,
.search-input-wrapper input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  display: none;
}

.search-input-wrapper input::-ms-clear,
.search-input-wrapper input::-ms-reveal {
  display: none;
  width: 0;
  height: 0;
}

.search-clear-btn {
  background: transparent;
  border: none;
  color: var(--search-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.search-clear-btn:hover {
  color: var(--search-text);
}

.search-clear-btn svg {
  width: 14px;
  height: 14px;
  margin: 0;
}

/* ── Arama Sonuçları Listesi ───────────────────────────────── */
.search-results {
  margin-top: 14px;
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
}

.search-results::-webkit-scrollbar {
  width: 6px;
}
.search-results::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
.search-results::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.search-meta-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
  font-size: 0.82rem;
  color: var(--search-muted);
  font-weight: 500;
}

.search-result-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-result-item {
  display: block;
}

.search-result-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.15s ease;
}

.search-result-link:hover,
.search-result-link.is-active,
.search-result-item:focus-within .search-result-link {
  background: var(--search-bg-hover);
  border-color: var(--search-border);
  transform: translateX(2px);
}

.search-result-link:focus-visible {
  outline: none;
  border-color: var(--search-gold);
  background: var(--search-bg-hover);
}

.search-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.search-item-title {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--search-navy);
  line-height: 1.35;
}

.search-result-link:hover .search-item-title,
.search-result-link.is-active .search-item-title {
  color: var(--search-gold);
}

/* ── Kategori Rozetleri (Badges) ───────────────────────────── */
.search-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-kurumsal { background: #e0e7ff; color: #3730a3; }
.badge-arastirmalar, .badge-arastirma { background: #e0f2fe; color: #0369a1; }
.badge-projeler, .badge-proje, .badge-proje-detay, .badge-proje-hub { background: #fef3c7; color: #92400e; }
.badge-yayinlar, .badge-yayin-hub, .badge-raporlar, .badge-akademik, .badge-politika-notu, .badge-bulten { background: #fce7f3; color: #9d174d; }
.badge-pdf-indir { background: #fee2e2; color: #991b1b; }
.badge-faaliyetler, .badge-faaliyet-hub, .badge-egitim, .badge-etkinlik, .badge-etkinlik-detay, .badge-egitim-detay { background: #ecfdf5; color: #065f46; }
.badge-gundem, .badge-haberler, .badge-haber-detay, .badge-duyurular, .badge-blog { background: #f1f5f9; color: #334155; }
.badge-katilim, .badge-kariyer, .badge-staj, .badge-is-ilani, .badge-proje-onerisi { background: #f3e8ff; color: #6b21a8; }
.badge-genel, .badge-iletisim { background: #f1f5f9; color: #1a3a5c; }

.search-item-desc {
  font-size: 0.84rem;
  color: var(--search-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-item-url {
  font-size: 0.74rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Eşleşme Vurgusu (Highlight) ──────────────────────────── */
mark.search-mark {
  background: #fef08a;
  color: #854d0e;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 700;
}

/* ── Hızlı Bağlantılar & Boş Durum ────────────────────────── */
.search-quick-links-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--search-muted);
  margin-bottom: 8px;
}

.search-quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.search-quick-tag {
  font-size: 0.82rem;
  padding: 5px 10px;
  background: #f1f5f9;
  color: var(--search-navy);
  border-radius: 6px;
  border: 1px solid var(--search-border);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.search-quick-tag:hover {
  background: var(--search-navy);
  color: #ffffff;
  border-color: var(--search-navy);
}

.search-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--search-muted);
  font-size: 0.92rem;
}

.search-empty svg {
  width: 36px;
  height: 36px;
  stroke: #cbd5e1;
  fill: none;
  stroke-width: 1.5;
  margin: 0 auto 8px;
  display: block;
}

.search-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--search-border);
  font-size: 0.76rem;
  color: #94a3b8;
}

.search-shortcuts {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-shortcut-item kbd {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.72rem;
  color: #475569;
  font-family: inherit;
}

/* ── Mobil Uyumluluk ───────────────────────────────────────── */
@media (max-width: 768px) {
  .search-overlay {
    padding: 30px 12px 16px;
    align-items: flex-start;
  }

  .search-panel {
    width: 100%;
    max-height: calc(100vh - 40px);
    padding: 14px 14px 12px;
    border-radius: 14px;
  }

  .search-shortcuts {
    display: none;
  }
}
