.search-view {
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  overflow-x: hidden;
}

@media (min-width: 1024px) {
  .search-view {
    max-width: 70rem;
  }
}

.search-content {
  padding: 1rem var(--margin-main) 2rem;
  animation: fadeInUp 0.5s ease-out;
  overflow-x: hidden;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--on-surface);
  margin-bottom: 1.25rem;
  line-height: 1.2;
}

.suggestions-section {
  margin-bottom: 2rem;
}

.suggestions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gutter);
}

.suggestion-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  padding: var(--card-padding);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.suggestion-btn:active {
  transform: scale(0.96);
}

.suggestion-btn:hover {
  background: #83afd6;
  font-weight: 700;
}

[data-theme="dark"] .suggestion-btn:hover {
  background: #07243d;
}

.suggestion-btn--neutral-1 {
  background: var(--suggestion-1);
  color: var(--suggestion-text);
  border: 1px solid var(--suggestion-border-1);
}

[data-theme="dark"] .suggestion-btn--neutral-1:hover {
  background: #1e2225;
}

.suggestion-btn--neutral-2 {
  background: var(--suggestion-2);
  color: var(--suggestion-text);
  border: 1px solid var(--suggestion-border-2);
}

.suggestion-btn--neutral-3 {
  background: var(--suggestion-3);
  color: var(--suggestion-text);
  border: 1px solid var(--suggestion-border-3);
}

.suggestion-btn--neutral-4 {
  background: var(--suggestion-4);
  color: var(--suggestion-text);
  border: 1px solid var(--suggestion-border-4);
}

.suggestion-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius);
  background: var(--suggestion-icon-bg);
  color: var(--suggestion-icon-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.suggestion-name {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.2;
}

.recent-section {
  margin-bottom: 2rem;
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: var(--gutter);
}

.recent-card {
  background: var(--surface-container-lowest);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: var(--card-padding);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border: 1px solid var(--outline-variant);
}

.recent-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.recent-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.recent-detail {
  font-size: 1rem;
  color: var(--on-surface-variant);
  margin-top: 0.125rem;
}

.recent-tag {
  padding: 0.25rem 0.75rem;
  background: var(--secondary-fixed);
  color: var(--on-secondary-fixed-variant);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

[data-theme="dark"] .recent-tag {
  background: #2c3038;
}

.recent-distance {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.875rem;
}

.recent-btn {
  width: 100%;
  height: var(--touch-target-min);
  background: var(--primary-container);
  color: var(--on-primary-container);
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: opacity 0.15s;
}

[data-theme="dark"] .recent-btn {
  background: #053d13;
}

.recent-btn:active {
  opacity: 0.85;
}

.loading {
  text-align: center;
  color: var(--on-surface-variant);
  font-size: 1rem;
  font-weight: 500;
  margin: 3rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.loading::after {
  content: "";
  width: 36px;
  height: 36px;
  border: 3px solid var(--outline-variant);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.selected-medicine-section {
  margin-top: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

@media (min-width: 1024px) {
  .selected-medicine-section {
    max-height: 76vh;
  }
}


.medicine-info {
  background: var(--surface-container-lowest);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--outline-variant);
}

.medicine-info h2 {
  color: var(--on-surface);
  margin-bottom: 1rem;
  font-size: 1.75rem;
  font-weight: 700;
}

.medicine-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--surface-container-low);
  border-radius: var(--radius);
  border: 1px solid var(--outline-variant);
}

.medicine-details span {
  font-size: 0.95rem;
  color: var(--on-surface-variant);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.medicine-details strong {
  color: var(--on-surface);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.back-button {
  background: var(--surface-container-low);
  color: var(--on-surface);
  border: 1px solid var(--outline-variant);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.15s;
}

.back-button:hover {
  background: var(--surface-container);
}

.pharmacy-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0 0.5rem;
  flex-wrap: wrap;
}

.sort-distance-button {
  background: var(--surface-container-lowest);
  color: var(--on-surface);
  border: 1px solid var(--outline-variant);
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s;
}

.sort-distance-button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.sort-distance-button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.sort-distance-button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.location-error {
  color: var(--error);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.retry-location-btn {
  background: var(--error);
  color: var(--on-error);
  border: none;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.retry-location-btn:hover {
  opacity: 0.85;
}

.location-source {
  color: var(--primary);
  font-size: 0.85rem;
}

/* Filter tabs */
.filter-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface-container-lowest, #f3f4f6);
  color: var(--on-surface-variant, #6b7280);
  transition: all 0.15s;
}

.filter-tab:hover {
  background: var(--surface-container-low, #e5e7eb);
}

.filter-tab--active {
  background: var(--primary, #2563eb);
  color: white;
}

/* Products section */
.products-section {
  margin-top: 1.5rem;
}

.section-subtitle {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--on-surface);
  margin-bottom: 0.75rem;
}
