/* ===================================================================
   SEARCH STYLES - search.css
   =================================================================== */

.search-container {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin-bottom: 1rem;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 0.8rem 2.5rem 0.8rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #101012, #0b0c0d);
  color: var(--text-1);
  font-size: 0.98rem;
  transition: border-color var(--t), box-shadow var(--t);
  font-family: 'Inter', sans-serif;
}

.search-input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(255, 68, 85, 0.25);
}

.search-input::placeholder {
  color: var(--text-2);
}

/* Pulsing red outline animation on page load */
.search-input.search-pulse {
  animation: pulseRedOutline 0.8s ease-in-out infinite;
}

@keyframes pulseRedOutline {
  0% {
    border-color: var(--ring);
    box-shadow: 0 0 0 0 rgba(255, 68, 85, 0.7);
  }
  50% {
    border-color: var(--ring);
    box-shadow: 0 0 0 8px rgba(255, 68, 85, 0);
  }
  100% {
    border-color: var(--ring);
    box-shadow: 0 0 0 0 rgba(255, 68, 85, 0);
  }
}

.search-clear-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: color var(--t), background var(--t);
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-clear-btn:hover {
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.08);
}

/* Suggestions Dropdown */
.search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background var(--t);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.suggestion-icon {
  font-size: 1rem;
  min-width: 24px;
}

.suggestion-text {
  flex: 1;
  color: var(--text-1);
  font-size: 0.9rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-text strong {
  color: var(--brand);
  font-weight: 600;
}

.suggestion-type {
  font-size: 0.75rem;
  color: var(--text-2);
  text-transform: capitalize;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
}

/* Search Results Container */
.search-results-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  display: none;
}

.search-results-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.search-results-modal {
  width: 100%;
  max-width: 650px;
  max-height: 75vh;
  background: var(--surface-1);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  flex-shrink: 0;
}

.search-results-header h3 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.result-count {
  font-size: 0.9rem;
  color: var(--text-2);
  font-weight: 400;
}

.close-search-results {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: color var(--t), background var(--t);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 100;
}

.close-search-results:hover {
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.08);
}

.search-results-list {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
}

.search-result-card {
  border-left: 3px solid var(--brand);
  background: var(--surface-3);
  transition: background var(--t);
}

.search-result-card:hover {
  background: rgba(255, 255, 255, 0.04);
}

.search-no-results,
.search-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
  flex: 1;
}

.search-no-results p,
.search-error p {
  margin: 0.5rem 0;
  font-size: 1rem;
  color: var(--text-2);
  line-height: 1.5;
}

.search-no-results p:first-child,
.search-error p:first-child {
  font-size: 1.1rem;
  color: var(--text-1);
  font-weight: 500;
}

/* Mobile Responsive */
@media (max-width: 600px) {
  .search-container {
    max-width: 100%;
  }

  .search-results-modal {
    max-width: 95%;
    max-height: 80vh;
  }

  .search-results-header {
    padding: 1rem;
  }

  .search-results-header h3 {
    font-size: 1rem;
  }

  .suggestion-text {
    font-size: 0.85rem;
  }

  .search-results-list {
    padding: 0.75rem;
    gap: 0.25rem;
  }

  .search-result-card {
    padding: 0.75rem;
  }

  .search-result-card .song-thumbnail {
    width: 60px;
    height: 60px;
  }

  .search-result-card .song-title {
    font-size: 0.75rem;
  }

  .search-result-card .song-meta {
    font-size: 0.8rem;
  }

  .search-result-card .song-stats {
    font-size: 0.75rem;
  }

  .search-result-card .actions {
    gap: 0.5rem;
  }

  .search-result-card .btn {
    width: 24px !important;
    height: 24px !important;
  }
}

/* Scrollbar styling */
.search-results-list::-webkit-scrollbar,
.search-suggestions::-webkit-scrollbar {
  width: 8px;
}

.search-results-list::-webkit-scrollbar-track,
.search-suggestions::-webkit-scrollbar-track {
  background: transparent;
}

.search-results-list::-webkit-scrollbar-thumb,
.search-suggestions::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.search-results-list::-webkit-scrollbar-thumb:hover,
.search-suggestions::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}