/* ========================================================
   🔍 SEARCH OVERLAY - Búsqueda Global
   ======================================================== */

.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.search-overlay.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
  opacity: 1;
}

/* ========================================================
   📦 CONTENEDOR PRINCIPAL
   ======================================================== */

.search-overlay-content {
  position: relative;
  width: 90%;
  max-width: 700px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    transform: translateY(-30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ========================================================
   ❌ BOTÓN CERRAR
   ======================================================== */

.close-search {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  z-index: 10;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.close-search:hover {
  background: #f5f5f5;
  color: #333;
  transform: rotate(90deg);
}

/* ========================================================
   🔍 SEARCH FORM
   ======================================================== */

.search-form {
  position: relative;
  padding: 25px 25px 20px;
  border-bottom: 1px solid #eee;
}

.search-form input {
  width: 100%;
  padding: 15px 50px 15px 20px;
  font-size: 18px;
  border: 2px solid #e0e0e0;
  border-radius: 50px;
  outline: none;
  transition: border-color 0.3s;
}

.search-form input:focus {
  border-color: #333;
}

.search-form input::placeholder {
  color: #999;
}

.search-form button {
  position: absolute;
  right: 35px;
  top: 50%;
  transform: translateY(-50%);
  background: #333;
  color: white;
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}

.search-form button:hover {
  background: #555;
}

/* ========================================================
   📋 DROPDOWN DE RESULTADOS
   ======================================================== */

.search-dropdown {
  max-height: 500px;
  overflow-y: auto;
  padding: 10px 0;
}

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

.search-dropdown::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.search-dropdown::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.search-dropdown::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ========================================================
   📦 ITEM DE RESULTADO
   ======================================================== */

.search-item {
  display: flex;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid #f5f5f5;
}

.search-item:hover {
  background: #f9f9f9;
}

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

.search-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  margin-right: 15px;
  border: 1px solid #eee;
}

.search-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0; /* Para que el texto se corte */
}

.search-code {
  font-size: 16px;
  margin-bottom: 4px;
  color: #333;
}

.search-code strong {
  font-weight: 600;
}

.search-category {
  font-size: 12px;
  color: #666;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-desc {
  font-size: 14px;
  color: #666;
  line-height: 1.4;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-price {
  font-size: 16px;
  font-weight: 600;
  color: #e74c3c;
}

/* ========================================================
   🔽 FOOTER "VER TODOS"
   ======================================================== */

.search-footer {
  padding: 15px 20px;
  border-top: 1px solid #eee;
  background: #fafafa;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

.search-see-all {
  width: 100%;
  padding: 12px 20px;
  background: #333;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.search-see-all:hover {
  background: #555;
}

/* ========================================================
   ℹ️ ESTADOS ESPECIALES
   ======================================================== */

.search-loading,
.search-empty,
.search-error,
.search-hint {
  padding: 40px 20px;
  text-align: center;
  color: #666;
}

.search-loading i {
  font-size: 32px;
  color: #333;
  margin-bottom: 15px;
  display: block;
}

.search-loading span {
  font-size: 16px;
}

.search-empty i,
.search-error i {
  font-size: 48px;
  color: #ccc;
  margin-bottom: 15px;
  display: block;
}

.search-empty p,
.search-error p {
  font-size: 16px;
  margin: 0;
}

.search-error {
  color: #e74c3c;
}

.search-error i {
  color: #e74c3c;
}

.search-hint {
  font-size: 14px;
  color: #999;
  padding: 30px 20px;
}

/* ========================================================
   📱 RESPONSIVE
   ======================================================== */

@media (max-width: 768px) {
  .search-overlay.active {
    padding-top: 60px;
  }

  .search-overlay-content {
    width: 95%;
    max-width: none;
  }

  .search-form {
    padding: 20px 15px 15px;
  }

  .search-form input {
    font-size: 16px;
    padding: 12px 45px 12px 15px;
  }

  .search-form button {
    width: 40px;
    height: 40px;
    right: 25px;
  }

  .search-item {
    padding: 10px 15px;
  }

  .search-thumb {
    width: 60px;
    height: 60px;
    margin-right: 12px;
  }

  .search-code {
    font-size: 14px;
  }

  .search-desc {
    font-size: 13px;
  }

  .search-price {
    font-size: 14px;
  }

  .close-search {
    width: 35px;
    height: 35px;
    font-size: 24px;
  }
}

/* ========================================================
   🎨 ANIMACIONES ADICIONALES
   ======================================================== */

.search-results-container {
  animation: fadeIn 0.3s ease;
}

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