:root {
  --color-primary: #2db356;
  --color-primary-dark: #1f7c3a;
  --color-surface: #ffffff;
  --color-background: #f5f7fa;
  --color-text: #1f2933;
  --color-muted: #6b7280;
  --color-border: #e5e7eb;
  --shadow-card: 0 20px 40px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", sans-serif;
  background: var(--color-background);
  color: var(--color-text);
}

.hero {
  background: linear-gradient(135deg, #74d680 0%, #2db356 100%);
  color: #ffffff;
  padding: 3rem 1.5rem 2rem;
  text-align: center;
}

.hero__content h1 {
  margin: 0 0 0.5rem;
  font-size: 2.5rem;
}

.hero__content p {
  margin: 0;
  font-size: 1.125rem;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.search-card {
  background: var(--color-surface);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: var(--shadow-card);
  margin-top: -4rem;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.search-form input {
  flex: 1;
  min-width: 220px;
  padding: 1rem 1.25rem;
  border-radius: 16px;
  border: 1px solid var(--color-border);
  font-size: 1rem;
}

.btn {
  border: none;
  border-radius: 16px;
  padding: 0.9rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn--primary {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 12px 20px rgba(45, 179, 86, 0.25);
}

.btn--primary:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
}

.btn--secondary {
  background: #f0fdf4;
  color: var(--color-primary-dark);
}

.btn--ghost {
  background: #ffffff;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
}

.hint {
  margin: 1rem 0 0;
  color: var(--color-muted);
}

.preferences {
  margin-top: 2.5rem;
}

.preferences__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.preferences__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.chip {
  border: 1px solid var(--color-border);
  background: #ffffff;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-size: 0.95rem;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip--active {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #047857;
}

.results {
  margin-top: 3rem;
}

.results__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.results__title {
  font-size: 1.75rem;
  margin: 0;
}

.results__sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.results__sort label {
  font-size: 0.875rem;
  color: var(--color-muted);
  font-weight: 500;
}

.sort-dropdown {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  font-size: 0.875rem;
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b7280' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

.sort-dropdown:hover {
  border-color: var(--color-primary);
}

.sort-dropdown:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.results__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.result-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.result-card__title {
  margin: 0;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.result-card__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--color-primary);
  color: white;
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: bold;
  flex-shrink: 0;
}

.result-card__favorite {
  border: none;
  background: #f9fafb;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
}

.result-card__meta {
  color: var(--color-muted);
  margin: 0;
}

.result-card__tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.result-card__tags li {
  background: #ecfdf5;
  color: #065f46;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.result-card__actions {
  display: flex;
  gap: 0.75rem;
}

.result-card__analysis {
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
  font-size: 0.95rem;
  color: var(--color-muted);
}

.analysis-card__sourcing {
  font-size: 0.9rem;
  font-style: italic;
    color: var(--color-muted);
}

.analysis-metadata {
  margin-top: 0.75rem;
  font-size: 0.9rem;
    color: var(--color-muted);
}

.analysis__metadata,
.analysis__cautions {
  margin-top: 2rem;
}

.analysis__metadata ul,
.analysis__cautions ul {
  list-style: disc;
  margin: 0.75rem 0 0 1.5rem;
    color: var(--color-muted);
}

.analysis-price-overview {
  margin: 0.5rem 0 0;
  font-weight: 600;
  color: var(--color-text);
}

.map-section {
  margin-top: 3rem;
  background: #ffffff;
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.map-section__title {
  margin-top: 0;
  margin-bottom: 1rem;
}

#search-map {
  width: 100%;
  min-height: 360px;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px var(--color-border);
}

.restaurant {
  background: #ffffff;
  border-radius: 24px;
  padding: 2.5rem;
  box-shadow: var(--shadow-card);
  margin-top: -4rem;
}

.restaurant__header {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: flex-start;
}

.restaurant__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

.restaurant__meta iframe {
  border: 0;
  width: 100%;
  min-height: 320px;
  border-radius: 20px;
  box-shadow: var(--shadow-card);
}

.category-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
}

.dietary-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.dietary-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dietary-option:hover:not(.dietary-option--unsupported) {
  border-color: var(--color-primary);
  background: #f0fdf4;
}

.dietary-option--selected {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #ffffff;
}

.dietary-option--unsupported {
  opacity: 0.4;
  cursor: not-allowed;
  background: #f3f4f6;
  color: var(--color-muted);
}

.dietary-option__icon {
  font-size: 1.25rem;
}

.dietary-option__label {
  font-size: 0.875rem;
}

.dietary-options-hint {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-top: 0.75rem;
  font-style: italic;
}

.analysis {
  margin-top: 3rem;
}

.analysis__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}


.analysis-card {
  background: #f9fafb;
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.analysis-card__media {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.analysis-card__media img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

.analysis-card__media--placeholder {
  background: #f0fdf4;
  border: 1px dashed rgba(22, 163, 74, 0.3);
}

.analysis-card__media--placeholder img {
  object-fit: contain;
  padding: 1rem;
}

.analysis-card__media--loading {
  background: #fff7ed;
  border: 1px dashed rgba(249, 115, 22, 0.4);
  animation: mediaPulse 1.6s ease-in-out infinite;
}

.analysis-card__media--loading img {
  object-fit: contain;
  padding: 1.25rem;
}

.analysis-card__media--simulated {
  background: #fffbeb;
  border: 1px solid rgba(234, 179, 8, 0.4);
  box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.2);
}

.analysis-card__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(23, 23, 23, 0.75);
  color: #fefce8;
}

.analysis-card__content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.analysis__alignment ul {
  list-style: none;
  padding: 0;
}

.footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--color-muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Loading States */
.analysis-loading {
  text-align: center;
  padding: 3rem 1.5rem;
}

.analysis-loading h2 {
  margin-bottom: 2rem;
  color: var(--color-text);
}

.analysis-loading p {
  color: var(--color-muted);
  font-size: 1.125rem;
  margin: 1rem 0;
}

.analysis-loading__subtext {
  font-size: 0.875rem;
  font-style: italic;
}

.spinner {
  margin: 2rem auto;
  width: 50px;
  height: 50px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

@keyframes mediaPulse {
  0% { opacity: 0.7; }
  50% { opacity: 1; }
  100% { opacity: 0.7; }
}

.error-message {
  color: #dc2626;
  font-weight: 500;
}

@media (max-width: 768px) {
  .search-form {
    flex-direction: column;
  }
  .restaurant__header,
  .restaurant__meta {
    grid-template-columns: 1fr;
    flex-direction: column;
  }
  .restaurant__meta iframe {
    min-height: 220px;
  }
  #search-map {
    min-height: 260px;
  }
  .analysis-card__media img {
    object-fit: contain;
  }
}
