/* GCO (Grocery Cart Optimization) page styles */

body {
  background-color: #fff;
}

.gco-page button {
  font: inherit;
  cursor: pointer;
}

.gco-page {
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background-color: #fff;
  -webkit-font-smoothing: antialiased;
  color: #1e293b;
}

.gco-logo {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #2C8746;
  padding: 12px 16px 4px;
}

.gco-logo svg {
  width: 13px;
  height: 10px;
}

.gco-logo-text {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: inherit;
}

.gco-heading {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 400;
  color: #1e293b;
  text-align: center;
  margin: 0 0 20px;
  padding: 0 40px;
  line-height: 1.3;
}

.gco-column-headers {
  display: flex;
  justify-content: space-between;
  padding: 8px calc(50% - 158px) 8px calc(50% - 158px + 16px);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #004E36;
  text-transform: uppercase;
}

.gco-column-headers span {
  flex: 1;
  text-align: center;
  max-width: 150px;
}

.gco-header-spacer {
  width: 36px;
  flex: none;
}

.gco-swap-pair {
  padding: 0 0 4px calc(50% - 158px);
  position: relative;
  transition: padding-left 0.3s ease;
}



.gco-swap-pair + .gco-swap-pair::before {
  content: "";
  display: block;
  height: 1px;
  background: #d0d0d0;
  margin: 0 auto 0;
  width: 100%;
}

.gco-product-pair {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  padding: 12px 0;
  justify-content: flex-start;
  overflow: visible;
  transition: transform 0.3s ease;
}

.gco-product-slot {
  flex: 1;
  padding: 8px 0;
  gap: 8px;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: max-width 0.3s ease, flex-basis 0.3s ease;
}

.gco-product-pair .gco-product-slot {
  flex: 1;
  max-width: 150px;
  text-align: center;
}

.gco-swap-carousel {
  display: flex;
  flex-direction: row;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-width: 0;
  padding: 4px 4px 4px 0;
  margin: -4px -4px -4px 0;
  scroll-padding-left: 4px;
  transition: margin-left 0.3s ease;
}

.gco-swap-carousel::before {
  content: "";
  flex: 0 0 4px;
  min-width: 4px;
}

.gco-swap-carousel::after {
  content: "";
  flex: 0 0 4px;
  min-width: 4px;
}

.gco-swap-carousel::-webkit-scrollbar {
  display: none;
}

.gco-swap-carousel .gco-product-slot {
  flex: 0 0 150px;
  scroll-snap-align: start;
  max-width: 150px;
  transition: max-width 0.3s ease, flex-basis 0.3s ease;
}

.gco-swap-carousel:has(.gco-slot-expanded),
.gco-swap-carousel.gco-carousel-expanded {
  overflow: visible;
  scroll-snap-type: none;
}

.gco-swap-carousel .gco-product-slot.gco-slot-expanded {
  scroll-snap-align: none;
}

.gco-product-slot.gco-slot-selected .gco-product-card {
  border: 2px solid #006039;
  background: #F2F7F5;
  border-radius: 12px;
}

.gco-product-slot.gco-slot-selected .gco-product-image {
  position: relative;
}

.gco-product-slot.gco-slot-selected .gco-product-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(125, 175, 155, 0.1);
  pointer-events: none;
}



.gco-original-slot {
  position: relative;
}

.gco-page :focus-visible {
  outline: 2px solid #1B5E3C;
  outline-offset: 2px;
}

.gco-product-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 2px solid rgba(0,0,0,0.25);
  border-radius: 12px;
  background: #fff;
  padding: 8px 12px 16px 12px;
  width: 100%;
  overflow: visible;
  position: relative;
}

.gco-product-image {
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gco-product-image img {
  width: 120px;
  height: 120px;
  object-fit: contain;
}

.gco-product-image-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 16px;
  background-color: #f5f5f5;
}
.gco-product-name {
  font-size: 15px;
  color: #1e293b;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 130px;
  text-align: center;
}

.gco-see-more-link {
  display: inline-block;
  font-size: 13px;
  color: #004E36;
  text-decoration: underline;
  margin-top: 4px;
}

.gco-swap-icon {
  width: 52px;
  height: 52px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: -34px;
  top: 50%;
  transform: translateY(-50%);
  background: #1B5E3C;
  border-radius: 50%;
  z-index: 20;
}

.gco-badges {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: flex-end;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 10;
  transition: opacity 0.25s ease;
}

.gco-change-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px 0 0 6px;
  background: #144530;
  color: #fff;
  white-space: nowrap;
  display: block;
  text-transform: uppercase;
}

.gco-change-badge:first-child {
  border-radius: 6px 10px 0 6px;
}

.gco-change-badge:nth-child(1) {
  background: #144530;
}

.gco-change-badge:nth-child(2) {
  background: #246842;
}

.gco-change-badge:nth-child(3) {
  background: #348B54;
}

.gco-confirm-area {
  padding: 16px 24px;
  padding-top: 80px;
  margin-top: -80px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, white 60%, rgba(255,255,255,0));
  z-index: 100;
}

.gco-confirm-button {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 9999px;
  background: #1B5E3C;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 150ms ease;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
}

.gco-dismiss-button {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 9999px;
  background: #f0f0f0;
  color: #1e293b;
  border: 2px solid #d0d0d0;
  cursor: pointer;
  transition: all 150ms ease;
}

.gco-confirm-button:hover {
  background: #164a30;
}

.gco-dismiss-button:hover {
  background: #e5e5e5;
}

.gco-confirm-button:active {
  transform: scale(0.98);
}

.gco-dismiss-button:active {
  transform: scale(0.98);
}

.gco-confirm-button:focus-visible {
  outline: 2px solid #1B5E3C;
  outline-offset: 2px;
}

.gco-dismiss-button:focus-visible {
  outline: 2px solid #1B5E3C;
  outline-offset: 2px;
}

.gco-no-swaps {
  display: flow-root;
  text-align: center;
  padding: 0 0 40px;
  color: #64748b;
}

.gco-skeleton {
  padding: 16px;
  text-align: center;
}

.gco-skeleton-text {
  font-family: var(--font-sans);
  font-size: 14px;
  color: #64748b;
  margin-bottom: 16px;
}

.gco-skeleton-cards {
  display: flex;
  flex-direction: row;
  gap: 16px;
  justify-content: center;
}

.gco-skeleton-card {
  width: 120px;
  height: 160px;
  background: #e2e8f0;
  border-radius: 12px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.gco-error {
  text-align: center;
  padding: 24px 16px;
}

.gco-error-message {
  font-family: var(--font-sans);
  font-size: 16px;
  color: #64748b;
  margin: 16px 0;
}

.gco-error-link {
  color: #1B5E3C;
  text-decoration: underline;
}

.gco-content {
  padding-bottom: 0;
}

.gco-scroll-spacer {
  height: 60px;
}

/* Nutrition facts display */
.gco-nutrition {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin-top: 8px;
}

.gco-nutrition-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #004F2D;
    margin-bottom: 2px;
}

.gco-nutrition-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 15px;
    color: #64748b;
    line-height: 1.3;
}

.gco-nutrition-item + .gco-nutrition-item {
    margin-top: -4px;
}

.gco-nutrition-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.gco-card-inner {
    position: relative;
    overflow: hidden;
}

.gco-card-front {
    position: relative;
    transition: opacity 0.25s ease;
    opacity: 1;
}

.gco-card-back {
    opacity: 0;
    position: absolute;
    visibility: hidden;
    height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0;
}

.gco-card-inner.gco-card-flipped .gco-card-front {
    position: absolute;
    visibility: hidden;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

.gco-card-inner.gco-card-flipped .gco-card-back {
    position: relative;
    visibility: visible;
    height: auto;
    overflow-y: auto;
    display: flex;
    opacity: 1;
    min-width: 0;
    padding: 8px 16px 16px;
}

.gco-product-card:has(.gco-card-flipped) .gco-badges {
    opacity: 0;
}

/* Expanded slot when card is flipped to show ingredients */
.gco-product-slot.gco-slot-expanded {
    max-width: calc(100vw - 64px);
    flex: 0 0 calc(100vw - 64px);
}

.gco-product-pair .gco-product-slot.gco-slot-expanded {
    max-width: calc(100vw - 64px);
}

.gco-ingredients-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
    text-align: left;
    width: 100%;
}

.gco-ingredients-text {
    font-size: 15px;
    text-align: left;
    word-break: break-word;
}

/* Icon buttons (info / close) */
.gco-icon-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    margin: 4px 0 0 0px;
}

.gco-icon-btn img {
    width: 24px;
    height: 24px;
}

.gco-back-btn {
    margin: -4px 0 0 -8px;
}

/* Back-face product title */
.gco-back-product-title {
    font-size: 14px;
    font-weight: 700;
    text-align: left;
    width: 100%;
    margin-bottom: 4px;
}

/* Micro-feedback (thumbs up / down per swap pair) */
.gco-feedback {
    display: flex;
    flex-direction: row;
    align-items: center;
    align-self: flex-end;
    justify-content: flex-end;
    gap: 0;
    padding: 0;
}

.gco-feedback-buttons {
    display: flex;
    flex-direction: row;
    gap: 0;
}

.gco-feedback-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: opacity 0.15s ease;
    color: #006039;
}

.gco-feedback-btn svg {
    fill: currentColor;
}

.gco-feedback-btn:focus-visible {
    outline: 2px solid #1B5E3C;
    outline-offset: 2px;
}

.gco-feedback-btn .gco-fb-on {
    display: none;
}

.gco-feedback-btn .gco-fb-off {
    display: block;
}

.gco-feedback-btn.gco-feedback-active .gco-fb-on {
    display: block;
}

.gco-feedback-btn.gco-feedback-active .gco-fb-off {
    display: none;
}

.gco-feedback-btn:hover {
    opacity: 0.75;
}

.gco-feedback-dimmed {
    opacity: 0.35;
}

.gco-feedback-btn.gco-feedback-dimmed:hover {
    opacity: 0.35;
}
