/* =====================================================
   WC Ruban Deuil — Styles Frontend
   ===================================================== */

/* ---- Variables ---- */
:root {
  --wrd-primary:     #2d7f6f;
  --wrd-primary-hov: #236657;
  --wrd-border:      #e0e0e0;
  --wrd-bg-card:     #ffffff;
  --wrd-shadow:      0 2px 12px rgba(0,0,0,.1);
  --wrd-radius:      12px;
  --wrd-font:        inherit;
}

/* ---- Zone Option ---- */
.wrd-option-zone {
  margin: 20px 0;
  font-family: var(--wrd-font);
  max-width: 420px;
}

.wrd-option-header {
  margin-bottom: 10px;
}

.wrd-option-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: .3px;
}

/* ---- Carte ruban (non sélectionné) ---- */
.wrd-ribbon-card {
  border: 1.5px solid var(--wrd-border);
  border-radius: var(--wrd-radius);
  background: var(--wrd-bg-card);
  padding: 14px 16px;
  transition: border-color .2s;
}

.wrd-ribbon-card:hover {
  border-color: var(--wrd-primary);
}

.wrd-ribbon-card-inner,
.wrd-selected-inner {
  display: flex;
  align-items: center;
  gap: 14px;
}

.wrd-ribbon-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  overflow: hidden;
  background: #f4f4f4;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wrd-ribbon-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.wrd-ribbon-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wrd-ribbon-name {
  font-size: 17px;
  font-weight: 700;
  color: #222;
}

.wrd-learn-more {
  display: none !important;
}

.wrd-ribbon-price {
  font-size: 14px;
  font-weight: 600;
  color: #444;
}

.wrd-ribbon-price .woocommerce-Price-amount {
  font-size: 14px;
}

/* ---- Bouton "+" ---- */
.wrd-btn-add-ribbon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--wrd-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, transform .15s;
  padding: 0;
}

.wrd-btn-add-ribbon svg {
  width: 18px;
  height: 18px;
}

.wrd-btn-add-ribbon:hover {
  background: var(--wrd-primary-hov);
  transform: scale(1.1);
}

/* ---- Carte sélectionnée ---- */
.wrd-ribbon-selected {
  border: 2px solid var(--wrd-primary);
  border-radius: var(--wrd-radius);
  background: #f0faf7;
  padding: 14px 16px;
}

.wrd-selected-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wrd-selected-info strong {
  font-size: 14px;
  color: #1a1a1a;
}

.wrd-selected-messages {
  font-size: 13px;
  color: #555;
}

.wrd-selected-msg-item {
  display: flex;
  gap: 5px;
  font-style: italic;
}

.wrd-selected-msg-item::before {
  content: '🎀';
}

.wrd-selected-total {
  font-size: 13px;
  font-weight: 600;
  color: var(--wrd-primary);
}

.wrd-selected-actions {
  display: flex;
  gap: 8px;
}

.wrd-btn-modify,
.wrd-btn-remove {
  background: transparent;
  border: 1.5px solid var(--wrd-border);
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 14px;
  transition: all .2s;
}

.wrd-btn-modify:hover {
  border-color: var(--wrd-primary);
  background: #e8f5f0;
}

.wrd-btn-remove:hover {
  border-color: #c0392b;
  color: #c0392b;
  background: #fdf0f0;
}

/* =====================================================
   MODAL / POPUP
   ===================================================== */

.wrd-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: wrdFadeIn .2s ease;
}

@keyframes wrdFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.wrd-modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: wrdSlideUp .25s ease;
}

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

/* Header modal */
.wrd-modal-title {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  padding: 22px 24px 0;
  margin: 0;
  border-bottom: none;
}

.wrd-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: 1.5px solid #ccc;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  transition: all .2s;
}

.wrd-modal-close:hover {
  border-color: #999;
  background: #f5f5f5;
}

/* Body modal */
.wrd-modal-body {
  display: flex;
  gap: 20px;
  padding: 20px 24px;
  align-items: flex-start;
}

@media (max-width: 560px) {
  .wrd-modal-body {
    flex-direction: column;
    align-items: center;
  }
}

.wrd-modal-image {
  flex: 0 0 46%;
  max-width: 46%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wrd-modal-image img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  object-fit: contain;
}

@media (max-width: 560px) {
  .wrd-modal-image {
    flex: 0 0 100%;
    max-width: 220px;
    margin: 0 auto;
  }
}

.wrd-modal-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Sélecteur nombre de rubans */
.wrd-nb-label {
  font-weight: 600;
  font-size: 14px;
  color: #333;
  display: block;
  margin-bottom: 8px;
}

.wrd-nb-buttons {
  display: flex;
  gap: 10px;
}

.wrd-nb-btn {
  flex: 1;
  padding: 10px 8px;
  border: 2px solid var(--wrd-border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #555;
  transition: all .2s;
}

.wrd-nb-btn:hover {
  border-color: var(--wrd-primary);
  color: var(--wrd-primary);
}

.wrd-nb-btn.active {
  border-color: var(--wrd-primary);
  background: #e8f7f3;
  color: var(--wrd-primary);
  font-weight: 700;
}

/* Champs texte */
.wrd-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wrd-field-label {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.wrd-field-group textarea {
  width: 100%;
  border: 1.5px solid var(--wrd-border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--wrd-font);
  resize: vertical;
  min-height: 80px;
  transition: border-color .2s;
  box-sizing: border-box;
}

.wrd-field-group textarea:focus {
  outline: none;
  border-color: var(--wrd-primary);
  box-shadow: 0 0 0 3px rgba(45,127,111,.12);
}

.wrd-char-count {
  text-align: right;
  font-size: 12px;
  color: #888;
}

.wrd-char-count.near-limit {
  color: #e67e22;
}

.wrd-char-count.at-limit {
  color: #c0392b;
  font-weight: 600;
}

/* Description */
.wrd-modal-description {
  font-size: 13px;
  color: #666;
  line-height: 1.6;
  margin: 0;
}

/* Message d'erreur */
.wrd-error-msg {
  background: #fdf0f0;
  border: 1px solid #f5c6c6;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #c0392b;
}

/* Footer modal */
.wrd-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 22px;
  border-top: 1px solid #f0f0f0;
  gap: 12px;
}

.wrd-modal-price-total {
  font-size: 18px;
  font-weight: 700;
  color: #222;
}

.wrd-modal-price-total .woocommerce-Price-amount {
  font-size: 18px;
}

.wrd-modal-btns {
  display: flex;
  gap: 10px;
}

.wrd-btn-close-modal {
  padding: 12px 24px;
  border: 1.5px solid #ccc;
  border-radius: 50px;
  background: transparent;
  font-size: 15px;
  cursor: pointer;
  color: #555;
  transition: all .2s;
}

.wrd-btn-close-modal:hover {
  border-color: #999;
  background: #f5f5f5;
}

.wrd-btn-confirm {
  padding: 12px 28px;
  border: none;
  border-radius: 50px;
  background: var(--wrd-primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, transform .15s;
}

.wrd-btn-confirm:hover {
  background: var(--wrd-primary-hov);
  transform: translateY(-1px);
}

/* =====================================================
   REPOSITIONNEMENT PANIER
   Quantité + Bouton Ajouter au panier sous le bloc ruban
   ===================================================== */

/* S'assure que le form.cart est en colonne quand le bloc ruban est présent */
form.cart:has(#wrd-option-zone) {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Fallback JS-class (ajouté par JS si :has non supporté) */
form.cart.wrd-active {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Wrapper créé par JS qui contient quantité + bouton */
.wrd-cart-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  max-width: 420px;   /* même largeur max que le module ruban */
  width: auto;
}

/* Le bouton WooCommerce dans le wrapper — taille naturelle, pas d'étirement */
.wrd-cart-actions .single_add_to_cart_button {
  flex: 0 0 auto;
  width: auto !important;
  min-width: 160px;
  max-width: 280px;
}

/* La quantité dans le wrapper */
.wrd-cart-actions .quantity {
  flex-shrink: 0;
  width: auto;
}

/* ---- Badge shortcode ---- */
.wrd-badge {
  display: inline-block;
  background: #e8f7f3;
  color: var(--wrd-primary);
  border: 1px solid var(--wrd-primary);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
}
