/* ================================================
   SEARCH BAR COMPONENT - CONSISTENT ACROSS PAGES
   File: search-bar-component.css
   ================================================ */

/* ===== SEARCH WRAPPER ===== */
.search-wrapper {
  flex: 1;
  min-width: 200px;
  max-width: 400px; /* KONSISTEN: 400px di semua halaman */
  position: relative;
}

/* ===== SEARCH BOX ===== */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  padding: 8px 15px;
  border-radius: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.search-box:focus-within {
  box-shadow: 0 4px 20px rgba(0, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* ===== SEARCH ICON ===== */
.search-icon {
  margin-right: 10px;
  color: #00ffff;
  font-size: 18px;
  flex-shrink: 0;
}

/* ===== SEARCH INPUT ===== */
.search-input {
  border: none;
  outline: none;
  flex: 1;
  font-size: 14px;
  background: transparent;
  color: #333;
  min-width: 0; /* Prevents overflow */
}

.search-input::placeholder {
  color: #999;
}

/* ===== CLEAR BUTTON ===== */
.search-clear-btn {
  background: rgba(0, 0, 0, 0.1);
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #666;
  margin-left: 8px;
  flex-shrink: 0;
}

.search-clear-btn:hover {
  background: rgba(255, 107, 107, 0.2);
  color: #ff6b6b;
  transform: scale(1.1);
}

/* Show clear button when needed */
.search-clear-btn[style*="display: flex"],
.search-clear-btn.show {
  display: flex !important;
}

/* ===== AUTOCOMPLETE DROPDOWN ===== */
.search-autocomplete {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 15px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.search-autocomplete.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
  animation: slideDownAutocomplete 0.2s ease;
}

@keyframes slideDownAutocomplete {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== SCROLLBAR STYLING ===== */
.search-autocomplete::-webkit-scrollbar {
  width: 6px;
}

.search-autocomplete::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.search-autocomplete::-webkit-scrollbar-thumb {
  background: #00ffff;
  border-radius: 10px;
  transition: background 0.3s ease;
}

.search-autocomplete::-webkit-scrollbar-thumb:hover {
  background: #00cccc;
}

/* ===== AUTOCOMPLETE SECTIONS ===== */
.autocomplete-section {
  padding: 15px;
  border-bottom: 1px solid #f0f0f0;
}

.autocomplete-section:last-child {
  border-bottom: none;
}

.autocomplete-header {
  font-size: 12px;
  color: #999;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.5px;
}

.autocomplete-header i {
  font-size: 14px;
  color: #00ffff;
}

/* ===== AUTOCOMPLETE ITEMS ===== */
.autocomplete-item {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.autocomplete-item:hover {
  background: rgba(0, 255, 255, 0.1);
  transform: translateX(3px);
}

.autocomplete-item i {
  font-size: 16px;
  color: #00ffff;
  width: 20px;
  flex-shrink: 0;
}

.autocomplete-item-content {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.autocomplete-item-title {
  font-size: 14px;
  color: #333;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.autocomplete-item-subtitle {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.autocomplete-item-price {
  font-size: 14px;
  color: #00ffff;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== AUTOCOMPLETE FOOTER ===== */
.autocomplete-footer {
  padding: 12px 15px;
  background: #f8f8f8;
  text-align: center;
  border-radius: 0 0 15px 15px;
  position: sticky;
  bottom: 0;
}

.autocomplete-footer a {
  color: #00ffff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.3s ease;
}

.autocomplete-footer a:hover {
  text-decoration: underline;
  color: #00cccc;
}

.autocomplete-footer a i {
  font-size: 12px;
  transition: transform 0.3s ease;
}

.autocomplete-footer a:hover i {
  transform: translateX(3px);
}

/* ===== RESPONSIVE MOBILE ===== */
@media (max-width: 768px) {
  .search-wrapper {
    max-width: 100%;
    width: 100%;
  }
  
  .search-box {
    padding: 6px 12px;
  }
  
  .search-input {
    font-size: 13px;
  }
  
  .search-autocomplete {
    position: fixed;
    left: 10px;
    right: 10px;
    top: 70px;
    max-height: calc(100vh - 100px);
    border-radius: 15px;
  }
}

@media (max-width: 480px) {
  .search-box {
    padding: 6px 10px;
  }
  
  .search-icon {
    font-size: 16px;
    margin-right: 8px;
  }
  
  .search-input {
    font-size: 12px;
  }
  
  .search-clear-btn {
    width: 22px;
    height: 22px;
  }
  
  .autocomplete-item {
    padding: 8px 10px;
  }
  
  .autocomplete-item-title {
    font-size: 13px;
  }
  
  .autocomplete-item-subtitle {
    font-size: 11px;
  }
  
  .autocomplete-item-price {
    font-size: 13px;
  }
}