/* Krishna Sanskrit: Devanagari with Vedic accents + Gentium Latin for transliteration.
   SIL Open Font License 1.1. https://taittiriya.com/#font */
@font-face {
    font-family: 'Krishna Sanskrit';
    src: url('/css/fonts/KrishnaSanskrit-Regular.woff2?v=e557a75ff6') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: block;
    unicode-range: U+0000-036F, U+0900-097F, U+1AB0-1AFF, U+1CD0-1CFF, U+1D00-1EFF, U+2000-206F,
                   U+20A0-20C0, U+2122, U+2212, U+25CC, U+2C60-2C7F, U+A720-A7FF, U+A8E0-A8FF, U+AB30-AB6F;
}

/**
 * Veda Search v2 Styles
 * Beautiful portal-style search bar with v2 functionality
 * Matches the aesthetic of veda-portal.css
 */

/* CSS Variables for consistency */
:root {
  --search-accent-gold: #d4af37;
  --search-parchment: #fdfbf7;
  --search-ink-dark: #1a1a1a;
  --search-ink-light: #8b7355;
  --neu-shadow-light: rgba(255, 255, 255, 0.8);
  --neu-shadow-dark: rgba(46, 42, 38, 0.12);
  --neu-inset-light: rgba(255, 255, 255, 0.6);
  --neu-inset-dark: rgba(46, 42, 38, 0.08);
}

.veda-search-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  max-width: 600px;
  width: 90%;
}

.search-wrapper {
  position: relative;
  width: 100%;
}

.search-input-group {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.75rem 1.25rem;
  padding-right: 3.5rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 25px;
  font-size: 1.1rem;
  background: linear-gradient(135deg, 
    rgba(253, 251, 247, 0.95) 0%, 
    rgba(255, 255, 255, 0.85) 100%);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  box-shadow: 
    10px 10px 20px var(--neu-shadow-dark),
    -10px -10px 20px var(--neu-shadow-light),
    inset 3px 3px 6px var(--neu-inset-light),
    inset -3px -3px 6px var(--neu-inset-dark);
}

.search-input-group:focus-within {
  border-color: var(--search-accent-gold);
  background: linear-gradient(135deg, 
    rgba(253, 251, 247, 0.98) 0%, 
    rgba(255, 255, 255, 0.95) 100%);
  box-shadow: 
    4px 4px 8px var(--neu-shadow-dark),
    -4px -4px 8px var(--neu-shadow-light),
    inset 1px 1px 2px var(--neu-inset-light),
    inset -1px -1px 2px var(--neu-inset-dark),
    0 0 0 2px rgba(212, 175, 55, 0.2);
  transform: scale(1.02);
}

.search-filter {
  border: none;
  background: transparent;
  padding: 0.25rem 0.5rem;
  padding-right: 0.75rem;
  font-size: 0.9rem;
  color: var(--search-ink-light);
  cursor: pointer;
  border-right: 1px solid rgba(139, 115, 85, 0.2);
  margin-right: 0.75rem;
  font-weight: 500;
  font-family: 'Georgia', 'Times New Roman', 'Krishna Sanskrit', serif;
}

.search-filter:focus {
  outline: none;
}

.search-input {
  flex: 1;
  border: none;
  padding: 0;
  font-size: 1.1rem;
  background: transparent;
  color: var(--search-ink-dark);
  font-family: 'Georgia', 'Times New Roman', 'Krishna Sanskrit', serif;
}

.search-input:focus {
  outline: none;
}

.search-input::placeholder {
  color: var(--search-ink-light);
}

.search-icon {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: transparent;
  border: 2px solid var(--search-accent-gold);
  border-radius: 50%;
  font-size: 1rem;
  color: var(--search-accent-gold);
  cursor: pointer;
  z-index: 10;
  box-shadow:
    2px 2px 4px var(--neu-shadow-dark),
    -2px -2px 4px var(--neu-shadow-light);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-icon:hover {
  transform: translateY(-50%) scale(1.1);
  background: var(--search-accent-gold);
  color: white;
  box-shadow: 
    6px 6px 12px var(--neu-shadow-dark),
    -6px -6px 12px var(--neu-shadow-light);
}

.search-icon:active {
  transform: translateY(-50%) scale(0.95);
}

/* Dropdown */
.search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: linear-gradient(135deg, 
    rgba(253, 251, 247, 0.98) 0%, 
    rgba(255, 255, 255, 0.95) 100%);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 16px;
  box-shadow: 
    10px 10px 20px var(--neu-shadow-dark),
    -10px -10px 20px var(--neu-shadow-light);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1001;
}

/* Search Results */
.search-result {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.search-result:last-child {
  border-bottom: none;
  border-radius: 0 0 16px 16px;
}

.search-result:only-child {
  border-radius: 16px;
}

.search-result:hover,
.search-result.focused {
  background: rgba(212, 175, 55, 0.08);
}

.search-result.no-results {
  color: var(--search-ink-light);
  text-align: center;
  cursor: default;
  font-style: italic;
}

.search-result.no-results:hover {
  background: transparent;
}

/* Result Header */
.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}

.result-title {
  font-weight: 600;
  color: var(--search-accent-gold);
  font-size: 0.95rem;
}

.result-ref {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Krishna Sanskrit', monospace;
  font-size: 0.85rem;
  color: var(--search-ink-light);
  font-weight: 500;
}

.result-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.result-badge.corpus-samhita {
  background: #e8f4e8;
  color: #2d6a2d;
}

.result-badge.corpus-brahmana {
  background: #e8e8f4;
  color: #4a4a8a;
}

.result-badge.corpus-aranyaka {
  background: #fff3e0;
  color: #8b5a2b;
}

.result-badge.corpus-kathakam {
  background: #e0f4f1;
  color: #2d6a5a;
}

.result-badge.corpus-ekagnikandam {
  background: #f4e0e4;
  color: #6a2d4a;
}

.result-badge.corpus-suktani {
  background: #fce4ec;
  color: #880e4f;
}

/* Corpus badges for reference results */
.result-badge-samhita {
  background: #2d6a2d;
  color: white;
}

.result-badge-brahmana {
  background: #4a4a8a;
  color: white;
}

.result-badge-aranyaka {
  background: #8b5a2b;
  color: white;
}

/* Reference jump result */
.reference-result {
  background: rgba(212, 175, 55, 0.05);
  border-left: 3px solid var(--search-accent-gold);
}

.reference-result .result-badge {
  background: var(--search-accent-gold);
  color: white;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Patha links inside reference results (Samhita → Pada/Krama navigation) */
.ref-patha-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px dashed rgba(139, 90, 43, 0.2);
}

.ref-patha-link {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: #6b4226;
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.25);
  font-family: var(--veda-font-primary, 'Noto Serif Devanagari', serif);
}

.ref-patha-link:hover {
  background: rgba(139, 90, 43, 0.85);
  color: white;
  border-color: rgba(139, 90, 43, 0.85);
}

.ref-patha-sep {
  color: rgba(139, 90, 43, 0.25);
  font-size: 0.75rem;
  user-select: none;
}

/* Result Content */
.result-location {
  font-size: 0.85rem;
  color: var(--search-ink-light);
}

.result-topic {
  font-size: 0.95rem;
  color: var(--search-ink-dark);
  font-style: italic;
}

.result-preview {
  font-size: 0.9rem;
  color: var(--search-ink-dark);
  line-height: 1.4;
  font-family: 'Krishna Sanskrit', 'Siddhanta', 'Noto Serif Devanagari', serif;
  /* Limit to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-topic-small {
  font-size: 0.75rem;
  color: var(--search-ink-light);
  margin-top: 0.25rem;
  font-style: italic;
}

/* Highlight */
.search-result mark {
  background: rgba(212, 175, 55, 0.3);
  padding: 0 0.15em;
  border-radius: 2px;
}

/* Topic result styling */
.topic-result {
  background: linear-gradient(to right, rgba(212, 175, 55, 0.05), transparent);
  border-left: 3px solid var(--search-accent-gold);
}

.topic-result .result-title {
  color: #8B6914;
}

/* Keyboard navigation hint */
.search-input-group::after {
  content: '';
}

/* Mobile responsive */
@media (max-width: 768px) {
  .veda-search-container {
    width: 95%;
    top: 8px;
  }
  
  .search-input-group {
    padding: 0.6rem 1rem;
    padding-right: 3rem;
  }
  
  .search-filter {
    font-size: 0.8rem;
    padding-right: 0.5rem;
    margin-right: 0.5rem;
  }
  
  .search-input {
    font-size: 1rem;
  }
  
  .search-icon {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }
  
  .search-dropdown {
    max-height: 300px;
  }
  
  .result-preview {
    -webkit-line-clamp: 1;
  }
}

/* Print - hide search */
@media print {
  .veda-search-container {
    display: none !important;
  }
}

/* Search highlight on page */
.search-highlight {
  background: linear-gradient(120deg, rgba(212, 175, 55, 0.3) 0%, rgba(212, 175, 55, 0.2) 100%);
  padding: 0.1em 0.2em;
  border-radius: 3px;
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.3);
  animation: highlight-pulse 2s ease-in-out;
}

@keyframes highlight-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(212, 175, 55, 0.15); }
}

/* Anuvaka scroll highlight (when navigating from search reference) */
.search-scroll-highlight {
  background: rgba(212, 175, 55, 0.08);
  border-left: 3px solid rgba(212, 175, 55, 0.6);
  padding-left: 0.5em;
  transition: background 0.5s ease, border-color 0.5s ease;
  animation: scroll-highlight-fade 3s ease-out forwards;
}

/* Pancashati-level highlight (inline span) — use outline instead of border-left */
span.pancashati-text.search-scroll-highlight {
  border-left: none;
  padding-left: 0;
  border-radius: 3px;
  outline: 2px solid rgba(212, 175, 55, 0.6);
  outline-offset: 2px;
  background: rgba(212, 175, 55, 0.12);
  animation: scroll-highlight-fade-inline 3s ease-out forwards;
}

@keyframes scroll-highlight-fade {
  0% { background: rgba(212, 175, 55, 0.15); border-left-color: rgba(212, 175, 55, 0.8); }
  70% { background: rgba(212, 175, 55, 0.08); border-left-color: rgba(212, 175, 55, 0.5); }
  100% { background: transparent; border-left-color: transparent; }
}

@keyframes scroll-highlight-fade-inline {
  0% { background: rgba(212, 175, 55, 0.18); outline-color: rgba(212, 175, 55, 0.8); }
  70% { background: rgba(212, 175, 55, 0.08); outline-color: rgba(212, 175, 55, 0.4); }
  100% { background: transparent; outline-color: transparent; }
}

/* ===========================================
   FULL SEARCH RESULTS PAGE STYLES
   =========================================== */

.veda-search-results-page {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
}

.search-results-overlay {
  width: 100%;
  height: 100%;
  background: rgba(26, 26, 26, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 80px 20px 20px;
  overflow-y: auto;
}

.search-results-modal {
  background: linear-gradient(135deg, 
    rgba(253, 251, 247, 0.98) 0%, 
    rgba(248, 244, 236, 0.98) 100%);
  border-radius: 16px;
  max-width: 900px;
  width: 100%;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  overflow: hidden;
}

.search-results-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(139, 115, 85, 0.15);
  background: rgba(253, 251, 247, 0.5);
}

.search-results-header h2 {
  flex: 1;
  font-family: 'Georgia', 'Times New Roman', 'Krishna Sanskrit', serif;
  font-size: 1.1rem;
  color: var(--search-ink-dark);
  margin: 0;
  font-weight: 400;
}

.search-results-header h2::before {
  content: none;
}

.search-results-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--search-ink-light);
}

.results-count {
  font-weight: 400;
  color: var(--search-ink-light);
}

.results-filter {
  padding: 0.15rem 0.5rem;
  background: rgba(212, 175, 55, 0.12);
  border-radius: 10px;
  font-size: 0.75rem;
  color: var(--search-accent-gold);
  font-weight: 500;
}

.search-results-close {
  width: 36px;
  height: 36px;
  border: none;
  background: linear-gradient(135deg, 
    rgba(139, 115, 85, 0.1) 0%, 
    rgba(139, 115, 85, 0.05) 100%);
  border-radius: 50%;
  font-size: 1.5rem;
  color: var(--search-ink-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
}

.search-results-close:hover {
  background: rgba(212, 175, 55, 0.2);
  color: var(--search-ink-dark);
  transform: scale(1.1);
}

.search-results-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.search-no-results {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--search-ink-light);
  font-size: 1.1rem;
  font-style: italic;
}

/* ===========================================
   GOOGLE-STYLE SEARCH RESULT ITEMS
   =========================================== */

.search-full-result {
  padding: 1.25rem 0;
  margin: 0 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
  border-bottom: 1px solid rgba(139, 115, 85, 0.1);
}

.search-full-result:last-child {
  border-bottom: none;
}

.search-full-result:hover {
  background: rgba(212, 175, 55, 0.04);
  margin-left: 0.5rem;
  margin-right: 0.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  border-radius: 8px;
}

/* URL Breadcrumb - like Google's green URL line */
.result-url-breadcrumb {
  font-family: 'Krishna Sanskrit', 'Siddhanta', 'Noto Serif Devanagari', serif;
  font-size: 0.8rem;
  color: var(--search-ink-light);
  margin-bottom: 0.25rem;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Title row - like Google's blue clickable title */
.result-title-row {
  margin-bottom: 0.35rem;
}

.result-title-link {
  font-family: 'Krishna Sanskrit', 'Siddhanta', 'Noto Serif Devanagari', 'Georgia', serif;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--search-accent-gold);
  line-height: 1.3;
  display: inline;
  transition: color 0.15s ease;
}

.search-full-result:hover .result-title-link {
  color: #b8941f;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Snippet - like Google's description text */
.result-snippet {
  font-family: 'Krishna Sanskrit', 'Siddhanta', 'Noto Serif Devanagari', serif;
  font-size: 0.95rem;
  color: var(--search-ink-dark);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-snippet mark {
  background: linear-gradient(120deg, rgba(212, 175, 55, 0.35) 0%, rgba(212, 175, 55, 0.2) 100%);
  padding: 0.05em 0.15em;
  border-radius: 2px;
  color: inherit;
  font-weight: 600;
}

/* Responsive adjustments for full results page */
@media (max-width: 768px) {
  .search-results-overlay {
    padding: 70px 10px 10px;
  }
  
  .search-results-modal {
    max-height: calc(100vh - 90px);
  }
  
  .search-results-header {
    padding: 1rem 1.25rem;
  }
  
  .search-results-header h2 {
    font-size: 1.15rem;
    width: 100%;
  }
  
  .search-results-meta {
    font-size: 0.8rem;
  }
  
  .search-full-result {
    padding: 1rem 0;
    margin: 0 0.75rem;
  }
  
  .result-url-breadcrumb {
    font-size: 0.75rem;
  }
  
  .result-title-link {
    font-size: 1.05rem;
  }
  
  .result-snippet {
    font-size: 0.9rem;
    -webkit-line-clamp: 2;
  }
}


/* ════════════════════════════════════════════════════════════════
   REDESIGN 2026 LAYER — scholarly modern manuscript (search v2)
   Appended override layer; original rules above untouched.
   ════════════════════════════════════════════════════════════════ */

:root {
  --search-accent-gold: #b8952f;
  --search-parchment: #f9f5ec;
}

/* Search pill on reading pages */
.search-input-group {
  border: 1.5px solid #c9b98e;
  border-radius: 999px;
  background: #fffdf7;
  box-shadow: 0 2px 10px rgba(46, 42, 38, 0.06);
}
.search-input-group:focus-within {
  border-color: #b8952f;
  background: #fffdf7;
  box-shadow: 0 2px 14px rgba(184, 149, 47, 0.18);
}
.search-icon {
  background: #7a2a17;
  border: none;
  color: #f7f0e2;
  border-radius: 50%;
}
.search-icon:hover { background: #5c1a0e; transform: translateY(-50%); }
.search-dropdown {
  border: 1px solid #d8c9a8;
  border-radius: 14px;
  background: #fffdf7;
  box-shadow: 0 14px 44px rgba(46, 42, 38, 0.18);
}
.search-result:hover, .search-result.focused { background: rgba(184, 149, 47, 0.10); }
.result-title { color: #7a2a17; }
.reference-result { background: rgba(122, 42, 23, 0.04); border-left: 3px solid #7a2a17; }
.reference-result .result-badge { background: #7a2a17; }
.ref-patha-link { color: #7a2a17; border-color: #d3b193; }
.ref-patha-link:hover { background: #7a2a17; color: #f7f0e2; }
.search-result mark,
.result-snippet mark { background: rgba(184, 149, 47, 0.28); }
.search-highlight { background: linear-gradient(120deg, rgba(184,149,47,0.32), rgba(184,149,47,0.18)); }
.search-scroll-highlight { background: rgba(184, 149, 47, 0.08); border-left: 3px solid rgba(184, 149, 47, 0.6); }

/* Full results modal */
.search-results-modal {
  background: #f9f5ec;
  border: 1px solid #e2d6b8;
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(20, 12, 6, 0.35);
}
.search-results-header { border-bottom: 1px solid #e2d6b8; }
.results-filter { background: #f2e8cf; color: #8a5a00; }
.result-title-link { color: #7a2a17; }
.search-full-result:hover .result-title-link { color: #5c1a0e; }
.result-url-breadcrumb { color: #8a6a2f; }
.search-results-close { border: 1px solid #d8c9a8; background: #fffdf7; color: #8a6a2f; border-radius: 50%; }
.search-results-close:hover { background: #7a2a17; color: #f7f0e2; }
