/* ==========================================================================
   OstuGrupp — gift cards + bundles + "frequently bought together"
   Shared stylesheet for inc/gift-cards.php and inc/bundles.php.
   Uses the design tokens from main.css (slate + green, radius, shadows, fonts).
   ========================================================================== */

/* ==========================================================================
   Gift-card chooser (single product)
   ========================================================================== */
.ostu-gc {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin: 22px 0;
  max-width: 520px;
}
.ostu-gc__block {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 18px 20px;
}
.ostu-gc__legend { display: block; margin-bottom: 12px; }
.ostu-gc__legend .eyebrow { margin-bottom: 0; }

/* Amount chips */
.ostu-gc__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.ostu-gc__chip {
  flex: 1 1 auto;
  min-width: 84px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 10px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--slate-dark);
  font-variant-numeric: tabular-nums;
  transition: border-color .2s ease, background .2s ease, color .2s ease, transform .2s ease;
}
.ostu-gc__chip .woocommerce-Price-amount { font-weight: 700; }
.ostu-gc__chip:hover {
  border-color: rgba(5, 150, 105, .5);
  transform: translateY(-2px);
}
.ostu-gc__chip.is-active {
  border-color: var(--green);
  background: rgba(5, 150, 105, .08);
  color: var(--green-dark);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, .12);
}

.ostu-gc__custom { margin-top: 14px; }
.ostu-gc__custom label,
.ostu-gc__field label {
  display: block;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--slate);
  margin-bottom: 6px;
}
.ostu-gc__req { color: var(--green); }
.ostu-gc__custom-input,
.ostu-gc__field input,
.ostu-gc__field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 48px;
  padding: 12px 14px;
  font: inherit;
  background: #fff;
  color: var(--fg);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.ostu-gc__field textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.ostu-gc__custom-input:focus,
.ostu-gc__field input:focus,
.ostu-gc__field textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, .14);
}
.ostu-gc__field { margin-top: 14px; }
.ostu-gc__field:first-of-type { margin-top: 0; }
.ostu-gc__hint {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--slate-500);
}

/* Live total summary */
.ostu-gc__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--slate-dark);
  color: #fff;
  flex-wrap: wrap;
}
.ostu-gc__summary-label { font-weight: 600; color: #cbd5e1; font-size: 14px; }
.ostu-gc__summary-amount {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.ostu-gc__summary-amount .woocommerce-Price-amount { color: #fff; }

.ostu-gc__submit {
  width: 100%;
  min-height: 54px;
  font-size: 16px;
  font-weight: 700;
}
.ostu-gc__unavailable {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--muted);
  color: var(--slate);
  font-weight: 600;
}

/* ==========================================================================
   Grouped product bundle ("Osta komplekt")
   ========================================================================== */
.ostu-bundle {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin: 22px 0;
}
.ostu-bundle__head { margin-bottom: 16px; }
.ostu-bundle__title { font-size: clamp(20px, 3vw, 26px); margin: 2px 0 6px; }
.ostu-bundle__sub { color: var(--slate-600); font-size: 14px; margin: 0; }

.ostu-bundle__items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}
.ostu-bundle__item {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.ostu-bundle__item:hover { border-color: rgba(5, 150, 105, .3); box-shadow: var(--shadow-card); }
.ostu-bundle__item.is-unavailable { opacity: .6; }

.ostu-bundle__media {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ostu-bundle__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}
.ostu-bundle__detail { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.ostu-bundle__name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ostu-bundle__name:hover { color: var(--green); }
.ostu-bundle__price {
  font-size: 15px;
  font-weight: 700;
  color: var(--slate-dark);
  font-variant-numeric: tabular-nums;
}
.ostu-bundle__price del { color: var(--slate-500); font-weight: 500; font-size: 13px; opacity: .7; margin-right: 5px; }
.ostu-bundle__price ins { text-decoration: none; color: var(--green-dark); }
.ostu-bundle__flag {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-500);
  background: var(--muted);
  border-radius: 999px;
  padding: 2px 10px;
}

.ostu-bundle__cta {
  border-top: 1px dashed var(--border);
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ostu-bundle__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.ostu-bundle__total-label { font-weight: 600; color: var(--slate); font-size: 15px; }
.ostu-bundle__total-amount {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--slate-dark);
  font-variant-numeric: tabular-nums;
}
.ostu-bundle__total-amount .woocommerce-Price-amount { color: var(--slate-dark); }
.ostu-bundle__add {
  width: 100%;
  min-height: 54px;
  font-size: 16px;
  font-weight: 700;
}
.ostu-bundle__add.is-loading { opacity: .8; pointer-events: none; }
.ostu-bundle__add.is-done { background: var(--green-dark); }
.ostu-bundle__note { margin: 0; font-size: 13px; color: var(--slate-500); text-align: center; }
.ostu-bundle__error {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--danger-dark);
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 10px 14px;
}

/* ==========================================================================
   "Sageli koos ostetud" rail
   ========================================================================== */
.ostu-fbt {
  grid-column: 1 / -1;
  margin-top: 40px;
}
.ostu-fbt__title { font-size: 24px; margin-bottom: 18px; }
.ostu-fbt__title .eyebrow { display: block; margin-bottom: 6px; }

.ostu-fbt__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 560px) { .ostu-fbt__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 880px) { .ostu-fbt__grid { grid-template-columns: repeat(3, 1fr); } }

.ostu-fbt-card {
  display: flex;
  gap: 12px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 12px;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.ostu-fbt-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(5, 150, 105, .3);
}
.ostu-fbt-card__media {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ostu-fbt-card__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}
.ostu-fbt-card__body { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.ostu-fbt-card__name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ostu-fbt-card__name:hover { color: var(--green); }
.ostu-fbt-card__price {
  font-size: 15px;
  font-weight: 700;
  color: var(--slate-dark);
  font-variant-numeric: tabular-nums;
}
.ostu-fbt-card__price del { color: var(--slate-500); font-weight: 500; font-size: 13px; opacity: .7; margin-right: 5px; }
.ostu-fbt-card__price ins { text-decoration: none; color: var(--green-dark); }

.ostu-fbt-card .ostu-fbt-card__add,
.ostu-fbt-card a.ostu-fbt-card__add.button {
  align-self: flex-start;
  margin-top: 3px;
  background: var(--green);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  min-height: 0;
  line-height: 1.2;
  transition: background .2s, transform .2s;
}
.ostu-fbt-card .ostu-fbt-card__add:hover { background: var(--green-dark); transform: translateY(-1px); }
.ostu-fbt-card .ostu-fbt-card__add.loading { opacity: .75; }

@media (prefers-reduced-motion: reduce) {
  .ostu-gc__chip,
  .ostu-bundle__item,
  .ostu-fbt-card { transition: none; }
}

/* Gift-card form error — replaces the window.alert() this form used to throw.
   Matches the bundle module's error styling a few rules above, so the two
   sibling features on the same page speak the same visual language. */
.ostu-gc__error {
  display: none;
  margin: 10px 0 0;
  padding: 10px 14px;
  border-left: 3px solid var(--danger);
  background: rgba(239, 68, 68, .08);
  color: var(--danger-dark);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
}
.ostu-gc__error.is-visible { display: block; }
