/* compare/ — plants side by side (RNAB-28). */
.compare {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* The plant fields: three empty ones to start with, then the picked plants and
   one field to add another. */
.compare-picker {
  display: grid;
  grid-template-columns: repeat(var(--compare-slots, 3), minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.compare-slot-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 132px;
  padding: 16px;
  border: 1px dashed var(--green-600);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
}

.compare-slot-card--filled {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  border-style: solid;
  border-color: var(--border);
}

.compare-slot-card__number {
  position: absolute;
  top: -12px;
  inset-inline-start: 16px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--green-600);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.compare-slot-card__label {
  color: var(--text-default);
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
}

.compare-slot-card__field {
  position: relative;
  display: flex;
  margin: 0;
}

.compare-slot-card__input {
  flex: 1 0 0;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--text-secondary);
  border-radius: var(--radius-sm);
  background: var(--bg-white);
  color: var(--text-default);
  font-family: var(--font);
  font-size: 16px;
  line-height: 24px;
}

.compare-slot-card__input::placeholder {
  color: var(--text-secondary);
  opacity: 1;
}

.compare-slot-card__input::-webkit-search-cancel-button {
  display: none;
}

.compare-slot-card__input:focus-visible {
  border-color: var(--green-600);
  outline: 2px solid var(--text-default);
  outline-offset: 2px;
}

/* Suggestions list added by Site.autocomplete(). */
.compare-slot-card__field .suggestions {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 6px);
  z-index: 10;
  max-height: 296px;
  margin: 0;
  padding: 4px 0;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-white);
  box-shadow: 0 12px 24px rgba(16, 24, 40, 0.12);
  list-style: none;
}

.compare-slot-card__field .suggestions li {
  padding: 8px 16px;
  cursor: pointer;
}

.compare-slot-card__field .suggestions li:hover,
.compare-slot-card__field .suggestions li[aria-selected='true'] {
  background: var(--accent-surface-soft);
  color: var(--green-700);
}

.compare-slot-card__note {
  color: var(--text-paragraph);
  font-size: 13px;
  line-height: 20px;
}

.compare-slot-card__note--error {
  color: #b42318;
}

.compare-slot-card__image {
  flex: none;
  width: 88px;
  height: 88px;
  border-radius: var(--radius-md);
  background: var(--bg-neutral);
  object-fit: cover;
}

.compare-slot-card__name {
  flex: 1 0 0;
  min-width: 0;
  color: var(--text-default);
  font-size: 18px;
  font-weight: 600;
  line-height: 28px;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.compare-slot-card__name:hover {
  color: var(--green-700);
  text-decoration: underline;
}

.compare-slot-card__remove {
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-white);
  color: var(--text-default);
  font-family: var(--font);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.compare-slot-card__remove:hover {
  background: var(--bg-neutral);
}

@media (max-width: 900px) {
  .compare-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .compare-picker {
    grid-template-columns: minmax(0, 1fr);
  }

  .compare-slot-card {
    min-height: 0;
  }
}

.compare-status:empty {
  display: none;
}

.compare-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
  text-align: center;
}

.compare-empty__title {
  font-size: 20px;
  font-weight: 600;
  line-height: 30px;
}

.compare-empty__text,
.compare-hint {
  color: var(--text-paragraph);
  font-size: 15px;
  line-height: 24px;
}

.compare-hint {
  padding: 12px 16px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  background: var(--accent-surface-subtle);
}

.compare-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.compare-tools[hidden],
.compare-scroll[hidden] {
  display: none;
}

.compare-tools__diff {
  font-size: 16px;
}

.compare-tools__clear {
  border: 0;
  background: none;
  color: var(--green-700);
  font-family: var(--font);
  font-size: 14px;
  line-height: 20px;
  text-decoration: underline;
  cursor: pointer;
}

.compare-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
}

.compare-scroll:focus-visible {
  outline: 2px solid var(--text-default);
  outline-offset: 2px;
}

.compare-table {
  width: 100%;
  min-width: calc(140px + var(--compare-columns, 2) * 200px);
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 15px;
  line-height: 24px;
}

.compare-table th,
.compare-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  border-inline-start: 1px solid var(--border);
  text-align: start;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.compare-table tr > :first-child {
  border-inline-start: 0;
}

.compare-table tbody:last-child tr:last-child > * {
  border-bottom: 0;
}

/* The field names stay in view while the plants scroll sideways. */
.compare-corner,
.compare-label {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  width: 140px;
  background: var(--bg-neutral);
  color: var(--text-default);
  font-weight: 600;
}

.compare-corner {
  vertical-align: bottom;
}

.compare-plant {
  position: relative;
  background: var(--bg-white);
  font-weight: 400;
  text-align: center;
}

.compare-table .compare-plant {
  padding: 16px;
  text-align: center;
}

.compare-plant__image {
  display: block;
  width: 100%;
  max-width: 220px;
  aspect-ratio: 4 / 3;
  margin: 0 auto 12px;
  border-radius: var(--radius-md);
  background: var(--bg-neutral);
  object-fit: cover;
}

.compare-plant__name {
  display: block;
  color: var(--text-default);
  font-size: 18px;
  font-weight: 600;
  line-height: 28px;
  text-decoration: none;
}

.compare-plant__name:hover {
  color: var(--green-700);
  text-decoration: underline;
}

.compare-plant__scientific {
  display: block;
  color: var(--accent-scientific);
  font-size: 14px;
  font-style: italic;
  line-height: 20px;
}

.compare-plant__error {
  display: block;
  margin-top: 8px;
  color: #b42318;
  font-size: 13px;
  line-height: 20px;
}

.compare-plant__remove {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  z-index: 1;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-white);
  color: var(--text-default);
  font-family: var(--font);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.compare-plant__remove:hover {
  background: var(--bg-neutral);
}

.compare-section th {
  position: sticky;
  inset-inline-start: 0;
  background: var(--accent-surface-soft);
  color: var(--green-900);
  font-size: 16px;
  font-weight: 600;
}

.compare-table td {
  color: var(--text-paragraph);
  white-space: pre-line;
}

.compare-table td[dir='ltr'] {
  text-align: end;
}

.compare-row--diff td {
  background: #fffaeb;
}

.compare-table .compare-cell--none {
  color: var(--text-secondary);
}

.compare-table .compare-nodiff {
  padding: 32px 16px;
  text-align: center;
}

@media (max-width: 700px) {
  .compare-table {
    min-width: calc(104px + var(--compare-columns, 2) * 168px);
    font-size: 14px;
    line-height: 22px;
  }

  .compare-corner,
  .compare-label {
    width: 104px;
  }

  .compare-table th,
  .compare-table td {
    padding: 10px 12px;
  }
}

@media print {
  .compare-tools,
  .compare-plant__remove,
  .compare-picker {
    display: none;
  }
}
