/*
 * WooPrice Sync Pro — Frontend Styles
 * Palette: #21759B primary · #1E1E23 surface · #00A0D2 accent · #0E1116 bg · #F4F6F8 text
 */

/* ── CSS custom properties ─────────────────────────────────────── */
:root {
  --wpsp-primary: #21759b;
  --wpsp-secondary: #1e1e23;
  --wpsp-accent: #00a0d2;
  --wpsp-bg: #0e1116;
  --wpsp-text: #f4f6f8;
  --wpsp-text-muted: #8d9ead;
  --wpsp-border: #2a3540;
  --wpsp-radius: 4px;
  --wpsp-transition: 150ms ease;
}

/* ── Price wrapper ──────────────────────────────────────────────── */
.wc-otw-wpsp-wrapper {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: inherit;
  position: relative;
  transition: opacity var(--wpsp-transition);
}

/* Loading state — dim without layout shift */
.wc-otw-wpsp-wrapper.is-loading {
  opacity: 0.5;
  pointer-events: none;
  cursor: wait;
}

/* ── Label ──────────────────────────────────────────────────────── */
.wc-otw-wpsp-label {
  font-size: 0.875rem;
  color: var(--wpsp-text-muted);
  font-weight: 500;
  white-space: nowrap;
}

/* ── Price value ────────────────────────────────────────────────── */
.wc-otw-wpsp-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--wpsp-accent);
  line-height: 1;
}

.wc-otw-wpsp-price ins {
  text-decoration: none;
}

.wc-otw-wpsp-price del {
  opacity: 0.5;
}

.wc-otw-wpsp-price .woocommerce-Price-currencySymbol {
  font-size: 0.85em;
}

/* ── Discount badge ─────────────────────────────────────────────── */
.wc-otw-wpsp-discount-badge {
  display: inline-flex;
  align-items: center;
  background-color: var(--wpsp-secondary);
  color: var(--wpsp-text);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  padding: 0.25em 0.55em;
  border-radius: var(--wpsp-radius);
  white-space: nowrap;
  vertical-align: middle;
  user-select: none;
}

/* ── Loading spinner ────────────────────────────────────────────── */
.wc-otw-wpsp-loading {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 0.9em;
  height: 0.9em;
  border: 2px solid var(--wpsp-border);
  border-top-color: var(--wpsp-accent);
  border-radius: 50%;
  animation: wpsp-spin 0.6s linear infinite;
  pointer-events: none;
}

@keyframes wpsp-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .wc-otw-wpsp-wrapper,
  .wc-otw-wpsp-loading {
    transition: none;
    animation: none;
  }

  .wc-otw-wpsp-wrapper.is-loading {
    opacity: 0.7;
  }
}

/* ── Dark-surface product card integration ──────────────────────── */
.wc-otw-wpsp-wrapper--card {
  background: var(--wpsp-secondary);
  border: 1px solid var(--wpsp-border);
  border-radius: var(--wpsp-radius);
  padding: 0.75rem 1rem;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.wc-otw-wpsp-wrapper--card .wc-otw-wpsp-price {
  font-size: 1.5rem;
}

/* ── Focus / keyboard visibility ────────────────────────────────── */
.wc-otw-wpsp-wrapper:focus-within {
  outline: 2px solid var(--wpsp-accent);
  outline-offset: 2px;
}
