/* Dış kutu */
#ai-ref-search-root {
  max-width: 640px;
  margin: 2rem auto;
  padding: 1rem;
  background: #f1f3f6;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

/* Form çerçevesi */
.ai-ref-search-form {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: #ffffff;
  border-radius: 6px;
  border: 3px solid #004a8f;
  /* overflow: hidden;  <-- BU SATIRI SİLİN! Bu satır kutuyu kesiyordu. */
  position: relative; /* Bunu ekleyin */
  z-index: 10;        /* Bunu ekleyin */
}

/* Input */
.ai-ref-search-input {
  flex: 1;
  border: none;
  padding: 0.6rem 0.9rem;
  font-size: 0.95rem;
  background: #fdfdfd;
  outline: none;
}

.ai-ref-search-input::placeholder {
  color: #999;
  font-size: 0.9rem;
}

/* Buton */
.ai-ref-search-button {
  border: none;
  padding: 0 1.1rem;
  background: #0048b3;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.05s ease;
}

.ai-ref-search-button-icon {
  font-size: 1rem;
  line-height: 1;
}

.ai-ref-search-button:hover {
  background: #00378a;
}

.ai-ref-search-button:active {
  transform: scale(0.97);
}

/* Bilgi satırı */
.ai-ref-search-info {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: #444;
}

/* Sonuç listesi */
.ai-ref-search-results {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.ai-ref-search-item {
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
  background: #ffffff;
  border: 1px solid #e2e5ea;
}

.ai-ref-search-item--locked {
  background: #f7f8fb;
  border-style: dashed;
}

.ai-ref-search-item-heading {
  font-weight: 600;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ai-ref-search-item-heading a {
  text-decoration: none;
  color: #0048b3;
}

.ai-ref-search-item-heading a:hover {
  text-decoration: underline;
}

.ai-ref-search-item-snippet {
  font-size: 0.9rem;
  color: #444;
}

.ai-ref-search-lock {
  font-size: 0.9rem;
}

.ai-ref-search-item-cta {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.ai-ref-btn {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  margin-left: 0.25rem;
  border-radius: 4px;
  font-size: 0.8rem;
  text-decoration: none;
}

.ai-ref-btn--outline {
  border: 1px solid #555;
  color: #333;
  background: transparent;
}

.ai-ref-btn--primary {
  background: #0048b3;
  color: #fff;
}

/* Loading / hata / boş mesajları */
.ai-ref-search-loading,
.ai-ref-search-error,
.ai-ref-search-empty {
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

/* Mobil küçük ekran uyumu */
@media (max-width: 480px) {
  #ai-ref-search-root {
    margin: 1.5rem 0;
    padding: 0.75rem;
  }

  .ai-ref-search-form {
    border-width: 2px;
  }

  .ai-ref-search-button {
    padding: 0 0.85rem;
  }
}

/* ... (Mevcut CSS kodların yukarıda kalsın) ... */

/* --- YENİ EKLENEN AUTOCOMPLETE STİLLERİ --- */

/* Form çerçevesi */
.ai-ref-search-form {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: #ffffff;
  border-radius: 6px;
  border: 3px solid #004a8f;
  
  /* overflow: hidden;  <-- SİLDİK */
  overflow: visible !important; /* Bunu ekle ki menü aşağı taşabilsin */
  position: relative; /* Menünün buna tutunması için şart */
  z-index: 1000; /* Diğer elemanların üstünde kalsın */
}

/* Sonuçların listelendiği açılır kutu */
.suggestions-box {
    position: absolute;
    top: 100%; /* Inputun tam altına yapış */
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #004a8f; /* Form ile aynı renk sınır */
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 9999; /* Her şeyin üstünde dursun */
    max-height: 300px;
    overflow-y: auto;
    display: none; /* Varsayılan gizli */
}

/* Tekil sonuç satırları */
.suggestion-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: #f1f7ff; /* Üzerine gelince açık mavi */
    color: #0048b3;
    padding-left: 20px; /* Hafif sağa kayma efekti */
}

.suggestion-item strong {
    font-weight: 600;
}

/* Mobilde taşmayı önle */
@media (max-width: 480px) {
    .suggestions-box {
        max-height: 250px;
    }
}

/* ÖNERİ KUTUSU STİLLERİ */
.ai-ref-search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #004a8f;
  border-top: none;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  z-index: 1000;
  display: none; /* Varsayılan olarak gizli */
  max-height: 250px;
  overflow-y: auto;
}

/* Öneri kutusu aktifken */
.ai-ref-search-suggestions.active {
  display: block;
}

/* Tekil öneri satırı */
.ai-ref-suggestion-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #333;
  border-bottom: 1px solid #f1f1f1;
}

.ai-ref-suggestion-item:last-child {
  border-bottom: none;
}

.ai-ref-suggestion-item:hover {
  background-color: #f0f4ff;
  color: #0048b3;
}

/* --- YENİ YÜKLEME ALANI (Gecikme Hissini Azaltır) --- */

.ai-ref-search-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 2rem;
    min-height: 100px; /* Görünüm için minimum yükseklik */
    color: #0048b3;
    font-size: 1rem;
}

.ai-ref-search-loading-text {
    margin-top: 0.8rem;
    font-style: italic;
    font-weight: 500;
}

/* Yüklenme Çarkı (Spinner) */
.ai-ref-search-spinner {
    border: 4px solid #f3f3f3; /* Açık gri */
    border-top: 4px solid #0048b3; /* Mavi */
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite; /* Animasyonu uygula */
}

/* Animasyon Tanımı */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Eski yükleme mesajını kullanmayacağımız için gizle/silin */
.ai-ref-search-loading {
    display: none; 
}

/* ============================================
   AI-REF SEARCH - KİLİTLİ İÇERİK ÖNİZLEME STİLLERİ
   Bu CSS'i mevcut stillerinize ekleyin
   ============================================ */

/* Kilitli içerik kartı */
.ai-ref-search-item--locked {
  position: relative;
  border: 1px solid #e5e7eb;
  border-left: 4px solid #d4a853; /* Altın rengi vurgu */
  background: linear-gradient(to bottom, #ffffff, #fafafa);
}

/* Kilitli başlık stili */
.ai-ref-locked-heading {
  color: #6b7280;
  font-weight: 600;
}

/* Önizleme snippet container */
.ai-ref-snippet-preview {
  position: relative;
  max-height: 100px; /* ~3-4 satır */
  overflow: hidden;
  padding-bottom: 20px;
}

/* Fade efekti - içeriğin altında beyazdan şeffafa geçiş */
.ai-ref-snippet-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.8) 50%,
    rgba(255, 255, 255, 1) 100%
  );
  pointer-events: none;
}

/* Kilitli kartlarda fade arka planı */
.ai-ref-search-item--locked .ai-ref-snippet-fade {
  background: linear-gradient(
    to bottom,
    rgba(250, 250, 250, 0) 0%,
    rgba(250, 250, 250, 0.8) 50%,
    rgba(250, 250, 250, 1) 100%
  );
}

/* CTA (Call-to-Action) Bölümü */
.ai-ref-search-item-cta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  margin-top: 8px;
  background: linear-gradient(135deg, #fef9e7 0%, #fdf6e3 100%);
  border-radius: 8px;
  font-size: 14px;
  color: #666;
  border: 1px solid #f0e6c8;
}

.ai-ref-cta-icon {
  font-size: 18px;
}

.ai-ref-cta-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.ai-ref-cta-link:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

/* Birincil CTA butonu (Üye Ol) */
.ai-ref-cta-primary {
  background: linear-gradient(135deg, #d4a853 0%, #c9952e 100%);
  color: white !important;
  padding: 6px 16px;
  border-radius: 6px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(201, 149, 46, 0.3);
  transition: all 0.2s;
}

.ai-ref-cta-primary:hover {
  background: linear-gradient(135deg, #c9952e 0%, #b8841d 100%);
  text-decoration: none !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(201, 149, 46, 0.4);
}

/* ============================================
   BONUS: Sosyal Kanıt ve İstatistik Rozeti
   (İleride kullanmak için)
   ============================================ */

.ai-ref-item-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: #888;
  margin-top: 8px;
}

.ai-ref-stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ai-ref-stat-badge svg {
  width: 14px;
  height: 14px;
}

/* Premium içerik rozeti */
.ai-ref-premium-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #d4a853, #c9952e);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
}

/* ============================================
   RESPONSIVE DÜZENLEMELER
   ============================================ */

@media (max-width: 640px) {
  .ai-ref-search-item-cta {
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
  }
  
  .ai-ref-cta-primary {
    width: 100%;
    text-align: center;
    margin-top: 8px;
  }
  
  .ai-ref-snippet-preview {
    max-height: 80px;
  }
}
