/* ==========================================================================
   AI Ansible - Global Site Search System (Hugo & Cloudflare Pages Compliant)
   Cross-Indexes index.html and tutorial.html with Instant Edge Response
   ========================================================================== */

/* Navigation Search Trigger Button (Header) */
.search-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #F8FAFC;
  border: 1.5px solid #CBD5E1; /* Clearly visible border on light header */
  border-radius: var(--radius-full, 9999px);
  padding: 7px 15px;
  color: #1A3C6E; /* Dark Orchestration Blue font - high contrast */
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  outline: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.search-trigger-btn svg {
  color: #008080; /* Innovation Teal icon */
  flex-shrink: 0;
}

.search-trigger-btn:hover {
  background: #E6F6F6;
  border-color: #008080;
  color: #008080;
  box-shadow: 0 3px 14px rgba(0, 128, 128, 0.22);
  transform: translateY(-1px);
}

.search-key-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.72rem;
  font-family: var(--font-mono, monospace);
  color: #475569;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* Hero Search Trigger Bar (Home Page) */
.hero-search-wrapper {
  margin-top: 24px;
  margin-bottom: 8px;
  max-width: 580px;
  width: 100%;
}

.hero-search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #FFFFFF; /* High-contrast white card on light hero */
  border: 2px solid #008080; /* Bold, highly visible Innovation Teal border */
  border-radius: var(--radius-md, 14px);
  padding: 14px 20px;
  color: #0F172A;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 30px rgba(26, 60, 110, 0.12), 0 2px 8px rgba(0, 128, 128, 0.1);
}

.hero-search-bar svg {
  color: #008080;
  flex-shrink: 0;
}

.hero-search-bar:hover {
  border-color: #005A5A;
  background: #FFFFFF;
  box-shadow: 0 12px 36px rgba(0, 128, 128, 0.25);
  transform: translateY(-2px);
}

.hero-search-placeholder {
  flex: 1;
  font-size: 1rem;
  color: #0F172A !important; /* Bold, deep charcoal/navy font - 100% visible */
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-body, sans-serif);
}

.hero-search-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  color: #475569;
  font-family: var(--font-mono, monospace);
  font-weight: 600;
}

.hero-search-hint kbd {
  background: #F1F5F9;
  border: 1.5px solid #CBD5E1;
  border-radius: 4px;
  padding: 2px 6px;
  color: #1A3C6E;
  font-weight: 700;
}

/* Search Modal Backdrop */
.search-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(4, 9, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 20px 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.search-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Search Modal Container */
.search-modal-container {
  width: 100%;
  max-width: 680px;
  background: #0B1528;
  border: 1.5px solid rgba(0, 128, 128, 0.5);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 35px rgba(0, 128, 128, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(-16px) scale(0.98);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-modal-backdrop.active .search-modal-container {
  transform: translateY(0) scale(1);
}

/* Search Header */
.search-modal-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  gap: 12px;
  background: rgba(13, 27, 51, 0.65);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  background: rgba(13, 27, 51, 0.85);
  border: 2px solid #00a8a8; /* Bold teal border on modal input field */
  border-radius: 10px;
  padding: 8px 14px;
  box-shadow: 0 0 14px rgba(0, 128, 128, 0.25);
}

.search-input-icon {
  color: #00a8a8;
  flex-shrink: 0;
}

.search-input-field {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-size: 1.15rem;
  color: #FFFFFF !important; /* Always high-contrast white */
  font-family: var(--font-heading, 'Montserrat', sans-serif);
  font-weight: 600;
}

.search-input-field::placeholder {
  color: #94A3B8;
  font-weight: 400;
}

.search-clear-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #CBD5E1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-clear-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

.search-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  color: #CBD5E1;
  font-family: var(--font-mono, monospace);
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.search-close-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.35);
}

/* Scope Filters Ribbon */
.search-modal-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(6, 12, 23, 0.75);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  overflow-x: auto;
}

.search-filter-tag {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full, 9999px);
  padding: 5px 13px;
  color: #CBD5E1;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  font-family: inherit;
}

.search-filter-tag:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.3);
}

.search-filter-tag.active {
  background: rgba(0, 128, 128, 0.3);
  color: #4DD0E1;
  border-color: #008080;
  box-shadow: 0 0 10px rgba(0, 128, 128, 0.25);
}

/* Results Body */
.search-modal-body {
  max-height: 440px;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-modal-body::-webkit-scrollbar {
  width: 6px;
}

.search-modal-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.search-modal-body::-webkit-scrollbar-thumb {
  background: rgba(0, 128, 128, 0.45);
  border-radius: 3px;
}

.search-results-lead {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 8px 8px;
}

.search-results-lead span {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #94A3B8;
  font-family: var(--font-mono, monospace);
}

/* Result Item Card */
.search-result-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
}

.search-result-item:hover,
.search-result-item.keyboard-active {
  background: rgba(0, 128, 128, 0.16);
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.2);
  transform: translateX(4px);
}

.search-result-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-source-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.search-category-text {
  font-size: 0.78rem;
  color: #CBD5E1;
  font-family: var(--font-mono, monospace);
  font-weight: 500;
}

.search-result-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.35;
  font-family: var(--font-heading, 'Montserrat', sans-serif);
}

.search-result-snippet {
  font-size: 0.88rem;
  color: #E2E8F0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Green Highlight Effect for Selected / Matched Query Terms */
.search-matched-text {
  background: rgba(16, 185, 129, 0.25);
  color: #10B981;
  border-bottom: 1.5px solid #10B981;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
}

.search-result-action {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #00a8a8;
  margin-top: 4px;
  opacity: 0.9;
}

.search-result-item:hover .search-result-action,
.search-result-item.keyboard-active .search-result-action {
  opacity: 1;
  color: #10B981;
}

/* Empty State */
.search-empty-state {
  text-align: center;
  padding: 36px 20px;
}

.search-empty-icon {
  font-size: 2.2rem;
  margin-bottom: 12px;
}

.search-empty-state h4 {
  color: #F8FAFC;
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.search-empty-state p {
  color: #CBD5E1;
  font-size: 0.9rem;
  line-height: 1.55;
  max-width: 440px;
  margin: 0 auto 18px;
}

.search-quick-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.quick-suggest-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-full, 9999px);
  padding: 5px 14px;
  color: #F1F5F9;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.quick-suggest-btn:hover {
  background: rgba(0, 128, 128, 0.3);
  border-color: #10B981;
  color: #10B981;
}

/* Footer Hints */
.search-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(6, 12, 23, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.76rem;
  color: #94A3B8;
}

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

.mini-kbd {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.68rem;
  font-family: var(--font-mono, monospace);
  color: #CBD5E1;
  margin-right: 3px;
}

.search-edge-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #10B981;
  font-weight: 600;
  font-size: 0.74rem;
}

/* ==========================================================================
   Card Navigation Anchors & Pulse Animation
   ========================================================================== */
.glossary-exec-card {
  scroll-margin-top: 110px;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.chapter-slide {
  scroll-margin-top: 120px;
}

@keyframes targetGlowPulse {
  0% {
    box-shadow: 0 0 0 rgba(16, 185, 129, 0);
    border-color: rgba(0, 168, 168, 0.2);
  }
  25% {
    box-shadow: 0 0 35px rgba(16, 185, 129, 0.75), inset 0 0 20px rgba(0, 128, 128, 0.3);
    border-color: #10B981;
    transform: scale(1.025);
  }
  75% {
    box-shadow: 0 0 22px rgba(16, 185, 129, 0.5);
    border-color: #10B981;
    transform: scale(1.01);
  }
  100% {
    box-shadow: 0 8px 24px rgba(26, 60, 110, 0.08);
    border-color: var(--border-light, #E2E8F0);
    transform: scale(1);
  }
}

.card-target-highlight {
  animation: targetGlowPulse 2.4s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@media (max-width: 640px) {
  .search-modal-backdrop {
    padding: 20px 12px;
  }
  .search-modal-container {
    max-height: 90vh;
  }
  .search-shortcut-hints span:nth-child(n+2) {
    display: none;
  }
  .hero-search-wrapper {
    max-width: 100%;
  }
  .hero-search-hint {
    display: none;
  }
}
