/* ==============================
   BUSCA - AUTOCOMPLETE & DROPDOWN
   ============================== */

.nav-search {
  display: flex;
  align-items: center;
  gap: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  transition: all 0.3s ease;
  margin-right: 0;
  flex-shrink: 0;
  position: relative;
}

.nav-search input {
  background: transparent;
  border: none;
  color: #f4f1ea;
  font-family: 'Alice', serif;
  font-size: 15px;
  outline: none;
  padding: 0;
  min-width: 0;
  max-width: 0;
  opacity: 0;
  display: none;
  transition: max-width 0.4s ease, opacity 0.4s ease, padding 0.4s ease;
}

.nav-search.active input {
  display: block;
  max-width: 140px;
  opacity: 1;
  padding: 0.5rem 0.8rem;
}

.nav-search input::placeholder {
  color: rgba(244, 241, 234, 0.6);
}

/* ==============================
   DROPDOWN RESULTS - DESKTOP
   ============================== */

.search-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 100%;
  min-width: 300px;
  max-width: 500px;
  max-height: 0;
  overflow: hidden;
  background: #f4f1ea;
  border: none;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0);
  z-index: 1000;
  transition: max-height 0.3s ease;
  margin-top: 0.5rem;
}

.search-dropdown.active {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid rgba(163, 58, 38, 0.15);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.search-result-item {
  padding: 1rem;
  background: #fff;
  border: 1px solid rgba(163, 58, 38, 0.12);
  border-left: 4px solid var(--cor-terciaria);
  border-radius: 6px;
  margin: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-result-item:hover,
.search-result-item.selected {
  background: #fff;
  border-left-color: var(--cor-primaria);
  box-shadow: 0 4px 12px rgba(163, 58, 38, 0.15);
  transform: translateX(2px);
}

.search-result-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cor-secundaria);
  margin-bottom: 0.3rem;
  font-family: 'Tan', serif;
}

.search-result-title strong {
  color: var(--cor-terciaria);
}

.search-result-snippet {
  font-size: 0.85rem;
  color: var(--texto-principal);
  line-height: 1.4;
  margin-bottom: 0.5rem;
  font-family: 'Alice', serif;
}

.search-result-page {
  font-size: 0.75rem;
  color: var(--cor-terciaria);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-no-results {
  padding: 1.5rem;
  text-align: center;
  color: var(--texto-principal);
  font-size: 0.9rem;
  font-family: 'Alice', serif;
}

/* ==============================
   SEARCH PANEL - MOBILE
   ============================== */

.search-panel {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, #A33A26 0%, #9B3522 100%);
  z-index: 1001;
  padding: 1rem;
  gap: 1rem;
  flex-direction: column;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.search-panel.active {
  max-height: 80vh;
  overflow-y: auto;
}

.search-panel .search-input {
  width: 100%;
  padding: 0.8rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-family: 'Alice', serif;
  background: rgba(255, 255, 255, 0.95);
  color: var(--cor-secundaria);
  outline: none;
}

.search-panel .search-input::placeholder {
  color: rgba(163, 58, 38, 0.5);
}

.search-panel .search-dropdown {
  position: static;
  width: 100%;
  min-width: auto;
  max-width: none;
  background: transparent;
  border: none;
  box-shadow: none;
  margin-top: 0;
  max-height: 100%;
}

.search-panel .search-result-item {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  padding: 0.8rem;
  color: white;
}

.search-panel .search-result-title {
  color: #f4f1ea;
  margin-bottom: 0.2rem;
}

.search-panel .search-result-snippet {
  color: rgba(244, 241, 234, 0.9);
  font-size: 0.8rem;
}

.search-panel .search-result-page {
  color: #D9A441;
}

/* ==============================
   RESPONSIVIDADE
   ============================== */

@media (max-width: 768px) {
  .nav-search {
    width: auto;
  }

  .search-dropdown {
    min-width: 250px;
    max-width: calc(100vw - 2rem);
  }
}

@media (max-width: 480px) {
  .search-dropdown {
    min-width: 200px;
  }

  .search-result-item {
    padding: 0.8rem;
  }

  .search-result-title {
    font-size: 0.9rem;
  }

  .search-result-snippet {
    font-size: 0.8rem;
  }
}

/* ==============================
   SEARCH DROPDOWN - MOBILE
   ============================== */

.search-dropdown-mobile {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  background: #f4f1ea;
  border-bottom: 1px solid rgba(163, 58, 38, 0.15);
  z-index: 999;
  width: 100%;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease, visibility 0.35s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
}

.search-dropdown-mobile.active {
  max-height: 80vh;
  overflow-y: auto;
  opacity: 1;
  visibility: visible;
}

.search-dropdown-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.search-dropdown-input {
  width: 100%;
  padding: 0.8rem 1rem;
  font-family: 'Alice', serif;
  font-size: 1rem;
  border: 1px solid rgba(163, 58, 38, 0.15);
  border-radius: 6px;
  background: #fff;
  color: var(--texto-principal);
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.search-dropdown-input:focus {
  border-color: var(--cor-primaria);
  box-shadow: 0 0 0 3px rgba(163, 58, 38, 0.1);
  transform: translateY(-2px);
}

.search-dropdown-input::placeholder {
  color: var(--texto-muted);
}

.search-dropdown-results {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: calc(70vh - 80px);
  overflow-y: auto;
  padding-right: 0.5rem;
}

.search-dropdown-results::-webkit-scrollbar {
  width: 6px;
}

.search-dropdown-results::-webkit-scrollbar-track {
  background: rgba(163, 58, 38, 0.08);
  border-radius: 3px;
}

.search-dropdown-results::-webkit-scrollbar-thumb {
  background: rgba(163, 58, 38, 0.3);
  border-radius: 3px;
}

.search-dropdown-results::-webkit-scrollbar-thumb:hover {
  background: rgba(163, 58, 38, 0.5);
}

.search-dropdown-results .search-result-item {
  background: #fff;
  border: 1px solid rgba(163, 58, 38, 0.12);
  border-left: 4px solid var(--cor-terciaria);
  padding: 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-dropdown-results .search-result-item:hover,
.search-dropdown-results .search-result-item.selected {
  background: #fff;
  border-left-color: var(--cor-primaria);
  box-shadow: 0 4px 12px rgba(163, 58, 38, 0.15);
  transform: translateX(2px);
}

.search-dropdown-results .search-result-title {
  color: var(--cor-secundaria);
  font-family: 'Tan', serif;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
}

.search-dropdown-results .search-result-snippet {
  color: var(--texto-principal);
  font-family: 'Alice', serif;
  font-size: 0.85rem;
  line-height: 1.4;
  margin-bottom: 0.3rem;
}

.search-dropdown-results .search-result-page {
  color: var(--cor-terciaria);
  font-family: 'Alice', serif;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.search-no-results {
  text-align: center;
  color: var(--texto-principal);
  padding: 1.5rem 1rem;
  font-family: 'Alice', serif;
  font-style: italic;
  font-size: 0.95rem;
}
