/* ==========================================
   PHARMCOMPARE — Search App Styles
   ========================================== */

/* === SEARCH PAGE === */
.search-page {
  min-height: calc(100vh - 65px);
  padding: 40px 0 80px;
}

.search-hero {
  text-align: center;
  padding: 40px 0 48px;
}

.search-headline {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.02em;
  color: var(--fg);
  margin: 8px 0 12px;
}

.search-subline {
  font-size: 1rem;
  color: var(--fg-muted);
  margin-bottom: 36px;
}

.search-input-wrap {
  max-width: 600px;
  margin: 0 auto 16px;
  position: relative;
}

.search-field-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 6px 6px 6px 16px;
  gap: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-field-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-light);
}

.search-icon-svg {
  width: 20px;
  height: 20px;
  color: var(--fg-muted);
  flex-shrink: 0;
}

.search-field-wrap input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  color: var(--fg);
  background: transparent;
  padding: 10px 0;
  min-width: 0;
}

.search-field-wrap input::placeholder {
  color: var(--fg-muted);
  font-weight: 400;
}

.search-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.search-btn:hover { background: var(--accent-dark); }
.search-btn:active { transform: scale(0.96); }

.search-btn svg {
  width: 18px;
  height: 18px;
}

.search-hint {
  font-size: 0.78rem;
  color: var(--fg-muted);
}

/* === AUTOCOMPLETE DROPDOWN === */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px var(--shadow);
  max-height: 320px;
  overflow-y: auto;
  z-index: 50;
}

.autocomplete-dropdown.hidden { display: none; }

.drug-suggestion {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.drug-suggestion:last-child { border-bottom: none; }
.drug-suggestion:hover { background: var(--accent-light); }

.drug-suggestion-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--fg);
}

.drug-suggestion-meta {
  font-size: 0.72rem;
  color: var(--fg-muted);
}

/* === RESULTS SECTION === */
.results-section { margin-top: 8px; }
.results-section.hidden { display: none; }

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.results-drug {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.results-sub {
  font-size: 0.82rem;
  color: var(--fg-muted);
  margin-top: 4px;
}

.price-range-badge {
  background: var(--accent-light);
  color: var(--accent-dark);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

/* === PHARMACY LIST === */
.pharmacy-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pharmacy-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: box-shadow 0.2s, transform 0.15s;
}

.pharmacy-row:hover {
  box-shadow: 0 4px 20px var(--shadow);
  transform: translateY(-1px);
}

.pharmacy-row.best-price {
  border-color: var(--green-price);
  border-width: 2px;
  background: rgba(5, 150, 105, 0.03);
}

.pharmacy-row.best-price .pharmacy-chain-tag {
  background: var(--accent-light);
  color: var(--accent-dark);
  border: none;
}

.pharmacy-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.pharmacy-chain-tag {
  display: inline-block;
  width: fit-content;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  margin-bottom: 4px;
}

.pharmacy-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
}

.pharmacy-street {
  font-size: 0.78rem;
  color: var(--fg-muted);
}

.pharmacy-price-block {
  text-align: right;
  flex-shrink: 0;
}

.pharmacy-retail {
  font-size: 0.72rem;
  color: var(--fg-muted);
  text-decoration: line-through;
  margin-bottom: 2px;
}

.pharmacy-cash-price {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--fg);
  letter-spacing: -0.02em;
}

.pharmacy-row.best-price .pharmacy-cash-price {
  color: var(--green-price);
}

.pharmacy-savings {
  font-size: 0.72rem;
  color: var(--green-price);
  font-weight: 500;
  margin-top: 2px;
}

.pharmacy-row.best-price .pharmacy-savings {
  display: block;
}

.pharmacy-savings.hidden { display: none; }

/* === SAVINGS SUMMARY === */
.savings-summary {
  margin-top: 32px;
  background: var(--accent-light);
  border: 1px solid var(--accent-light);
  border-radius: var(--radius-lg);
  padding: 24px 32px;
  text-align: center;
}

.savings-summary.hidden { display: none; }

.savings-big {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--accent-dark);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.savings-label {
  font-size: 0.85rem;
  color: var(--accent-dark);
}

/* === LOADING STATE === */
.loading-state {
  text-align: center;
  padding: 60px 0;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-state p {
  font-size: 0.9rem;
  color: var(--fg-muted);
}

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 60px 0;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.empty-state.hidden { display: none; }

/* === RESPONSIVE === */
@media (max-width: 600px) {
  .search-page { padding: 24px 0 60px; }
  .search-hero { padding: 24px 0 32px; }

  .pharmacy-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .pharmacy-price-block { text-align: left; }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}