/* ==========================================================================
   productCardSeo.css — Product Card SSR Styles
   BEM Block: .pcs (product-card-seo)
   Pixel-perfect parity with ptz-card showcase-vertical-md
   Mobile-first responsive layout
   TODO: Mover para SASS depois de corrigir problemas do GULP
   ========================================================================== */

/* --------------------------------------------------------------------------
   0 — Grid container fix
   -------------------------------------------------------------------------- */

.card-product-showcase {
  min-width: 0;
  overflow: visible;
}

#listProductsShowcase ul {
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   1 — Card container (.pcs = .ptz-card.ptz-card-showcase.ptz-card-showcase-vertical-md)
   -------------------------------------------------------------------------- */

.pcs {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 9.5rem;   /* 152px mobile */
  min-width: 9.5rem;
  padding: 0;
  background-color: transparent;
  border: none;
  border-radius: 0;
  box-sizing: border-box;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  color: #1D1D1D;
}

/* --------------------------------------------------------------------------
   2 — Link wrapper (engloba todo o card: portrayal + content)
   -------------------------------------------------------------------------- */

.pcs__link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.pcs__link:hover,
.pcs__link:focus {
  text-decoration: none;
  color: inherit;
}

/* --------------------------------------------------------------------------
   3 — Portrayal (.pcs__portrayal = .ptz-card-portrayal)
   -------------------------------------------------------------------------- */

.pcs__portrayal {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 9.5rem;  /* 152px mobile */
  padding: 1rem 0; /* 16px top/bottom */
  border: 1px solid #EEEEEE;
  border-radius: 0.5rem; /* 8px */
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   4 — Image (.pcs__image = .ptz-card-image)
   -------------------------------------------------------------------------- */

.pcs__image {
  display: block;
  width: 8rem;     /* 128px mobile — matches DS */
  height: auto;
  object-fit: cover;
  z-index: 1;
}

/* Override legado .card-product a img { width: 100px } */
.card-product-showcase .pcs .pcs__image {
  width: 8rem !important;
  height: auto !important;
}

@media screen and (min-width: 768px) {
  .card-product-showcase .pcs .pcs__image {
    width: 10rem !important;
  }
}

/* Fallback when image fails */
.pcs__image[alt]:not([src]),
.pcs__image[alt][src=""] {
  font-size: 0.75rem;
  color: #747474;
  text-align: center;
  word-break: break-word;
}

/* --------------------------------------------------------------------------
   5 — Tag/Badge (.pcs__tag = .ptz-card-tag inside .ptz-card-showcase .ptz-card-portrayal)
   -------------------------------------------------------------------------- */

.pcs__tag {
  position: absolute;
  left: 0;
  top: 0.5rem;     /* 8px mobile */
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.25rem 0.5rem;  /* 4px 8px mobile */
  border-radius: 0 0.5rem 0.5rem 0; /* 0 8px 8px 0 mobile */
  font-size: 0.875rem;  /* 14px */
  font-weight: 700;
  line-height: 132%;
  white-space: nowrap;
  min-width: max-content;
}

.pcs__tag--discount {
  background-color: #F9E6B3;
  color: #1D1D1D;
}

.pcs__tag--blackfriday {
  background-color: #E8551F;
  color: #FFFFFF;
}

/* --------------------------------------------------------------------------
   6 — CTA Button (.pcs__cta = .ptz-card-button inside .ptz-card-showcase)
   -------------------------------------------------------------------------- */

.pcs__cta {
  position: absolute;
  right: 1rem;    /* 16px — matches $petz-spacing-sm */
  top: calc(9.5rem - 1rem - 3rem); /* portrayal height - bottom offset - button height */
  z-index: 3;     /* acima do link */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;    /* 8px */
  width: 3rem;    /* 48px — $petz-spacing-2xl */
  height: 3rem;   /* 48px — $petz-spacing-2xl */
  padding: 0;
  border: none;
  border-radius: 15.625rem; /* $petz-rounded-max */
  background-color: #1D1D1D;
  color: #FFFFFF;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: 0;
  overflow: hidden;
}

.pcs__cta:hover {
  background-color: #454545;
}

.pcs__cta:disabled,
.pcs__cta[disabled] {
  background-color: #EEEEEE;
  cursor: not-allowed;
}

/* Plus icon via DS font icon */
.pcs__cta::before {
  content: '\f493'; /* ds-plus */
  font-family: 'ds-icon-line';
  font-style: normal;
  font-weight: normal;
  font-size: 1.25rem; /* ptz-icon-md */
  color: #FFFFFF;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.pcs__cta-text {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  font-size: 0;
}

/* CTA — Loading */
.pcs__cta--loading::before {
  display: none;
}

.pcs__cta--loading .pcs__cta-spinner {
  display: block;
}

.pcs__cta-spinner {
  display: none;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid #FFFFFF;
  border-top-color: transparent;
  border-radius: 50%;
  animation: pcs-spin 0.6s linear infinite;
}

@keyframes pcs-spin {
  to { transform: rotate(360deg); }
}

/* CTA — Success */
.pcs__cta--success {
  background-color: #34AD51;
}

.pcs__cta--success:hover {
  background-color: #34AD51;
}

.pcs__cta--success::before {
  display: none;
}

.pcs__cta--success .pcs__cta-check {
  display: block;
}

.pcs__cta-check {
  display: none;
  font-size: 1.125rem;
  line-height: 1;
  color: #FFFFFF;
}

/* CTA — Notify (out of stock): same black button, notification icon instead of + */
.pcs__cta--notify {
  background-color: #1D1D1D;
}

.pcs__cta--notify::before {
  content: '\f46d'; /* ds-petz-notification */
  font-family: 'ds-icon-line';
  font-style: normal;
  font-weight: normal;
  font-size: 1.25rem; /* ptz-icon-md */
  color: #FFFFFF;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.pcs__cta--notify:hover {
  background-color: #454545;
}

/* --------------------------------------------------------------------------
   7 — Content area (.pcs__content = .ptz-card-content)
   -------------------------------------------------------------------------- */

.pcs__content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
}

/* --------------------------------------------------------------------------
   8 — Badges carousel (.pcs__badges = ptz-card-badges-carousel)
   Posicionados fora do <a>, absolute sobre a área do nome.
   Mobile: visíveis sempre entre portrayal e preço
   Desktop: ocultos, aparecem no hover sobre o nome
   -------------------------------------------------------------------------- */

.pcs__badges {
  display: flex;
  gap: 0.5rem; /* 8px */
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  width: 100%;
  padding-top: 0.5rem;
  margin-top: -0.5rem;
}

.pcs__badges::-webkit-scrollbar {
  display: none;
}

/* Badges wrapper — absolute, sobre a área do nome */
.pcs__badges-wrapper {
  position: absolute;
  left: 0;
  right: 0;
  top: 9.5rem; /* mobile: logo abaixo do portrayal (152px) */
  z-index: 3;  /* acima do link */
  padding-top: 1rem; /* 16px — espaço visual como no DS */
  width: 100%;
  overflow: visible;
}

/* Badges arrows — hidden on mobile */
.pcs__badges-arrow {
  display: none;
}

/* Selector badge (.pcs__badge-selector = .ptz-selector) */
.pcs__badge-selector {
  all: unset;
  box-sizing: border-box;
  display: flex;
  cursor: default; /* mobile: read-only, not clickable */
  position: relative;
  padding: 0.25rem 0.5rem;  /* 4px 8px — mobile (ptz-spacing-3xs ptz-spacing-2xs) */
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  color: #747474; /* mobile: ptz-selector-view color = neutral-dark */
  width: max-content;
  text-align: center;
  font-family: inherit;
  font-style: normal;
  font-weight: 700;
  font-size: 0.875rem;  /* 14px */
  line-height: 132%;
  border-radius: 0.5rem; /* 8px */
  background-color: #F5F5F5; /* mobile: ptz-selector-view bg */
  border: 0.0625rem solid #F5F5F5; /* mobile: ptz-selector-view border */
  height: 1.5rem;        /* 24px — mobile sm size */
  max-height: 1.5rem;
  white-space: nowrap;
  flex-shrink: 0;
  pointer-events: none; /* mobile: not interactive */
}

.pcs__badge-selector:hover {
  border-color: #F5F5F5; /* mobile: no hover effect */
}

/* Selected state — mobile: view style (read-only, no visual distinction) */
.pcs__badge-selector[aria-pressed="true"],
.pcs__badge-selector--selected {
  color: #747474;
  background-color: #F5F5F5;
  border-color: #F5F5F5;
}

/* Unavailable state */
.pcs__badge-selector--unavailable {
  color: #747474;
  background-color: #F5F5F5;
  border-color: #F5F5F5;
}

/* Notification icon — hidden on mobile, shown on desktop only */
.pcs__badge-selector--unavailable::before {
  display: none;
}

/* Sale state — mobile: view style (same as all others) */
.pcs__badge-selector--sale {
  color: #747474;
  border-color: #F5F5F5;
  background-color: #F5F5F5;
}

/* Combo state — mobile: view style (same as all others) */
.pcs__badge-selector--combo {
  color: #747474;
  border-color: #F5F5F5;
  background-color: #F5F5F5;
}

/* --------------------------------------------------------------------------
   9 — Label/Name (.pcs__name = .ptz-card-label-left inside showcase)
   -------------------------------------------------------------------------- */

.pcs__name {
  margin: 0;
  padding: 0;
  font-size: 0.875rem;  /* 14px */
  font-weight: 400;
  line-height: 132%;
  color: #1D1D1D;
  text-align: left;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
  overflow: hidden;
  min-height: 56px;
  max-height: 3.5rem;  /* 56px */
  width: 100%;
  word-break: break-word;
  margin-top: 3rem; /* 48px — espaço fixo no mobile, alinha textos entre cards com/sem variações */
  margin-bottom: 0.5rem; /* 8px mobile */
  transition: opacity 300ms ease-out;
}

/* Quando há variações, o espaço é preenchido pelos badges absolute — mesmo margin-top */
.pcs--has-variations .pcs__name {
  margin-top: 3rem;
}

/* --------------------------------------------------------------------------
   10 — Price section (.pcs__price-section = ptz-card-price-section showcase)
   -------------------------------------------------------------------------- */

.pcs__price-section {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: auto;
}

/* "A partir de" complement */
.pcs__price-complement {
  font-size: 0.75rem;  /* 12px */
  font-weight: 400;
  color: #747474;
  line-height: 132%;
}

/* Old/crossed price */
.pcs__price-old {
  font-size: 0.75rem;  /* 12px */
  font-weight: 400;
  color: #747474;
  margin-left: 0;
  line-height: 132%;
}

.pcs__price-old-value {
  text-decoration: line-through;
}

/* Current price */
.pcs__price-current {
  font-size: 1rem;    /* 16px */
  font-weight: 700;
  color: #454545;
  line-height: 132%;
}

/* Installments */
.pcs__installments {
  display: block;
  font-size: 0.75rem; /* 12px */
  font-weight: 400;
  color: #747474;
  line-height: 132%;
}

/* --------------------------------------------------------------------------
   11 — Subscription section (.pcs__subscription = .ptz-card-subscription)
   -------------------------------------------------------------------------- */

.pcs__subscription {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-top: 0.75rem;  /* 12px */
  font-weight: 400;
  font-size: 1rem;      /* 16px */
  line-height: 108%;
  width: 100%;
}

/* Subscription price row */
.pcs__subscription-price {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  align-items: flex-end;
  font-size: 1rem;     /* 16px */
  font-weight: 700;
  color: #175EA8;
  height: 1rem;        /* 16px */
  margin: 0;
}

.pcs__subscription-price-value {
  display: flex;
  align-items: flex-end;
}

/* Subscription icon (uses DS icon font) */
.pcs__subscription-icon {
  font-size: 1.125rem;  /* ptz-icon-sm */
  color: #175EA8;       /* ptz-icon-primary-brand */
  margin-left: 0.25rem; /* 4px */
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

/* Subscription text */
.pcs__subscription-text {
  margin: 0;
  display: flex;
  font-size: 0.75rem;  /* 12px */
  color: #175EA8;
  line-height: 108%;
  align-items: flex-end;
}

/* --------------------------------------------------------------------------
   12 — Unavailable card state
   -------------------------------------------------------------------------- */

.pcs--unavailable .pcs__image {
  opacity: 0.5;
}

.pcs--unavailable .pcs__price-section {
  opacity: 0.6;
}

.pcs--unavailable .pcs__subscription {
  display: none;
}

/* --------------------------------------------------------------------------
   13 — Desktop (min-width: 768px)
   -------------------------------------------------------------------------- */

@media screen and (min-width: 768px) {

  /* Card size md desktop: 184px */
  .pcs {
    width: 11.5rem;   /* 184px */
    min-width: auto;
  }

  /* Portrayal height: 184px */
  .pcs__portrayal {
    height: 11.5rem;  /* 184px */
  }

  /* Image: 160px wide, max-height 176px (matches DS exactly) */
  .pcs__image {
    width: 10rem !important;
    max-height: 11rem;
  }

  /* Tag: top 16px, padding 8px 12px, radius 0 4px 4px 0 */
  .pcs__tag {
    top: 1rem;         /* 16px */
    padding: 0.5rem 0.75rem; /* 8px 12px */
    border-radius: 0 0.25rem 0.25rem 0; /* 0 4px 4px 0 */
  }

  /* Content: padding-top 16px */
  .pcs__content {
    padding-top: 1rem; /* 16px */
  }

  /* Name: 2-line clamp, min-height 38px, margin-bottom 16px */
  .pcs__name {
    -webkit-line-clamp: 2;
    min-height: 2.375rem; /* 38px */
    max-height: 3rem;     /* 48px */
    margin-top: 0;
    margin-bottom: 1rem;  /* 16px */
  }

  /* Badges: positioned over name area, hidden by default */
  .pcs__badges-wrapper {
    top: calc(11.5rem + 1rem); /* portrayal 184px + content padding-top 16px */
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease-out;
    padding-top: 0;
  }

  .pcs__badges {
    margin-bottom: 0;
    padding-left: 0.5rem;
    margin-left: -0.5rem;
  }

  /* Name: no extra margin on desktop (badges overlay on hover) */
  .pcs--has-variations .pcs__name {
    margin-top: 0;
  }

  /* Hover: show badges, hide name */
  .pcs:hover .pcs__badges-wrapper {
    opacity: 1;
    pointer-events: auto;
  }

  .pcs--has-variations:hover .pcs__name {
    opacity: 0;
  }

  /* CTA: reposition for desktop portrayal (184px height) */
  .pcs__cta {
    top: calc(11.5rem - 1rem - 3rem); /* portrayal 184px - bottom offset - button height */
  }
}

/* --------------------------------------------------------------------------
   14 — Animations for desktop hover (matching ptz-card-showcase-animated)
   -------------------------------------------------------------------------- */

@media screen and (min-width: 768px) {
  .pcs__name {
    opacity: 1;
    overflow: hidden;
    transition: opacity 300ms ease-out;
  }

  /* Desktop: badges are interactive (clickable) */
  .pcs__badge-selector {
    cursor: pointer;
    pointer-events: auto;
    color: #454545;
    background-color: transparent;
    border: 0.0625rem solid #D5D5D5;
    padding: 0 0.75rem; /* 0 12px — desktop size */
    height: 2rem;       /* 32px — ptz-selector-md */
    max-height: 2rem;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
  }

  /* Padding for icon overflow */
  .pcs__badges {
    padding: 0.5rem;
    padding-right: 0;
    margin-left: -0.5rem;
    margin-top: -0.25rem;
  }

  .pcs__badge-selector:hover {
    border-color: #1D1D1D;
  }

  .pcs__badge-selector[aria-pressed="true"],
  .pcs__badge-selector--selected {
    color: #FFFFFF;
    background-color: #1D1D1D;
    border-color: #1D1D1D;
  }

  .pcs__badge-selector--unavailable {
    color: #D5D5D5;
    background-color: transparent;
    border-color: #EEEEEE;
    cursor: not-allowed;
  }

  .pcs__badge-selector--unavailable::before {
    content: '\f46d';
    font-family: 'ds-icon-line';
    font-style: normal;
    font-weight: normal;
    font-size: 0.75rem;
    color: #454545;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: absolute;
    top: -0.5rem;
    left: -0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 1rem;
    height: 1rem;
    border-radius: 15.625rem;
    border: 0.0625rem solid #EEEEEE;
    background-color: #FFFFFF;
  }

  .pcs__badge-selector--sale {
    color: #FF5045;
    background-color: transparent;
    border-color: #FF5045;
  }

  .pcs__badge-selector--combo {
    color: #454545;
    background-color: transparent;
    border-color: #D5D5D5;
  }

  /* Combo icon inline (ds-grin-tongue-wink) — circle with green background, before text */
  .pcs__badge-selector--combo::before {
    content: '\f355';
    font-family: 'ds-icon-line';
    font-style: normal;
    font-weight: normal;
    font-size: 0.875rem; /* ptz-icon-2xs */
    color: #454545;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: static;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 15.625rem;
    border: none;
    background-color: #D9ECE3; /* ptz-color-sup-green-light */
    flex-shrink: 0;
  }

  /* Badges carousel arrows (desktop only) */
  .pcs__badges-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 1.25rem;
    height: 100%;
    border: none;
    background-color: #FFFFFF;
    cursor: pointer;
    padding: 0;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0;
    color: #175EA8; /* ptz-icon-primary-brand */
  }

  .pcs__badges-arrow::before {
    font-family: 'ds-icon-line';
    font-style: normal;
    font-weight: normal;
    font-size: 1.25rem; /* ptz-icon-md */
    color: #175EA8;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  .pcs__badges-arrow--left::before {
    content: '\f459'; /* ds-petz-chevron-left */
  }

  .pcs__badges-arrow--right::before {
    content: '\f45a'; /* ds-petz-chevron-right */
  }

  .pcs__badges-arrow--left {
    left: -0.5;
    padding-left: 0.5rem;
    padding-right: 0.25rem;
  }

  .pcs__badges-arrow--right {
    right: 0;
  }

  .pcs__badges-arrow--visible {
    display: flex;
  }
}
