/* ============================================
   Search UI Styles
   Overlay, results, keyframes for bilingual search
   Active when Unit 2 wiring is in place.
   ============================================ */

/* ===== Keyframes ===== */

/* ===== Reduced Motion Override ===== */
html[data-motion="reduce"] .search-dots span {
  animation: none !important;
}

html[data-motion="reduce"] .search-overlay {
  animation: none !important;
}

html[data-motion="reduce"] .search-overlay.fade-out {
  animation: none !important;
  opacity: 0;
}

html[data-motion="reduce"] .search-result-card {
  animation: none !important;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes overlayFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; pointer-events: none; }
}

@keyframes dotPop {
  0%   { transform: scale(0); opacity: 0; }
  50%  { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes resultCardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Search Toggle Button (in nav) ===== */

.search-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--bwhite, #8e9297);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  border-radius: 8px;
}

.search-toggle:hover {
  color: var(--accent, #4cc9f0);
  background: var(--mdgray, #2f3136);
}

/* ===== Search Overlay ===== */

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--search-overlay-z, 1001);
  background: var(--search-overlay-bg, rgba(15, 15, 25, 0.92));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 100px 24px 60px;
  animation: overlayFadeIn 0.3s ease;
}

.search-overlay.fade-out {
  animation: overlayFadeOut 0.3s ease forwards;
}

/* ===== Search Input (expanded) ===== */

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 500px;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  background: var(--dkgray, #202225);
  color: var(--twhite, #dcddde);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.search-input:focus {
  border-color: var(--accent, #4cc9f0);
}

.search-input::placeholder {
  color: var(--bwhite, #8e9297);
}

/* ===== Search Dots Animation ===== */

.search-dots {
  display: flex;
  gap: 10px;
  margin-top: 28px;
}

.search-dots span {
  width: 14px;
  height: 14px;
  background: var(--accent, #4cc9f0);
  border-radius: 50%;
  animation: dotPop 0.6s ease infinite alternate;
}

.search-dots span:nth-child(1) { animation-delay: 0s; }
.search-dots span:nth-child(2) { animation-delay: 0.2s; }
.search-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ===== Inline Dropdown (below nav input) ===== */

.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--dkgray, #202225);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  max-height: 320px;
  overflow-y: auto;
  z-index: 1002;
}

.search-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--twhite, #dcddde);
  text-decoration: none;
  transition: background 0.15s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

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

.search-dropdown-item:hover {
  background: var(--mdgray, #2f3136);
}

.search-dropdown-item .search-dd-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.search-dropdown-item .search-dd-url {
  font-size: 0.75rem;
  color: var(--bwhite, #8e9297);
  margin-left: auto;
}

.search-dropdown-more {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--accent, #4cc9f0);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease;
}

.search-dropdown-more:hover {
  background: var(--accent-dim, rgba(76, 201, 240, 0.08));
}

/* ===== Results View (full page replacement) ===== */

.search-results-view {
  max-width: 700px;
  margin: 0 auto;
  padding: 80px 24px 24px;
}

.search-results-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
  text-align: center;
}

.search-result-card {
  background: var(--dkgray, #202225);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  animation: resultCardIn 0.4s ease both;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.search-result-card:hover {
  border-color: rgba(76, 201, 240, 0.2);
  transform: translateY(-2px);
}

.search-result-card:nth-child(1) { animation-delay: 0s; }
.search-result-card:nth-child(2) { animation-delay: 0.1s; }
.search-result-card:nth-child(3) { animation-delay: 0.2s; }
.search-result-card:nth-child(4) { animation-delay: 0.3s; }
.search-result-card:nth-child(5) { animation-delay: 0.4s; }

.search-result-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent, #4cc9f0);
  text-decoration: none;
  display: block;
  margin-bottom: 4px;
}

.search-result-title:hover {
  text-decoration: underline;
}

.search-result-url {
  font-size: 0.8rem;
  color: var(--bwhite, #8e9297);
  margin-bottom: 8px;
}

.search-result-desc {
  font-size: 0.9rem;
  color: var(--bwhite, #8e9297);
  line-height: 1.5;
}

/* ===== No Results ===== */

.search-no-results {
  text-align: center;
  color: var(--bwhite, #8e9297);
  font-size: 1.1rem;
  padding: 60px 24px;
}

.search-no-results-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

/* ===== Clear / Action Buttons ===== */

.search-clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 8px;
  background: transparent;
  color: var(--bwhite, #8e9297);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 32px;
  transition: all 0.2s ease;
}

.search-clear-btn:hover {
  border-color: var(--accent, #4cc9f0);
  color: var(--accent, #4cc9f0);
  transform: translateY(-1px);
}

.search-show-more-btn {
  display: block;
  margin: 20px auto 0;
  padding: 10px 28px;
  border-radius: 8px;
  background: var(--accent-dim, rgba(76, 201, 240, 0.12));
  color: var(--accent, #4cc9f0);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.search-show-more-btn:hover {
  background: var(--accent, #4cc9f0);
  color: #0a0a0a;
}

/* ===== Responsive Tweak ===== */

@media (max-width: 768px) {
  .search-overlay {
    padding: 80px 16px 40px;
  }

  .search-toggle {
    padding: 6px;
  }

  .search-dropdown {
    position: fixed;
    top: auto;
    left: 12px;
    right: 12px;
    max-height: 50vh;
  }
}
