.cpo-wrapper {
  display: flex; gap: 28px; max-width: 960px; margin: 0 auto;
  padding: 20px 0 40px; font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  direction: rtl; align-items: flex-start;
}

/* Gallery */
.cpo-gallery { width: 240px; flex-shrink: 0; }
.cpo-main-img img {
  width: 100%; aspect-ratio: 3/4; object-fit: cover;
  border-radius: 12px; border: 1px solid #e5e7eb; display: block;
}
.cpo-thumbs { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.cpo-thumb {
  width: 58px; height: 74px; object-fit: cover;
  border-radius: 8px; border: 1.5px solid #e5e7eb; cursor: pointer; transition: border-color 0.15s;
}
.cpo-thumb.active, .cpo-thumb:hover { border-color: #185FA5; }

/* Form side */
.cpo-form-side { flex: 1; min-width: 0; }
.cpo-title { font-size: 20px; font-weight: 600; color: #1a1a1a; margin: 0 0 4px; text-align: right; }
.cpo-price-display { font-size: 18px; font-weight: 600; color: #1a1a1a; margin-bottom: 12px; text-align: right; }
.cpo-price-display .woocommerce-Price-amount { color: inherit; font-size: inherit; }

/* Banner */
.cpo-banner {
  border: 1.5px solid #185FA5; border-radius: 10px;
  color: #185FA5; font-size: 14px; font-weight: 600;
  text-align: center; padding: 9px 14px; margin-bottom: 12px;
}

/* Qty cards */
.cpo-qty-cards { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.cpo-qty-card {
  border: 1.5px solid #d1d5db; border-radius: 12px;
  padding: 12px 14px; cursor: pointer; background: #fff; transition: border-color 0.15s;
}
.cpo-qty-card:hover { border-color: #93b8d8; }
.cpo-qty-card.selected { border: 2px solid #185FA5; }

.cpo-qty-header {
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
}
.cpo-qty-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cpo-qty-label { font-size: 15px; font-weight: 600; color: #1a1a1a; }
.cpo-qty-prices { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.cpo-qty-price { font-size: 15px; font-weight: 700; color: #185FA5; }
.cpo-qty-price .woocommerce-Price-amount { color: inherit; font-size: inherit; }
.cpo-old-price { font-size: 12px; color: #999; text-decoration: line-through; }
.cpo-old-price .woocommerce-Price-amount { color: inherit; font-size: inherit; }
.cpo-badge {
  background: #185FA5; color: #fff;
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
}
.cpo-badge .woocommerce-Price-amount { color: inherit; font-size: inherit; }

/* Attr rows */
.cpo-selects-rows { margin-top: 10px; }

/* Labels row (Couleur / Taille headers) */
.cpo-attr-labels {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  padding-right: 30px;
}
.cpo-attr-labels span {
  flex: 1;
  font-size: 12px; font-weight: 600; color: #555;
  text-align: center;
}

/* Each item row */
.cpo-attr-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.cpo-attr-row:last-child { margin-bottom: 0; }
.cpo-row-num {
  font-size: 12px; font-weight: 700; color: #185FA5;
  width: 24px; flex-shrink: 0; text-align: center;
}

/* Select dropdown (Taille) */
.cpo-attr-row select {
  flex: 1; height: 36px; border: 1px solid #d1d5db; border-radius: 8px;
  padding: 0 10px; font-size: 13px; background: #f9fafb;
  color: #333; cursor: pointer; direction: rtl;
}
.cpo-attr-row select:focus { outline: none; border-color: #185FA5; }

/* ===== Color buttons (text) ===== */
.cpo-color-btns {
  flex: 1;
  display: flex; flex-wrap: wrap; gap: 5px; align-items: center;
}
.cpo-color-btn {
  padding: 4px 10px;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  background: #f9fafb;
  color: #333;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  white-space: nowrap;
  line-height: 1.4;
}
.cpo-color-btn:hover { border-color: #185FA5; color: #185FA5; }
.cpo-color-btn.selected {
  border-color: #185FA5;
  background: #185FA5;
  color: #fff;
}
/* hidden input to store selected value */
.cpo-color-val { display: none; }

/* Customer form */
.cpo-customer-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.cpo-field { position: relative; display: flex; align-items: center; }
.cpo-field input {
  width: 100%; height: 42px; border: 1px solid #d1d5db; border-radius: 10px;
  padding: 0 38px 0 12px; font-size: 14px; background: #fff;
  color: #1a1a1a; direction: rtl; transition: border-color 0.15s;
}
.cpo-field input:focus { outline: none; border-color: #185FA5; box-shadow: 0 0 0 3px rgba(24,95,165,0.08); }
.cpo-field input::placeholder { color: #bbb; }
.cpo-field-icon { position: absolute; right: 10px; color: #bbb; font-size: 18px; pointer-events: none; line-height: 1; }

/* Summary */
.cpo-summary { border-top: 1px solid #e5e7eb; padding-top: 12px; margin-bottom: 14px; }
.cpo-sum-row { display: flex; justify-content: space-between; font-size: 14px; color: #555; margin-bottom: 6px; }
.cpo-sum-row .woocommerce-Price-amount { color: inherit; font-size: inherit; }
.cpo-discount-val { color: #dc2626 !important; font-weight: 600; }
.cpo-discount-val .woocommerce-Price-amount { color: inherit; font-size: inherit; }
.cpo-free { color: #0F6E56 !important; font-weight: 500; }
.cpo-sum-final { font-size: 16px !important; font-weight: 700; color: #1a1a1a !important; border-top: 1px solid #e5e7eb; padding-top: 8px; margin-top: 4px; }

/* Button */
.cpo-order-btn {
  width: 100%; height: 50px; background: #185FA5; color: #fff; border: none;
  border-radius: 12px; font-size: 16px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s, transform 0.1s; direction: rtl; margin-bottom: 12px;
}
.cpo-order-btn:hover { background: #0C447C; }
.cpo-order-btn:active { transform: scale(0.98); }
.cpo-order-btn:disabled { background: #93b8d8; cursor: not-allowed; }
.cpo-order-btn .dashicons { font-size: 20px; line-height: 1; }

/* Messages */
.cpo-msg { padding: 12px 16px; border-radius: 10px; font-size: 14px; text-align: center; margin-bottom: 10px; }
.cpo-msg.success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.cpo-msg.error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* Responsive */
@media (max-width: 640px) {
  .cpo-wrapper { flex-direction: column; padding: 10px; gap: 16px; }
  .cpo-gallery { width: 100%; }
  .cpo-main-img img { aspect-ratio: 4/3; }
}
