/* WC Quick Buy – Commerce Skin CSS v2.1 (refined) */
/* ------------------------------------------------ */
/* Tokens */
:root {
  --wcqbcskin-brand: #c79a2b;
  --wcqbcskin-danger: #c62828;
  --wcqbcskin-success: #2e7d32;
  --wcqbcskin-shadow: rgba(0, 0, 0, 0.18);
  --wcqbcskin-overlay: rgba(0, 0, 0, 0.38);
  --wcqbcskin-radius: 12px;
  --wcqbcskin-border: #ddd;
  --wcqbcskin-muted: #666;
}

/* Base reset (scoped) */
.wcqbcskin-modal,
.wcqbcskin-modal * {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Overlay */
.wcqbcskin-modal {
  position: fixed;
  inset: 0;
  background: var(--wcqbcskin-overlay);
  z-index: 999999;
  display: none;
  animation: wcqbcskin-fadeIn 0.2s ease;
}

@keyframes wcqbcskin-fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Card */
.wcqbcskin-card {
  width: min(780px, 90vw);
  max-height: 92vh;
  margin: 13vh auto;
  background: #fff;
  color: #111;
  border-radius: var(--wcqbcskin-radius);
  box-shadow: 0 20px 60px var(--wcqbcskin-shadow);
  overflow: hidden;
  position: relative;
  animation: wcqbcskin-slideUp 0.3s ease;
}

@keyframes wcqbcskin-slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Header tinh gọn, cân đối ===== */
.wcqbcskin-head {
  background: #125e00;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px; /* giảm chiều cao */
  font-size: 13.5px; /* chữ vừa phải */
  font-weight: 600;
  line-height: 1.2;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.wcqbcskin-head__title {
  flex: 1;
  margin-right: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.wcqbcskin-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 16px; /* nhỏ hơn cho cân */
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: opacity 0.2s;
}

.wcqbcskin-close:hover {
  opacity: 0.8;
}
.wcqbcskin-form input::placeholder {
  color: rgba(0, 0, 0, 0.35); /* hoặc #999; tùy độ nhạt mong muốn */
}
/* Body */
.wcqbcskin-body {
  display: grid;
  grid-template-columns: 340px 1fr; /* trái (SP) – phải (form) */
  gap: 14px;
  padding: 14px;
  max-height: calc(92vh - 48px);
  overflow-y: auto;
}

/* Left column – Product info */
.wcqbcskin-left {
  display: grid;
  gap: 10px;
  align-content: start;
}
.wcqbcskin-img {
  width: 100%;
  height: 180px;
  border: 1px solid #eee;
  border-radius: 10px;
  overflow: hidden;
  background: #fafafa;
}
.wcqbcskin-img img {
  height: 100%;
  object-fit: cover;
  display: block;
}
.wcqbcskin-summary {
  display: grid;
  gap: 0px;
}
.wcqbcskin-title {
  font-size: 16px;
  line-height: 1.3;
  font-weight: 700;
  color: #111;
  margin: 0;
}
.wcqbcskin-price {
  font-weight: 700;
  font-size: 20px;
  color: var(--wcqbcskin-danger);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.wcqbcskin-price__label {
  opacity: 0.75;
  font-weight: 600;
  color: #333;
  font-size: 14px;
}
.wcqbcskin-stock-notice {
  background: #fff3cd;
  border: 1px solid #ffc107;
  color: #856404;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
}
.wcqbcskin-qty-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wcqbcskin-qty-btn {
  border: none;
  background: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

#wcqbcskin-qty {
  text-align: center;
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
}
/* Total */
.wcqbcskin-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #fffbf0;
  border-radius: 8px;
  font-size: 14px;
  border: 1px solid #f0e5c8;
}
.wcqbcskin-total strong {
  color: var(--wcqbcskin-brand);
  font-size: 18px;
  font-weight: 800;
}

/* Form */
.wcqbcskin-form {
  display: grid;
  gap: 2px;
}
.wcqbcskin-variations {
  display: grid;
  gap: 8px;
  margin-bottom: 2px;
}
.wcqbcskin-variation-label,
.wcqbcskin-form label {
  font-size: 12px;
}
.wcqbcskin-form-row {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

/* Controls */
.wcqbcskin-form textarea {
  resize: vertical;
  min-height: 64px;
}
.wcqbcskin-form :where(input, textarea, select):focus {
  outline: none;
  border-color: var(--wcqbcskin-brand);
  box-shadow: 0 0 0 3px rgba(199, 154, 43, 0.12);
}
/* invalid – chỉ highlight khi user đã nhập gì (tránh đỏ lúc rỗng) */
.wcqbcskin-form input:invalid:not(:placeholder-shown),
.wcqbcskin-form select:invalid:not(:placeholder-shown) {
  border-color: var(--wcqbcskin-danger);
}
.wcqbcskin-help {
  font-size: 12px;
  color: var(--wcqbcskin-muted);
  font-weight: 400;
  margin-top: -2px;
}

/* Submit – chống theme Woo đè */
.wcqbcskin-submit,
.button.wcqbcskin-submit,
button.wcqbcskin-submit {
  background: var(--wcqbcskin-brand);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  transition: transform 0.12s, box-shadow 0.2s, filter 0.2s, opacity 0.2s;
  margin-top: 2px;
}
.wcqbcskin-submit:hover:not(:disabled) {
  filter: brightness(1.03);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(199, 154, 43, 0.28);
}
.wcqbcskin-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Loading state */
.wcqbcskin-submit.is-loading {
  position: relative;
  color: transparent;
}
.wcqbcskin-submit.is-loading::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 3px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: wcqbcskin-spin 0.6s linear infinite;
}
@keyframes wcqbcskin-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Response */
.wcqbcskin-response {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 12px;
  display: none;
  animation: wcqbcskin-slideDown 0.3s ease;
}
@keyframes wcqbcskin-slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.wcqbcskin-response.ok {
  background: #d4edda;
  color: var(--wcqbcskin-success);
  border: 1px solid #c3e6cb;
  display: block;
}
.wcqbcskin-response.err {
  background: #f8d7da;
  color: var(--wcqbcskin-danger);
  border: 1px solid #f5c6cb;
  display: block;
}

/* Success overlay (inside card) */
.wcqbcskin-success {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  z-index: 20;
}
.wcqbcskin-card.success .wcqbcskin-success {
  display: flex;
  animation: wcqbcskin-fadeIn 0.3s ease;
}
.wcqbcskin-success__box {
  background: #fff;
  color: #111;
  border-radius: 14px;
  padding: 24px 28px;
  min-width: 240px;
  text-align: center;
  border: 3px solid var(--wcqbcskin-success);
  box-shadow: 0 12px 40px var(--wcqbcskin-shadow);
  display: grid;
  gap: 8px;
  animation: wcqbcskin-bounceIn 0.5s ease;
}
@keyframes wcqbcskin-bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.92);
  }
  100% {
    transform: scale(1);
  }
}
.wcqbcskin-success__icon {
  font-size: 42px;
  line-height: 1;
}
.wcqbcskin-success__title {
  font-weight: 900;
  font-size: 18px;
  color: var(--wcqbcskin-success);
}
.wcqbcskin-success__sub {
  opacity: 0.8;
  font-size: 13px;
  line-height: 1.4;
}

/* Loop buttons */
.wcqbcskin-btn {
  margin-top: 10px;
  display: inline-block;
}
.wcqbcskin-btn-small {
  margin-top: 10px;
  font-size: 14px;
  padding: 8px 14px;
  background: var(--wcqbcskin-brand);
  color: #fff;
  border-radius: 8px;
  border: 0;
  cursor: pointer;
}
.wcqbcskin-btn-small:hover {
  filter: brightness(1.05);
}
.wcqbcskin-loop {
  margin-top: 8px;
}

/* Responsive */
@media (max-width: 768px) {
  .wcqbcskin-card {
    width: 96vw;
    margin: 2vh auto;
    max-height: 96vh;
  }
  .wcqbcskin-body {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }
  .wcqbcskin-left {
    grid-template-rows: auto;
    display: grid;
    gap: 10px;
    align-items: start;
  }
  .wcqbcskin-img {
    width: 100px;
    height: 100px;
    border-radius: 10px;
    overflow: hidden;
  }
  .wcqbcskin-title {
    font-size: 15px;
  }
  .wcqbcskin-price {
    font-size: 17px;
  }
  .wcqbcskin-total {
    font-size: 13px;
  }
  .wcqbcskin-total strong {
    font-size: 16px;
  }
  .wcqbcskin-form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .wcqbcskin-head {
    padding: 12px 14px;
    font-size: 14px;
  }
  .wcqbcskin-close {
    font-size: 24px;
    width: 28px;
    height: 28px;
  }
  .wcqbcskin-left {
    display: block;
  }
  .wcqbcskin-img {
    width: 100%;
    height: 200px;
  }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .wcqbcskin-card {
    background: #1e1e1e;
    color: #e0e0e0;
  }
  .wcqbcskin-title {
    color: #fff;
  }
  .wcqbcskin-form label {
    color: #e0e0e0;
  }
  .wcqbcskin-form :where(input, textarea, select) {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
  }
  .wcqbcskin-total {
    background: #2a2a2a;
    border-color: #444;
  }
  .wcqbcskin-success__box {
    background: #1e1e1e;
    color: #e0e0e0;
  }
}

/* Reduce motion (a11y) */
@media (prefers-reduced-motion: reduce) {
  .wcqbcskin-modal,
  .wcqbcskin-card,
  .wcqbcskin-success,
  .wcqbcskin-response {
    animation: none !important;
  }
}

/* Compatibility: prevent theme button margins */
.button.wcqbcskin-submit {
  margin: 0;
}

/* Optional: nice thin scrollbar inside modal body (webkit) */
.wcqbcskin-body::-webkit-scrollbar {
  width: 8px;
}
.wcqbcskin-body::-webkit-scrollbar-thumb {
  background: #d4d4d4;
  border-radius: 999px;
}
.wcqbcskin-body::-webkit-scrollbar-track {
  background: transparent;
}
.wcqbcskin-btn.wcqbcskin-btn--cta.button {
  /* layout */
  display: inline-grid;
  grid-auto-rows: min-content;
  gap: 6px;
  width: 100%;
  max-width: 640px; /* co lại cho cân */
  margin: 0 auto;
  padding: 14px 18px;

  /* look & feel */
  border: 0;
  border-radius: 12px;
  color: #fff;
  text-align: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.wcqbcskin-btn--cta .wcqbcskin-btn__text {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  line-height: 1.1;
}

.wcqbcskin-btn--cta .wcqbcskin-btn__sub {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  opacity: 0.92;
}

/* Hover/active */
.wcqbcskin-btn--cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
  filter: saturate(1.05) brightness(1.03);
}
.wcqbcskin-btn--cta:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

/* Focus (a11y) */
.wcqbcskin-btn--cta:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.7),
    0 0 0 6px color-mix(in srgb, var(--wcqbcskin-brand, #7b57a6), #fff 30%);
}

/* Disabled */
.wcqbcskin-btn--cta[disabled],
.wcqbcskin-btn--cta.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Mobile */
@media (max-width: 480px) {
  .wcqbcskin-btn.wcqbcskin-btn--cta.button {
    padding: 13px 14px;
    border-radius: 10px;
  }
  .wcqbcskin-btn--cta .wcqbcskin-btn__text {
    font-size: 15px;
  }
  .wcqbcskin-btn--cta .wcqbcskin-btn__sub {
    font-size: 12.5px;
  }
}
