/* ==========================================================================
   CollectorStore Acrylic Upsell — Frontend Widget
   Uses site CSS variables so the widget inherits future theme changes.
   ========================================================================== */

:root {
  /* Fallbacks if the theme variables are not present */
  --fs-color-primary:      #1a76bb;
  --fs-color-secondary:    #e30a12;
  --rounded-corners-radius: 16px;
}

/* Widget wrapper ----------------------------------------------------------- */
.cs-acrylic-widget {
  margin-top: 24px;
  margin-bottom: 8px;
}

/* Section label ------------------------------------------------------------ */
.cs-acrylic-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 10px;
}

/* Card --------------------------------------------------------------------- */
.cs-acrylic-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: #fff;
  border: 1px solid #e4e4e4;
  border-radius: var(--rounded-corners-radius, 16px);
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Image -------------------------------------------------------------------- */
.cs-acrylic-image-wrap {
  flex-shrink: 0;
}

.cs-acrylic-img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: calc(var(--rounded-corners-radius, 16px) - 4px);
  display: block;
}

.cs-acrylic-img--placeholder {
  width: 90px;
  height: 90px;
  background: #f4f4f4;
  border-radius: calc(var(--rounded-corners-radius, 16px) - 4px);
  border: 1px dashed #ccc;
}

/* Info column -------------------------------------------------------------- */
.cs-acrylic-info {
  flex: 1;
  min-width: 0;
}

.cs-acrylic-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #4a4a4a;
  margin: 0 0 4px;
  line-height: 1.3;
}

.cs-acrylic-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--fs-color-primary, #1a76bb);
  margin: 0 0 12px;
}

.cs-acrylic-price .woocommerce-Price-amount {
  color: inherit;
}

/* Actions row -------------------------------------------------------------- */
.cs-acrylic-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Quantity stepper --------------------------------------------------------- */
.cs-acrylic-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid #d0d0d0;
  border-radius: var(--rounded-corners-radius, 16px);
  overflow: hidden;
  background: #fff;
}

.cs-qty-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  color: #4a4a4a;
  width: 34px;
  height: 38px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  padding: 0;
}

.cs-qty-btn:hover {
  background: #f0f0f0;
}

.cs-qty-btn:focus-visible {
  outline: 2px solid var(--fs-color-primary, #1a76bb);
  outline-offset: -2px;
}

.cs-qty-input {
  width: 40px;
  border: none;
  border-left: 1px solid #d0d0d0;
  border-right: 1px solid #d0d0d0;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: #4a4a4a;
  padding: 6px 4px;
  height: 38px;
  -moz-appearance: textfield;
  appearance: textfield;
  background: #fff;
}

.cs-qty-input::-webkit-inner-spin-button,
.cs-qty-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Add-to-cart button ------------------------------------------------------- */
.cs-acrylic-atc-btn.button {
  background-color: var(--fs-color-primary, #1a76bb);
  color: #fff;
  border: none;
  border-radius: var(--rounded-corners-radius, 16px);
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
  height: 40px;
  display: inline-flex;
  align-items: center;
  transition: background 0.2s, opacity 0.2s;
}

.cs-acrylic-atc-btn.button:hover:not(:disabled) {
  background-color: color-mix(in srgb, var(--fs-color-primary, #1a76bb) 85%, #000);
  /* Fallback for browsers without color-mix */
  filter: brightness(0.88);
  color: #fff;
}

.cs-acrylic-atc-btn.button:disabled,
.cs-acrylic-atc-btn.button.loading {
  opacity: 0.65;
  cursor: not-allowed;
}

/* Out-of-stock state ------------------------------------------------------- */
.cs-acrylic-out-of-stock {
  display: inline-block;
  background: #f4f4f4;
  color: #888;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0;
}

/* Feedback message --------------------------------------------------------- */
.cs-acrylic-feedback {
  font-size: 0.85rem;
  margin: 6px 0 0;
  min-height: 1.2em;
}

.cs-acrylic-feedback.success {
  color: #4caf50;
  font-weight: 600;
}

.cs-acrylic-feedback.error {
  color: var(--fs-color-secondary, #e30a12);
  font-weight: 600;
}

/* Responsive --------------------------------------------------------------- */

/* Tablet: keep side-by-side but shrink image */
@media (max-width: 768px) {
  .cs-acrylic-widget {
    display: block !important;
    visibility: visible !important;
  }

  .cs-acrylic-img,
  .cs-acrylic-img--placeholder {
    width: 70px;
    height: 70px;
  }
}

/* Mobile: full stacked layout, large tap targets */
@media (max-width: 480px) {
  .cs-acrylic-widget {
    display: block !important;
    visibility: visible !important;
    margin-top: 20px;
    margin-bottom: 16px;
  }

  .cs-acrylic-card {
    flex-direction: row;          /* keep image left, text right */
    align-items: center;
    gap: 12px;
    padding: 12px;
  }

  .cs-acrylic-img,
  .cs-acrylic-img--placeholder {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
  }

  .cs-acrylic-info {
    flex: 1;
    min-width: 0;
  }

  .cs-acrylic-name {
    font-size: 0.85rem;
  }

  .cs-acrylic-price {
    font-size: 0.95rem;
    margin-bottom: 10px;
  }

  .cs-acrylic-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  /* Quantity row stays inline */
  .cs-acrylic-qty {
    align-self: flex-start;
  }

  .cs-qty-btn {
    width: 40px;
    height: 44px;  /* bigger tap target */
    font-size: 1.2rem;
  }

  .cs-qty-input {
    height: 44px;
    width: 44px;
    font-size: 1rem;
  }

  /* Full-width add-to-cart button */
  .cs-acrylic-atc-btn.button {
    width: 100%;
    justify-content: center;
    height: 46px;
    font-size: 0.95rem;
    border-radius: 8px;
  }
}
