:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-accent: #f0f2f5;
  --ink: #1a202c;
  --muted: #718096;
  --accent: #4a5568;
  --accent-dark: #2d3748;
  --card: #ffffff;
  --stroke: #e2e8f0;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  background-color: var(--bg-accent);
  min-height: 100vh;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 8px;
  font-weight: 800;
  color: #1a202c;
}

.search-card {
  background: var(--card);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--stroke);
}

.input-row {
  display: flex;
  gap: 12px;
}

.input-row input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  font-size: 1rem;
}

.input-row button {
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  background: #4a5568;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.results-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
}

.count-link {
  background: none;
  border: none;
  color: #5a67d8;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-size: 0.9rem;
}

.count-link:hover {
  text-decoration: underline;
}

.count-link:disabled {
  color: #a0aec0;
  cursor: not-allowed;
  text-decoration: none;
}

.count {
  color: #718096;
  font-size: 0.85rem;
}

.results-grid {
  display: grid;
  gap: 20px;
}

.result-card {
  display: grid;
  grid-template-columns: 160px 1fr 300px 220px;
  background: white;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  min-height: 200px;
  transition: box-shadow 0.2s ease;
}

.result-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.result-card.google-result-view {
  grid-template-columns: 1fr 300px;
}
.result-card.google-result-view .result-body {
  border-right: 1px solid var(--stroke);
}

/* Column 1: Image */
.result-image {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-right: 1px solid var(--stroke);
}

.result-image img {
  max-width: 100%;
  max-height: 140px;
  object-fit: contain;
}

/* Column 2: Content */
.result-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-right: 1px solid var(--stroke);
}

.result-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}

.result-title a {
  color: #2d3748;
  text-decoration: none;
  transition: color 0.2s ease;
}

.result-title a:hover {
  color: #5a67d8;
  text-decoration: underline;
}

.result-desc {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #718096;
  flex: 1;
}

.read-more-btn {
  color: #5a67d8;
  cursor: pointer;
  font-weight: 600;
  margin-left: 4px;
}

.read-more-btn:hover {
  text-decoration: underline;
}

.body-footer {
  margin-top: auto;
  font-size: 0.8rem;
  color: #718096;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  line-height: 1.5;
}

.footer-row span {
  font-weight: 500;
  color: #4a5568;
}

/* Column 3: Transaction */
.result-transaction {
  padding: 20px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-right: 1px solid var(--stroke);
  overflow: hidden;
}

.trans-header {
  display: flex;
  justify-content: flex-end;
  margin: -20px -20px 4px -20px;
  padding: 10px 12px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.alternatives-panel {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: #fff;
}

.alternatives-panel h3 {
  margin: 0 0 8px 0;
  font-size: 0.95rem;
  color: #2d3748;
}

.alternatives-panel ul {
  margin: 0;
  padding-left: 18px;
}

.alternatives-panel li {
  margin: 4px 0;
  font-size: 0.9rem;
  color: #4a5568;
}

.edit-card-btn-inline {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 8px;
  opacity: 0.6;
  transition: opacity 0.2s;
  color: white;
}

.edit-card-btn-inline:hover {
  opacity: 1;
}

.trans-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  font-size: 0.9rem;
  gap: 12px;
  line-height: 1.4;
}

.trans-row-highlighted {
  background: #ffffff;
  padding: 10px 12px;
  margin: 0 -20px;
  padding-left: 20px;
  padding-right: 20px;
  border-left: 3px solid #ffffff;
  border-radius: 2px;
}

.trans-label {
  color: #718096;
  font-weight: 500;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.trans-val {
  font-weight: 600;
  color: #2d3748;
  text-align: right;
  word-break: break-word;
  flex: 1;
  font-size: 0.9rem;
}

.mini-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  opacity: 0.3;
  transition: opacity 0.2s;
}

.mini-edit-btn:hover {
  opacity: 1;
}

/* Column 4: Meta/Vendor */
.result-meta-column {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vendor-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #5a67d8;
}

.vendor-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #5a67d8;
  margin-top: -8px;
}

.meta-badges {
  display: flex;
  gap: 20px;
}

.badge-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-icon {
  color: #ecc94b;
}

.badge-text {
  display: flex;
  flex-direction: column;
}

.badge-label {
  font-size: 0.7rem;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-val {
  font-size: 0.9rem;
  font-weight: 700;
}

.meta-actions {
  margin-top: auto;
  display: flex;
  gap: 12px;
}

.circle-action-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #f7fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.2s;
}

.circle-action-btn:hover {
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.save-btn {
  background: #ebf4ff;
  color: #3182ce;
}

.save-btn:hover {
  background: #3182ce;
  color: white;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-large {
  max-width: 800px;
}

.edit-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #4a5568;
}

.form-group input {
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

.modal-actions.full-width {
  grid-column: span 2;
}

.cancel-btn {
  padding: 10px 20px;
  border-radius: 6px;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  cursor: pointer;
}

.submit-btn {
  padding: 10px 20px;
  border-radius: 6px;
  background: #3182ce;
  color: white;
  border: none;
  cursor: pointer;
}

@media (max-width: 1024px) {
  .result-card {
    grid-template-columns: 140px 1fr 240px;
  }
  .result-meta-column {
    grid-column: span 3;
    flex-direction: row;
    align-items: center;
    border-top: 1px solid var(--stroke);
  }
  .meta-actions {
    margin-top: 0;
    margin-left: auto;
  }
}

.alt-modal {
  max-width: 560px;
}

.alt-list {
  margin: 12px 0 0 0;
  padding-left: 18px;
}

.alt-list li {
  margin: 10px 0;
  color: #2d3748;
}

.alt-list p {
  margin: 4px 0 0 0;
  color: #4a5568;
  font-size: 0.9rem;
}

@media (min-width: 1200px) {
  .alternatives-panel {
    display: none;
  }
}
