/* Professional Search Button Design */
.animated-search-container {
  position: relative;
  margin: 2rem auto;
  width: 100%;
  max-width: 600px;
  height: auto;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  z-index: 10;
}

.animated-search-container .search {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary-600, #2563eb) 0%, var(--primary-700, #1d4ed8) 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 8;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3),
              0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.animated-search-container .search::before {
  content: "\f002";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 20px;
  color: white;
  position: absolute;
  transition: all 0.3s ease;
  opacity: 1;
}

.animated-search-container .search::after {
  content: "\f00d";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 20px;
  color: white;
  position: absolute;
  transition: all 0.3s ease;
  opacity: 0;
  transform: rotate(90deg) scale(0);
}

.animated-search-container .search:hover {
  background: linear-gradient(135deg, var(--primary-700, #1d4ed8) 0%, var(--primary-800, #1e40af) 100%);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4),
              0 4px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-50%) scale(1.05);
}

.animated-search-container .search:active {
  transform: translateY(-50%) scale(0.98);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3),
              0 1px 2px rgba(0, 0, 0, 0.1);
}

.animated-search-container input {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  position: relative;
  width: 100%;
  height: 64px;
  padding: 0 200px 0 24px;
  outline: none;
  border: 2px solid var(--gray-300, #cbd5e1);
  background: white;
  color: var(--gray-800, #1e293b);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08),
              0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
  z-index: 5;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.01em;
  box-sizing: border-box;
}

/* Adjust input padding when no additional buttons */
.animated-search-container:not(:has(.advanced-search-btn)):not(:has(.voice-search-btn)) input {
  padding-right: 72px;
}

.animated-search-container input::placeholder {
  color: var(--gray-400, #94a3b8);
  font-weight: 400;
  opacity: 0.8;
}

.animated-search-container input:hover {
  border-color: var(--primary-400, #60a5fa);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15),
              0 2px 4px rgba(0, 0, 0, 0.08);
}

.animated-search-container input:focus {
  border-color: var(--primary-600, #2563eb);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1),
              0 4px 16px rgba(37, 99, 235, 0.2),
              0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: text;
}

.animated-search-container.focused input {
  border-color: var(--primary-600, #2563eb);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1),
              0 4px 16px rgba(37, 99, 235, 0.2),
              0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: text;
}

.animated-search-container.focused .search {
  background: linear-gradient(135deg, var(--gray-700, #334155) 0%, var(--gray-800, #1e293b) 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2),
              0 2px 4px rgba(0, 0, 0, 0.1);
}

.animated-search-container.focused .search::before {
  opacity: 0;
  transform: rotate(-90deg) scale(0);
}

.animated-search-container.focused .search::after {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.animated-search-container input:focus ~ .search {
  background: linear-gradient(135deg, var(--gray-700, #334155) 0%, var(--gray-800, #1e293b) 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2),
              0 2px 4px rgba(0, 0, 0, 0.1);
}

.animated-search-container input:focus ~ .search::before {
  opacity: 0;
  transform: rotate(-90deg) scale(0);
}

.animated-search-container input:focus ~ .search::after {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Fallback for Font Awesome icons if not loaded */
@supports not (font-family: "Font Awesome 6 Free") {
  .animated-search-container .search::before {
    content: "🔍";
    font-family: Arial, sans-serif;
    font-size: 22px;
  }
  
  .animated-search-container .search::after {
    content: "✕";
    font-family: Arial, sans-serif;
    font-size: 22px;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .animated-search-container {
    max-width: 100%;
    padding: 0 16px;
  }
  
  .animated-search-container input {
    height: 56px;
    font-size: 15px;
    padding: 0 160px 0 20px;
  }
  
  .animated-search-container .search {
    width: 48px;
    height: 48px;
    right: 6px;
  }
  
  .animated-search-container .search::before,
  .animated-search-container .search::after {
    font-size: 18px;
  }
  
  /* Adjust input padding when no additional buttons on mobile */
  .animated-search-container:not(:has(.advanced-search-btn)):not(:has(.voice-search-btn)) input {
    padding-right: 64px;
  }
}

@media (max-width: 480px) {
  .animated-search-container {
    max-width: 100%;
    padding: 0 12px;
    margin: 1.5rem auto;
  }
  
  .animated-search-container input {
    height: 52px;
    font-size: 14px;
    padding: 0 140px 0 18px;
    border-radius: 12px;
  }
  
  .animated-search-container .search {
    width: 44px;
    height: 44px;
    right: 5px;
    border-radius: 10px;
  }
  
  .animated-search-container .search::before,
  .animated-search-container .search::after {
    font-size: 16px;
  }
  
  /* Adjust input padding when no additional buttons on small mobile */
  .animated-search-container:not(:has(.advanced-search-btn)):not(:has(.voice-search-btn)) input {
    padding-right: 60px;
  }
}

/* Smooth loading animation */
.animated-search-loaded .animated-search-container {
  animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Accessibility improvements */
.animated-search-container .search:focus {
  outline: 2px solid var(--primary-600, #2563eb);
  outline-offset: 2px;
}

.animated-search-container input:focus-visible {
  outline: 2px solid var(--primary-600, #2563eb);
  outline-offset: 2px;
}

/* Loading state for search button */
.animated-search-container .search.loading {
  pointer-events: none;
  opacity: 0.7;
}

.animated-search-container .search.loading::before,
.animated-search-container .search.loading::after {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
