
/* Prettier, modern compare UI (theme-friendly, no hard-coded brand colors) */
:root{
  --xyz-radius-lg: 18px;
  --xyz-radius-md: 14px;
  --xyz-shadow: 0 10px 35px rgba(0,0,0,.10);
  --xyz-border: rgba(0,0,0,.10);
  --xyz-muted: rgba(0,0,0,.65);
  --xyz-bg: rgba(255,255,255,.85);
}

.xyz-compare-btn.is-active { opacity: .92; }

.xyz-compare-single-wrap { margin-top: 10px; }

/* Floating minibar */
.xyz-compare-minibar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  pointer-events: none;
}
.xyz-compare-minibar[hidden] { display: none; }
.xyz-compare-minibar__inner{
  pointer-events: all;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(22,22,22,.92);
  color: #fff;
  padding: 12px 14px;
  border-radius: var(--xyz-radius-lg);
  box-shadow: var(--xyz-shadow);
  backdrop-filter: blur(10px);
}
.xyz-compare-minibar__left strong{ font-weight: 700; letter-spacing: .2px; }
.xyz-compare-minibar__count { opacity: .85; margin-left: 6px; }

/* Buttons */
.xyz-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--xyz-radius-md);
  padding: 9px 12px;
  border: 1px solid rgba(255,255,255,.20);
  background: transparent;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  transition: transform .06s ease, opacity .2s ease;
}
.xyz-btn:active{ transform: translateY(1px); }
.xyz-btn--solid{
  background: rgba(255,255,255,.14);
}
.xyz-btn--ghost{
  background: transparent;
}
.xyz-link{
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  font-size: 13px;
  opacity: .9;
}

/* Page hero */
.xyz-compare-page { margin: 18px 0; }
.xyz-compare-page__hero{
  border-radius: var(--xyz-radius-lg);
  border: 1px solid var(--xyz-border);
  background:
    radial-gradient(1200px 200px at 20% 0%, rgba(0,0,0,.04), transparent),
    radial-gradient(900px 220px at 80% 10%, rgba(0,0,0,.03), transparent),
    var(--xyz-bg);
  box-shadow: 0 6px 22px rgba(0,0,0,.06);
  overflow: hidden;
}
.xyz-compare-page__hero-inner{ padding: 16px 18px; }
.xyz-compare-page__title { margin: 0 0 6px 0; font-weight: 780; letter-spacing: -.2px; }
.xyz-compare-page__subtitle { margin: 0; color: var(--xyz-muted); }

/* Toolbar */
.xyz-compare-toolbar{
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 2px 14px;
}
.xyz-compare-toolbar__spacer{ flex: 1; }
.xyz-compare-toggle{ display: inline-flex; align-items: center; gap: 8px; user-select: none; color: rgba(0,0,0,.78); }
.xyz-compare-toggle input{ transform: translateY(1px); }

.xyz-compare-pager{ display: inline-flex; gap: 8px; }
.xyz-compare-pager[hidden]{ display: none; }

.xyz-compare-empty{
  padding: 16px;
  border: 1px dashed rgba(0,0,0,.22);
  border-radius: var(--xyz-radius-lg);
  color: rgba(0,0,0,.75);
  background: rgba(255,255,255,.75);
}

/* Table container */
.xyz-compare-table-wrap[hidden]{ display:none; }

.xyz-compare-table-scroll{
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--xyz-radius-lg);
  border: 1px solid var(--xyz-border);
  background: rgba(255,255,255,.7);
  box-shadow: 0 10px 35px rgba(0,0,0,.06);
}

/* Table */
.xyz-compare{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 820px;
}
.xyz-compare__thead th{
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
}
.xyz-compare__th,
.xyz-compare__td{
  border-bottom: 1px solid rgba(0,0,0,.06);
  padding: 14px 14px;
  vertical-align: top;
}
.xyz-compare__tbody tr:nth-child(even) td,
.xyz-compare__tbody tr:nth-child(even) th.xyz-compare__th--spec{
  background: rgba(0,0,0,.015);
}

.xyz-compare__th--spec{
  width: 220px;
  font-weight: 700;
  position: sticky;
  left: 0;
  z-index: 4;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-right: 1px solid rgba(0,0,0,.06);
}
.xyz-compare__th--corner{ z-index: 5; }
.xyz-compare__th--product{ width: 280px; }

/* Product header card */
.xyz-compare__card{
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 12px;
  align-items: start;
}
.xyz-compare__img{
  display:block;
  border-radius: 16px;
  background: rgba(0,0,0,.03);
  border: 1px solid rgba(0,0,0,.05);
  overflow: hidden;
}
.xyz-compare__img img{
  width: 84px;
  height: 84px;
  object-fit: contain;
  display:block;
}
.xyz-compare__name{
  display: block;
  font-weight: 760;
  text-decoration: none;
  line-height: 1.25;
}
.xyz-compare__price{ margin-top: 6px; }
.xyz-compare__stock{ margin-top: 8px; }

.xyz-pill{
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.12);
  font-size: 12px;
  opacity: .95;
  background: rgba(255,255,255,.75);
}
.xyz-pill--ok{ opacity: 1; }

/* Mobile tweaks */
@media (max-width: 767px){
  .xyz-compare { min-width: 700px; }
  .xyz-compare__th--spec{ width: 185px; }
  .xyz-compare__th--product{ width: 250px; }
  .xyz-compare-minibar { left: 10px; right: 10px; bottom: 10px; }
  .xyz-compare-minibar__inner{ border-radius: 20px; }
}


/* Extra polish */
.xyz-compare__thead tr{
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
}
.xyz-compare__td, .xyz-compare__th--product{
  border-left: 1px solid rgba(0,0,0,.04);
}
.xyz-compare__td:first-of-type{ border-left: none; }
.xyz-compare__th--product{
  border-left: 1px solid rgba(0,0,0,.06);
}
.xyz-compare__th--spec{
  letter-spacing: .1px;
}
.xyz-compare__name{
  font-size: 14px;
}
.xyz-compare__price{
  font-size: 13px;
  opacity: .95;
}


/* Layout fixes for long short-descriptions + theme overrides */
.xyz-compare__th--product { min-width: 260px; max-width: 320px; }
.xyz-compare__meta { min-width: 0; } /* allow clamp/ellipsis */
.xyz-compare__name{
  color: inherit !important;          /* override theme link color */
  word-break: break-word;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: 5.6em;
}
.xyz-compare__price{ color: inherit; opacity: .9; }
.xyz-compare__td{ word-break: break-word; overflow-wrap: anywhere; }

/* Make Remove look like a small action instead of a big pill */
.xyz-link{
  display: inline-flex;
  margin-top: 8px;
  text-decoration: none;
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  opacity: .85;
}
.xyz-link:hover{ opacity: 1; }

/* Spec column slightly tighter */
.xyz-compare__th--spec{ width: 190px; }

/* Column separators for readability */
.xyz-compare__td, .xyz-compare__th--product{
  border-left: 1px solid rgba(0,0,0,.04);
}



.xyz-compare-page,
.xyz-compare-root,
.xyz-compare-table-wrap{
  overflow: visible !important;
}

.xyz-compare-table-scroll{
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: visible;
  padding-right: 28px; /* gives breathing room so last column isn't visually cut */
  box-sizing: border-box;
}

.xyz-compare{
  width: max-content; /* size to content so scroll reaches the real end */
  min-width: 100%;
}

.xyz-compare__th--product{ width: 300px; }


/* Loading state */
.xyz-compare-loading{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin: 12px 0;
  border-radius: var(--xyz-radius-lg);
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.82);
  color: rgba(0,0,0,.75);
}
.xyz-spinner{
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,.18);
  border-top-color: rgba(0,0,0,.55);
  animation: xyzspin .8s linear infinite;
}
@keyframes xyzspin { to { transform: rotate(360deg); } }

/* Back button */
.xyz-back-btn{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.12);
  background: rgba(255,255,255,.65);
  cursor: pointer;
  font-size: 13px;
  opacity: .9;
  margin-bottom: 10px;
}
.xyz-back-btn:hover{ opacity: 1; }
.xyz-back-btn__txt{ font-weight: 600; }

/* Mobile FAB (single button) */
.xyz-compare-fab{
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 999px;
  background: rgba(22,22,22,.92);
  color: #fff;
  text-decoration: none;
  box-shadow: var(--xyz-shadow);
  backdrop-filter: blur(10px);
}
.xyz-compare-fab__icon{ font-size: 16px; line-height: 1; opacity: .95; }
.xyz-compare-fab__badge{
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* Show desktop bar on desktop, FAB on mobile */
.xyz-compare-minibar__mobile{ display:none; }
@media (max-width: 767px){
  .xyz-compare-minibar__desktop{ display:none; }
  .xyz-compare-minibar__mobile{ display:inline-flex; }
  .xyz-compare-minibar{ left: 0; right: 0; bottom: 0; pointer-events: none; }
  .xyz-compare-minibar__mobile{ pointer-events: all; }
}


/* Make the mobile compare button pop a bit more */
.xyz-compare-fab{
  background: var(--wp--preset--color--primary, #2563eb);
  color: #fff;
}
.xyz-compare-fab:hover{
  filter: brightness(1.05);
}
.xyz-compare-fab__badge{
  background: rgba(255,255,255,.22);
}


@media (max-width: 767px){
  .xyz-compare-minibar{ pointer-events: none; }
  .xyz-compare-fab{ pointer-events: all; }
}


/* Floating compare button (desktop + mobile) */
.xyz-compare-minibar{
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 9999;
  pointer-events: none;
}
.xyz-compare-minibar[hidden]{ display:none; }
.xyz-compare-fabwrap{ pointer-events: all; display:inline-flex; gap:10px; align-items:center; }

.xyz-compare-fab{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--xyz-shadow);
  backdrop-filter: blur(10px);
  font-size: 14px;
  line-height: 1;
  color: #fff;
  background: var(--wp--preset--color--primary, #2563eb);
  position: relative;
}
.xyz-compare-fab--clear{
  background: rgba(22,22,22,.92);
  padding: 12px 12px;
}
.xyz-compare-fab__icon{ font-size: 16px; opacity: .95; }
.xyz-compare-fab__text{ font-weight: 700; letter-spacing: .2px; }
.xyz-compare-fab__badge{
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255,255,255,.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}
.xyz-compare-fab:hover{ filter: brightness(1.05); }

.xyz-compare-fab__spinner{
  display:none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: rgba(255,255,255,.95);
  animation: xyzspin .8s linear infinite;
}
.xyz-compare-fab--compare.is-loading .xyz-compare-fab__spinner{ display:inline-block; }
.xyz-compare-fab--compare.is-loading .xyz-compare-fab__badge{ display:none; }

@media (max-width: 767px){
  .xyz-compare-minibar{ left: 12px; bottom: 12px; }
  .xyz-compare-fab__text{ display:none; }
  .xyz-compare-fab{ padding: 12px 12px; }
}


/* Selected state for Compare toggle buttons */
[data-xyz-compare-toggle="1"].is-active{
  background: rgba(0,0,0,.08);
  border-color: rgba(0,0,0,.20);
  box-shadow: none;
}
