/* Autocomplete Styles */
.autocomplete-wrapper {
  position: relative;
}

.autocomplete-input {
  width: 100%;
  padding: 12px 36px 12px 12px;
  font-size: 14px;
  border: 1px solid #e9c4b3;
  border-radius: 8px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%234A5565' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  cursor: pointer;
  transition: border-color 0.2s ease;
  color: #4a5565;
  height: 38px;
}

.autocomplete-input:focus {
  outline: none;
  border-color: #e60041;
}

.autocomplete-input:disabled {
  background-color: #f5f5f5;
  cursor: not-allowed;
  opacity: 0.6;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-top: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: none;
}

.autocomplete-dropdown.show {
  display: block;
}

.autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  color: #222;
  border-bottom: 1px solid #f5f5f5;
  transition: all 0.2s ease;
}

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

.autocomplete-item:hover {
  background-color: #fff5f0;
  color: #e60041;
}

.autocomplete-item.active {
  background-color: #e60041;
  color: white;
  font-weight: 500;
}

.autocomplete-item.selected {
  background-color: #fff5f0;
  color: #e60041;
  font-weight: 500;
  border-left: 3px solid #e60041;
}

.autocomplete-item mark {
  background-color: transparent;
  color: #e60041;
  font-weight: 600;
}

.autocomplete-item.active mark {
  color: white;
}

.autocomplete-no-results {
  padding: 12px;
  text-align: center;
  color: #999;
  font-size: 13px;
}

.autocomplete-dropdown::-webkit-scrollbar {
  width: 4px;
}

.autocomplete-dropdown::-webkit-scrollbar-track {
  background: #f5f5f5;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 2px;
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
  .autocomplete-input {
    padding: 8px 36px 8px 12px;
    font-size: 14px;
    border: 1px solid white;
    background-color: white;
    background-position: right 12px center;
    color: #4a5565;
    height: 38px;
  }

  .autocomplete-input:focus {
    border-color: white;
  }

  .autocomplete-input:disabled {
    border: 1px solid #f1cfcf;
    background-color: #f5f5f5;
    opacity: 0.6;
  }
}

/* Disabled state sau khi submit thành công — override cả mobile */
form.form-submitted .autocomplete-input,
form.form-submitted input,
form.form-submitted textarea {
  background-color: #f0f0f0 !important;
  background-image: none !important;
  color: #aaa !important;
  border-color: #e0e0e0 !important;
  pointer-events: none !important;
  cursor: not-allowed !important;
}

@media screen and (max-width: 768px) {
  form.form-submitted .autocomplete-input,
  form.form-submitted input,
  form.form-submitted textarea {
    background-color: #f0f0f0 !important;
    background-image: none !important;
    color: #aaa !important;
    border-color: #e0e0e0 !important;
    border: 1px solid #e0e0e0 !important;
  }
}
