/**
 * WooCommerce Products Showcase Widget — Styles
 *
 * @package    woo-products-widget
 * @developer  TheTechiez (https://thetechiez.com)
 * @version    2.0.0
 *
 * Design language: Matches Certification Showcase Widget
 * Fonts: DM Serif Display (headings) + Inter (body)
 */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Inter:wght@300;400;500;600;700&display=swap');

/* ============================================================
   1. Variables
   ============================================================ */
.wpw-wrap {
  --wpw-accent: #c0151a;
  --wpw-ink: #1a1714;
  --wpw-ink-mid: #444444;
  --wpw-ink-muted: #888888;
  --wpw-border: rgba(0, 0, 0, 0.08);
  --wpw-bg: #f0ede8;
  --wpw-white: #ffffff;
  --wpw-font-serif: 'DM Serif Display', Georgia, serif;
  --wpw-font-sans: 'Inter', system-ui, sans-serif;
  --wpw-shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06), 0 0 1px rgba(0, 0, 0, 0.04);
  --wpw-shadow-hover: 0 16px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  --wpw-radius: 12px;

  font-family: var(--wpw-font-sans);
  color: var(--wpw-ink);
  -webkit-font-smoothing: antialiased;
}

.wpw-wrap *,
.wpw-wrap *::before,
.wpw-wrap *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ============================================================
   2. Hero Banner
   ============================================================ */
.wpw-hero {
  position: relative;
  min-height: 200px;
  background: var(--wpw-ink);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.wpw-hero-overlay {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 55%;
  pointer-events: none;
}

.wpw-hero-inner {
  position: relative;
  z-index: 1;
  padding: 48px 52px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wpw-hero-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--wpw-accent);
}

.wpw-hero-title {
  font-family: var(--wpw-font-serif);
  font-size: clamp(28px, 3.5vw, 46px);
  font-weight: 400;
  color: var(--wpw-white);
  line-height: 1.08;
}

.wpw-hero-title em {
  font-style: italic;
  color: var(--wpw-accent);
}

.wpw-hero-breadcrumb {
  font-size: 12px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.04em;
  margin-top: 4px;
}

/* ============================================================
   3. Body Layout
   ============================================================ */
.wpw-body {
  display: grid;
  grid-template-columns: 252px 1fr;
  background: var(--wpw-bg);
  min-height: 560px;
}

/* ============================================================
   4. Sidebar
   ============================================================ */
.wpw-sidebar {
  background: var(--wpw-white);
  border-right: 1px solid var(--wpw-border);
  padding-top: 32px;
}

.wpw-sidebar-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--wpw-ink-muted);
  padding: 0 20px 14px;
  border-bottom: 1px solid var(--wpw-border);
  margin-bottom: 4px;
}

.wpw-cat-list {
  list-style: none;
}

.wpw-cat-item {
  border-left: 2px solid transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.wpw-cat-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--wpw-ink-mid);
  text-decoration: none;
  transition: color 0.2s ease;
  cursor: pointer;
}

.wpw-cat-item:hover {
  border-left-color: var(--wpw-accent);
  background: var(--wpw-bg);
}

.wpw-cat-item:hover a {
  color: var(--wpw-ink);
}

.wpw-cat-item.active {
  border-left-color: var(--wpw-accent);
  background: color-mix(in srgb, var(--wpw-accent) 8%, white);
}

.wpw-cat-item.active a {
  color: var(--wpw-accent);
  font-weight: 600;
}

.wpw-cat-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--wpw-ink-muted);
  background: var(--wpw-bg);
  padding: 2px 8px;
  border-radius: 20px;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

.wpw-cat-item.active .wpw-cat-count {
  color: var(--wpw-accent);
  background: color-mix(in srgb, var(--wpw-accent) 10%, white);
}

/* ============================================================
   5. Products Area
   ============================================================ */
.wpw-products-area {
  padding: 36px 32px;
  min-height: 560px;
}

/* Category header */
.wpw-cat-header {
  margin-bottom: 28px;
  animation: wpw-fadeUp 0.3s ease both;
}

.wpw-cat-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--wpw-accent);
  margin-bottom: 8px;
}

.wpw-cat-title {
  font-family: var(--wpw-font-serif);
  font-size: clamp(26px, 2.5vw, 36px);
  font-weight: 400;
  color: var(--wpw-ink);
  line-height: 1.08;
  margin-bottom: 16px;
}

.wpw-cat-desc {
  font-size: 14px;
  line-height: 1.78;
  color: var(--wpw-ink-muted);
  max-width: 660px;
  padding-top: 16px;
  border-top: 1px solid var(--wpw-border);
}

/* ============================================================
   6. Product Grid
   ============================================================ */
.wpw-products-grid {
  display: grid;
  gap: 18px;
  animation: wpw-fadeUp 0.35s ease 0.06s both;
}

.wpw-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.wpw-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.wpw-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* ============================================================
   7. Product Card
   ============================================================ */
.wpw-product-card {
  background: var(--wpw-white);
  border-radius: var(--wpw-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--wpw-shadow-card);
  border: 1px solid var(--wpw-border);
  transition: box-shadow 0.28s ease, transform 0.28s ease, border-color 0.28s ease;
}

.wpw-product-card:hover {
  box-shadow: var(--wpw-shadow-hover);
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--wpw-accent) 25%, transparent);
}

/* Image area — white background, no grey fill */
.wpw-product-img-wrap {
  display: block;
  background: var(--wpw-white);
  aspect-ratio: 4/3;
  overflow: hidden;
  border-bottom: 1px solid var(--wpw-border);
  position: relative;
}

.wpw-product-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 20px;
  transition: transform 0.4s ease;
}

.wpw-product-card:hover .wpw-product-img-wrap img {
  transform: scale(1.05);
}

/* Tag badge */
.wpw-product-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  font-family: var(--wpw-font-sans);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--wpw-accent);
  color: var(--wpw-white);
  padding: 3px 9px;
  border-radius: 20px;
}

/* Product info */
.wpw-product-info {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 12px;
}

.wpw-product-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--wpw-ink);
  line-height: 1.45;
}

.wpw-product-name a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

.wpw-product-name a:hover {
  color: var(--wpw-accent);
}

/* Quote button (Square, Uppercase Style) */
.wpw-quote-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wpw-accent);
  color: var(--wpw-white);
  padding: 16px 30px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 0;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.22s ease, color 0.22s ease;
  width: 100%;
  margin-top: auto;
  line-height: 1;
}

.wpw-quote-btn:hover {
  background: #a81015;
  /* Darker red */
  color: var(--wpw-white);
}

.wpw-quote-btn svg {
  display: none !important;
}

/* Specific layout for the shortcode button on single product pages */
.single-product-quote-btn {
  margin-top: 20px;
}

/* ============================================================
   8. Loading & Empty States
   ============================================================ */
.wpw-loading-state,
.wpw-empty-prompt,
.wpw-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-height: 360px;
  gap: 14px;
  color: var(--wpw-ink-muted);
  text-align: center;
}

.wpw-empty-prompt p,
.wpw-empty-state p {
  font-size: 14px;
  max-width: 260px;
  line-height: 1.6;
}

.wpw-spinner {
  width: 32px;
  height: 32px;
  border: 2.5px solid var(--wpw-border);
  border-top-color: var(--wpw-accent);
  border-radius: 50%;
  animation: wpw-spin 0.7s linear infinite;
}

/* ============================================================
   9. Animations
   ============================================================ */
@keyframes wpw-spin {
  to {
    transform: rotate(360deg);
  }
}

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

@keyframes wpw-fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   10. Quote Popup
   ============================================================ */
.wpw-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 23, 20, 0.52);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.wpw-popup-overlay.wpw-popup--open {
  opacity: 1;
  visibility: visible;
}

.wpw-popup {
  background: var(--wpw-white);
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 0;
  position: relative;
  transform: translateY(22px);
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.2);
}

.wpw-popup-overlay.wpw-popup--open .wpw-popup {
  transform: translateY(0);
}

.wpw-popup-inner {
  padding: 24px;
}

.wpw-popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--wpw-ink-muted);
  width: 32px;
  height: 32px;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.wpw-popup-close:hover {
  background: var(--wpw-bg);
  color: var(--wpw-accent);
}

.wpw-popup-close svg {
  display: block !important;
}

/* Product row in popup */
.wpw-popup-product-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--wpw-bg);
  border-radius: 0;
  padding: 10px;
  margin-bottom: 16px;
}

.wpw-popup-product-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: var(--wpw-white);
  border-radius: 0;
  padding: 4px;
  border: 1px solid var(--wpw-border);
  flex-shrink: 0;
}

.wpw-popup-product-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--wpw-accent);
  margin-bottom: 2px;
}

.wpw-popup-product-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--wpw-ink);
  line-height: 1.35;
}

.wpw-popup-heading {
  font-family: var(--wpw-font-serif);
  font-size: 24px;
  font-weight: 400;
  color: var(--wpw-ink);
  margin-bottom: 4px;
  line-height: 1.1;
}

.wpw-popup-subtext {
  font-size: 12px;
  color: var(--wpw-ink-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* Form fields */
.wpw-form-row {
  margin-bottom: 12px;
}

.wpw-form-half {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.wpw-field-wrap label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--wpw-ink);
  margin-bottom: 4px;
}

.wpw-field-wrap label span {
  color: var(--wpw-accent);
}

.wpw-field-wrap input,
.wpw-field-wrap textarea {
  width: 100%;
  padding: 8px 12px;
  font-family: var(--wpw-font-sans);
  font-size: 13px;
  color: var(--wpw-ink);
  background: var(--wpw-bg);
  border: 1.5px solid var(--wpw-border);
  border-radius: 0;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.wpw-field-wrap input:focus,
.wpw-field-wrap textarea:focus {
  border-color: var(--wpw-accent);
  background: var(--wpw-white);
}

.wpw-field-wrap textarea {
  resize: vertical;
  min-height: 90px;
}

.wpw-form-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.wpw-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--wpw-accent);
  color: var(--wpw-white);
  border: none;
  padding: 12px 28px;
  border-radius: 40px;
  font-family: var(--wpw-font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}

.wpw-submit-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.wpw-submit-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.wpw-form-note {
  font-size: 12px;
  color: var(--wpw-ink-muted);
  line-height: 1.5;
}

.wpw-spin {
  animation: wpw-spin 0.8s linear infinite;
}

/* reCAPTCHA badge — push to above footer */
.wpw-quote-form .grecaptcha-badge {
  visibility: hidden;
}

/* Success state */
.wpw-form-success {
  text-align: center;
  padding: 32px 20px;
}

.wpw-success-icon {
  width: 60px;
  height: 60px;
  background: #e8f5e9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: #2e7d32;
}

.wpw-form-success h3 {
  font-family: var(--wpw-font-serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--wpw-ink);
  margin-bottom: 8px;
}

.wpw-form-success p {
  font-size: 14px;
  color: var(--wpw-ink-muted);
  line-height: 1.65;
  max-width: 340px;
  margin: 0 auto;
}

/* Body scroll lock */
body.wpw-locked {
  overflow: hidden;
}

/* ============================================================
   11. Responsive
   ============================================================ */
@media (max-width: 960px) {
  .wpw-body {
    grid-template-columns: 210px 1fr;
  }

  .wpw-cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .wpw-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .wpw-products-area {
    padding: 28px 20px;
  }
}

@media (max-width: 680px) {
  .wpw-body {
    grid-template-columns: 1fr;
  }

  .wpw-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--wpw-border);
    padding-top: 16px;
    padding-bottom: 4px;
  }

  .wpw-sidebar-label {
    padding-bottom: 10px;
  }

  .wpw-cat-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 16px 14px;
  }

  .wpw-cat-item {
    border-left: none !important;
    border-radius: 40px;
    background: transparent !important;
  }

  .wpw-cat-item a {
    padding: 7px 14px;
    font-size: 13px;
    border-radius: 40px;
  }

  .wpw-cat-item.active {
    background: color-mix(in srgb, var(--wpw-accent) 10%, white) !important;
  }

  .wpw-cat-count {
    display: none;
  }

  .wpw-products-area {
    padding: 20px 16px;
  }

  .wpw-cols-2,
  .wpw-cols-3,
  .wpw-cols-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .wpw-hero-inner {
    padding: 32px 24px;
  }

  .wpw-form-half {
    grid-template-columns: 1fr;
  }

  .wpw-popup-inner {
    padding: 20px;
  }
}

@media (max-width: 400px) {

  .wpw-cols-2,
  .wpw-cols-3,
  .wpw-cols-4 {
    grid-template-columns: 1fr;
  }
}