/* ==========================================================================
   OstuGrupp — Wishlist (Soovinimekiri) + Compare (Võrdlus)
   Heart toggle on cards/single · header chip · wishlist page · compare toggle ·
   floating compare bar · comparison table. Uses the design tokens from main.css.
   ========================================================================== */

/* ==========================================================================
   Wishlist heart — card variant (floats over the media)
   ========================================================================== */
.product-card { position: relative; } /* anchor the absolute heart (already relative, safe to assert) */

.ostu-wl-btn--card {
  position: absolute; top: 10px; right: 10px; z-index: 4;
  width: 38px; height: 38px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .92); color: var(--slate-500);
  border: 1px solid var(--border); border-radius: 999px;
  box-shadow: var(--shadow-card); backdrop-filter: blur(4px);
  transition: transform .18s ease, color .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
/* The "Uus"/"Otsas" badges live top-right too — drop the heart below them so
   they never overlap. (Badges are a direct child of .product-card, like the
   heart after the JS relocates it.) */
.product-card:has(.ostu-loop-badges) .ostu-wl-btn--card { top: 50px; }
.ostu-wl-btn--card:hover { color: #e11d48; border-color: rgba(225, 29, 72, .35); transform: translateY(-1px); box-shadow: var(--shadow-card-hover); }
.ostu-wl-btn--card.is-active { color: #e11d48; border-color: rgba(225, 29, 72, .45); background: #fff; }
.ostu-wl-btn--card.is-active .ostu-wl-btn__icon svg { fill: #e11d48; }
.ostu-wl-btn__icon { display: inline-flex; }
.ostu-wl-btn__icon svg { display: block; transition: fill .18s ease; }

/* heart pop animation on toggle */
@keyframes ostu-wl-pop { 0% { transform: scale(1); } 35% { transform: scale(1.28); } 70% { transform: scale(.9); } 100% { transform: scale(1); } }
.ostu-wl-btn.is-bounce .ostu-wl-btn__icon { animation: ostu-wl-pop .42s ease; }
@media (prefers-reduced-motion: reduce) { .ostu-wl-btn.is-bounce .ostu-wl-btn__icon { animation: none; } }

/* ==========================================================================
   Wishlist + Compare — single product buttons row
   ========================================================================== */
.ostu-wl-single, .ostu-cmp-single { display: inline-flex; }

.ostu-wl-btn--single, .ostu-cmp-btn--single {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 18px; margin-top: 12px; margin-right: 10px;
  background: #fff; color: var(--slate); border: 1px solid var(--border);
  border-radius: var(--radius); font-weight: 600; font-size: 14.5px;
  box-shadow: var(--shadow-card);
  transition: color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.ostu-wl-btn--single:hover { color: #e11d48; border-color: rgba(225, 29, 72, .4); transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }

/* ---- YITH WooCommerce Wishlist button (the store uses YITH; our own wishlist
   module defers to it, so the visible single-product button is YITH's and was
   unstyled / "floating"). Style it as a clean on-brand button to match. ---- */
.single-product .yith-wcwl-add-to-wishlist { margin: 18px 0 0; display: inline-block; }
.single-product .yith-wcwl-add-to-wishlist .yith-wcwl-add-button > a,
.single-product .yith-wcwl-add-to-wishlist .yith-wcwl-wishlistaddedbrowse > a,
.single-product .yith-wcwl-add-to-wishlist .yith-wcwl-wishlistexistsbrowse > a,
.single-product a.add_to_wishlist {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  background: #fff; color: var(--slate); border: 1px solid var(--border);
  border-radius: var(--radius); font-weight: 600; font-size: 14.5px; text-decoration: none;
  box-shadow: var(--shadow-card); transition: color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.single-product a.add_to_wishlist:hover,
.single-product .yith-wcwl-add-to-wishlist a:hover { color: #e11d48; border-color: rgba(225, 29, 72, .4); transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
.single-product .yith-wcwl-add-to-wishlist i,
.single-product .yith-wcwl-add-to-wishlist .yith-wcwl-icon,
.single-product a.add_to_wishlist i { color: #e11d48; }
.single-product .yith-wcwl-add-to-wishlist .feedback { color: var(--slate-500); font-size: 13px; }
.ostu-wl-btn--single.is-active { color: #e11d48; border-color: rgba(225, 29, 72, .5); }
.ostu-wl-btn--single.is-active .ostu-wl-btn__icon svg { fill: #e11d48; }

.ostu-cmp-btn--single:hover { color: var(--green); border-color: rgba(5, 150, 105, .5); transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
.ostu-cmp-btn--single.is-active { color: var(--green-dark); border-color: rgba(5, 150, 105, .55); background: rgba(5, 150, 105, .06); }

/* label swapping (single variant) — show "add" by default, "on" when active */
.ostu-wl-btn__label-on, .ostu-cmp-btn__label-on { display: none; }
.ostu-wl-btn.is-active .ostu-wl-btn__label-add, .ostu-cmp-btn.is-active .ostu-cmp-btn__label-add { display: none; }
.ostu-wl-btn.is-active .ostu-wl-btn__label-on, .ostu-cmp-btn.is-active .ostu-cmp-btn__label-on { display: inline; }

/* ==========================================================================
   Compare toggle — card variant (relocated by JS into a host below the body)
   ========================================================================== */
.ostu-cmp-card-actions { padding: 0 16px 14px; margin-top: -2px; display: flex; }
.ostu-cmp-btn--card {
  display: inline-flex; align-items: center; gap: 6px;
  align-self: flex-start; padding: 5px 12px;
  background: var(--muted); color: var(--slate-600); border: 1px solid var(--border);
  border-radius: 999px; font-size: 12.5px; font-weight: 600;
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}
.ostu-cmp-btn--card:hover { color: var(--green-dark); border-color: rgba(5, 150, 105, .35); background: rgba(5, 150, 105, .08); }
.ostu-cmp-btn--card.is-active { color: #fff; background: var(--green); border-color: var(--green); }
.ostu-cmp-btn--card.is-active:hover { background: var(--green-dark); }
.ostu-cmp-btn__icon { display: inline-flex; }
.ostu-cmp-btn__icon svg { display: block; }

/* ==========================================================================
   Header wishlist chip (lifted into .site-header__actions by the JS)
   ========================================================================== */
.header-wishlist {
  position: relative; font-weight: 600; color: var(--slate);
  padding: 8px 12px; border-radius: 10px; min-height: 44px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .2s ease, color .2s ease;
}
.header-wishlist:hover { background: var(--muted); color: #e11d48; }
.header-wishlist__icon { display: inline-flex; }
.header-wishlist__icon svg { display: block; }
.header-wishlist.has-items .header-wishlist__icon svg { fill: #e11d48; stroke: #e11d48; }
.header-wishlist__count {
  background: #e11d48; color: #fff; border-radius: 999px;
  min-width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; padding: 0 6px;
}
/* Hide the wishlist text label on small screens (icon + count only). */
@media (max-width: 1023px) { .header-wishlist__label { display: none; } }

/* ==========================================================================
   Wishlist page  ([ostugrupp_wishlist])
   ========================================================================== */
.ostu-wl-page { margin-block: 8px; }
.ostu-wl-page__head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; margin-bottom: 22px; }
.ostu-wl-page__head .eyebrow { width: 100%; margin-bottom: 0; }
.ostu-wl-page__title { font-size: clamp(24px, 3.5vw, 34px); display: inline-flex; align-items: baseline; gap: 10px; }
.ostu-wl-page__count { font-family: var(--font-body); font-size: 14px; font-weight: 600; color: var(--slate-500); }
.ostu-wl-page__clear {
  margin-left: auto; background: #fff; border: 1px solid var(--border); color: var(--slate-600);
  border-radius: var(--radius); padding: 9px 16px; font-weight: 600; font-size: 13.5px;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.ostu-wl-page__clear:hover { color: #dc2626; border-color: #fecaca; background: #fef2f2; }

.ostu-wl-page__loading { display: flex; align-items: center; gap: 12px; color: var(--slate-500); padding: 40px 0; font-weight: 600; }
.ostu-wl-page__spinner, .ostu-cmp-page__spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--green);
  animation: ostu-spin .7s linear infinite;
}
@keyframes ostu-spin { to { transform: rotate(360deg); } }

.ostu-wl-page__empty, .ostu-cmp-page__empty {
  text-align: center; padding: 48px 24px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.ostu-wl-page__empty-icon { color: #e11d48; display: inline-flex; }
.ostu-cmp-page__empty-icon { color: var(--green); display: inline-flex; }
.ostu-wl-page__empty-title, .ostu-cmp-page__empty-title { font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--slate-dark); margin: 14px 0 6px; }
.ostu-wl-page__empty-hint, .ostu-cmp-page__empty-hint { color: var(--slate-500); margin-bottom: 20px; }

/* grid reuses the product grid rhythm */
.ostu-wl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; list-style: none; margin: 0; padding: 0; }
@media (min-width: 768px) { .ostu-wl-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .ostu-wl-grid { grid-template-columns: repeat(4, 1fr); } }

.ostu-wl-card { padding: 0; }
.ostu-wl-card__media { position: relative; }
.ostu-wl-card__media img { width: 100%; height: 100%; object-fit: contain; padding: 14px; }
.ostu-wl-card__body, .ostu-wl-card .product-card__body { padding: 14px 16px 12px; }
.ostu-wl-card .woocommerce-loop-product__title {
  font-family: var(--font-body); font-size: 14.5px; font-weight: 600; color: var(--fg); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0;
}
.ostu-wl-card:hover .woocommerce-loop-product__title { color: var(--green); }
.ostu-wl-card .price { color: var(--slate-dark); font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 6px; display: block; }
.ostu-wl-card .price del { color: var(--slate-500); font-weight: 500; font-size: 14px; opacity: .7; margin-right: 6px; }
.ostu-wl-card .price ins { text-decoration: none; color: var(--green-dark); }
.ostu-wl-card .star-rating { font-size: 13px; margin: 4px 0; }

.ostu-wl-card__remove {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .92); color: var(--slate-500);
  border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow-card);
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}
.ostu-wl-card__remove:hover { color: #fff; background: var(--danger); border-color: var(--danger); }

.ostu-wl-card__actions { padding: 0 16px 16px; margin-top: auto; }
.ostu-wl-card__actions .button {
  display: block; width: 100%; text-align: center; background: var(--green); color: #fff;
  border-radius: var(--radius); padding: 11px 14px; font-weight: 600; font-size: 14px; border: 0;
  transition: background .2s ease, transform .2s ease;
}
.ostu-wl-card__actions .button:hover { background: var(--green-dark); transform: translateY(-1px); }
.ostu-wl-card__actions .added_to_cart { display: block; text-align: center; margin-top: 8px; color: var(--green-dark); font-weight: 600; font-size: 13px; }

/* ==========================================================================
   Floating compare bar
   ========================================================================== */
.ostu-cmp-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
  background: var(--slate-dark); color: #e2e8f0;
  border-top: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 -10px 30px -16px rgba(15, 23, 42, .6);
  transform: translateY(0); animation: ostu-cmp-rise .3s cubic-bezier(.4, 0, .2, 1);
}
@keyframes ostu-cmp-rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .ostu-cmp-bar { animation: none; } }
/* Lift the compare bar above the mobile bottom nav (engagement module, z-1100,
   visible ≤1023.98px) so its actions are never hidden behind it. Matches the
   established .og-sproof / .sticky-atc convention exactly. */
@media (max-width: 1023.98px) {
  body:has(.og-bottomnav) .ostu-cmp-bar { bottom: calc(var(--og-bottomnav-h, 64px) + env(safe-area-inset-bottom, 0px)); }
}

.ostu-cmp-bar__inner { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-block: 12px; }
.ostu-cmp-bar__intro { display: flex; flex-direction: column; line-height: 1.2; }
.ostu-cmp-bar__title { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: #fff; }
.ostu-cmp-bar__hint { font-size: 12px; color: #94a3b8; font-weight: 600; }

.ostu-cmp-bar__slots { display: flex; align-items: center; gap: 10px; margin: 0; padding: 0; list-style: none; flex: 1; min-width: 0; flex-wrap: wrap; }
.ostu-cmp-bar__slot { position: relative; width: 48px; height: 48px; border-radius: 10px; overflow: hidden; background: #fff; border: 1px solid rgba(255, 255, 255, .15); flex-shrink: 0; }
.ostu-cmp-bar__slot img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.ostu-cmp-bar__slot-remove {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 999px;
  background: var(--danger); color: #fff; border: 2px solid var(--slate-dark); font-size: 13px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.ostu-cmp-bar__slot-remove:hover { background: #dc2626; }

.ostu-cmp-bar__actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.ostu-cmp-bar__clear { background: transparent; color: #cbd5e1; border: 1px solid rgba(255, 255, 255, .18); border-radius: var(--radius); padding: 10px 16px; font-weight: 600; font-size: 13.5px; transition: background .2s ease, color .2s ease, border-color .2s ease; }
.ostu-cmp-bar__clear:hover { background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(255, 255, 255, .3); }
.ostu-cmp-bar__go { min-height: 44px; }

@media (max-width: 640px) {
  .ostu-cmp-bar__inner { gap: 10px; }
  .ostu-cmp-bar__intro { width: 100%; flex-direction: row; align-items: baseline; gap: 8px; }
  .ostu-cmp-bar__actions { margin-left: 0; width: 100%; }
  .ostu-cmp-bar__go { flex: 1; }
}

/* keep the back-to-top button clear of the bar when visible */
body:has(.ostu-cmp-bar:not([hidden])) .back-to-top { bottom: 88px; }

/* ==========================================================================
   Compare page  ([ostugrupp_compare]) — comparison table
   ========================================================================== */
.ostu-cmp-page { margin-block: 8px; }
.ostu-cmp-page__head { margin-bottom: 22px; }
.ostu-cmp-page__title { font-size: clamp(24px, 3.5vw, 34px); }
.ostu-cmp-page__loading { display: flex; align-items: center; gap: 12px; color: var(--slate-500); padding: 40px 0; font-weight: 600; }

.ostu-cmp-table__scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-card); }
.ostu-cmp-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 560px; }
.ostu-cmp-table th, .ostu-cmp-table td { padding: 14px 16px; text-align: left; vertical-align: middle; border-top: 1px solid var(--border); }
.ostu-cmp-table thead th { border-top: 0; }
.ostu-cmp-table tbody th[scope="row"] {
  background: var(--muted); color: var(--slate-dark); font-weight: 700; font-size: 13px;
  text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; width: 150px;
}
.ostu-cmp-table tbody tr:nth-child(even) td { background: rgba(241, 245, 249, .35); }

/* product header column */
.ostu-cmp-table__col { position: relative; min-width: 160px; text-align: center !important; vertical-align: top; }
.ostu-cmp-table__remove {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 999px;
  background: var(--muted); color: var(--slate-500); border: 1px solid var(--border); font-size: 15px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}
.ostu-cmp-table__remove:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
.ostu-cmp-table__product { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ostu-cmp-table__thumb { width: 100px; height: 100px; border-radius: var(--radius); background: var(--muted); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ostu-cmp-table__thumb img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.ostu-cmp-table__name { font-family: var(--font-display); font-weight: 700; font-size: 14.5px; color: var(--slate-dark); line-height: 1.35; }
.ostu-cmp-table__product:hover .ostu-cmp-table__name { color: var(--green); }

.ostu-cmp-table__price { font-weight: 700; color: var(--slate-dark); font-variant-numeric: tabular-nums; }
.ostu-cmp-table__price del { color: var(--slate-500); font-weight: 500; opacity: .7; margin-right: 5px; }
.ostu-cmp-table__price ins { text-decoration: none; color: var(--green-dark); }

.ostu-cmp-table__stock { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.ostu-cmp-table__stock::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.ostu-cmp-table__stock.is-in { color: var(--green-dark); }
/* Was #dc2626 — a fourth different red for the same "out of stock" state. */
.ostu-cmp-table__stock.is-out { color: var(--danger-dark); }

.ostu-cmp-table__buy-row td { text-align: center; }
.ostu-cmp-table__add {
  display: inline-block; background: var(--green); color: #fff; border: 0;
  border-radius: var(--radius); padding: 10px 18px; font-weight: 600; font-size: 14px;
  transition: background .2s ease, transform .2s ease;
}
.ostu-cmp-table__add:hover { background: var(--green-dark); transform: translateY(-1px); }
.ostu-cmp-table__buy-row .added_to_cart { display: inline-block; margin-top: 8px; color: var(--green-dark); font-weight: 600; font-size: 13px; }

/* ==========================================================================
   Shared toast
   ========================================================================== */
.ostu-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px);
  z-index: 1200; background: var(--slate-dark); color: #fff;
  padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: 14px;
  box-shadow: 0 14px 32px -14px rgba(15, 23, 42, .5);
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
  max-width: calc(100vw - 32px);
}
.ostu-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
/* lift the toast above the compare bar when it's open */
body:has(.ostu-cmp-bar:not([hidden])) .ostu-toast { bottom: 96px; }
