/**
 * CSS Frontend - Personnalisation Gravure
 * Charte graphique: Vert #064e3b, Beige #d6d3d1, Bleu #1e3a8a, Or #d97706
 */

/* ========================================
   VARIABLES
======================================== */
:root {
    --wce-vert: #064e3b;
    --wce-beige: #d6d3d1;
    --wce-bleu: #1e3a8a;
    --wce-or: #d97706;
    --wce-blanc: #ffffff;
    --wce-gris-clair: #f3f4f6;
    --wce-gris-moyen: #6b7280;
    --wce-gris-fonce: #1f2937;
    --font-titre: 'Montserrat', sans-serif;
    --font-texte: 'Inter', sans-serif;
}

/* ========================================
   BOUTON PERSONNALISER
======================================== */
.wce-customize-button-wrapper {
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, var(--wce-beige) 0%, var(--wce-blanc) 100%);
    border-radius: 8px;
    border: 2px solid var(--wce-vert);
}

.wce-customize-button {
    width: 100%;
    padding: 15px 30px;
    background: var(--wce-vert);
    color: var(--wce-blanc);
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    font-family: var(--font-titre);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.wce-customize-button:hover {
    background: var(--wce-bleu);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.wce-btn-icon {
    font-size: 24px;
}

.wce-customize-hint {
    margin: 10px 0 0;
    text-align: center;
    color: var(--wce-gris-moyen);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* ========================================
   MODAL
======================================== */
.wce-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.wce-modal.active {
    display: block;
}

.wce-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
}

.wce-modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    margin: 5vh auto;
    background: var(--wce-blanc);
    border-radius: 12px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wce-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: linear-gradient(135deg, var(--wce-vert) 0%, var(--wce-bleu) 100%);
    color: var(--wce-blanc);
    border-radius: 12px 12px 0 0;
}

.wce-modal-header h2 {
    margin: 0;
    font-family: var(--font-titre);
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
	color:white;
}

.wce-modal-icon {
    font-size: 28px;
}

.wce-modal-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--wce-blanc);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wce-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.wce-modal-close .dashicons {
    font-size: 24px;
}

.wce-modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

/* Choix Recto/Verso */
.wce-side-selector {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--wce-gris-clair);
    border-radius: 8px;
}

.wce-side-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--wce-gris-fonce);
}

.wce-side-buttons {
    display: flex;
    gap: 15px;
}

.wce-side-btn {
    flex: 1;
    padding: 15px 20px;
    background: var(--wce-blanc);
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.wce-side-btn:hover {
    border-color: var(--wce-vert);
    background: var(--wce-beige);
}

.wce-side-btn.active {
    background: var(--wce-vert);
    color: var(--wce-blanc);
    border-color: var(--wce-vert);
}

/* Grid Aperçu / Formulaire */
.wce-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.wce-preview-column,
.wce-form-column {
    background: var(--wce-gris-clair);
    padding: 20px;
    border-radius: 8px;
}

.wce-preview-column h3,
.wce-form-column h3 {
    margin-top: 0;
    color: var(--wce-vert);
    font-family: var(--font-titre);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--wce-beige);
}

/* Aperçu */
.wce-preview-container {
    position: relative;
}

.wce-preview-side {
    display: none;
}

.wce-preview-side.active {
    display: block;
}

/* IMPORTANT : wrapper = taille réelle affichée de l'image */
.wce-canvas-wrapper,
.wce-image-wrapper,
.wce-preview-canvas {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;      /* supprime l'espace sous l'image */
  overflow: hidden;    /* si tu veux clipper ce qui dépasse du cadre */
}

.wce-preview-wrapper{
    position: relative;
    display: inline-block;   /* clé : colle à l’image */
    max-width: 100%;
    line-height: 0;
    overflow: hidden;        /* overlay + texte restent dans le cadre */
    background: var(--wce-blanc);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.wce-preview-wrapper img{
    display: block;
    max-width: 100%;
    height: auto;
}
.wce-preview-wrapper .wce-zones-overlay,
.wce-preview-wrapper .wce-preview-text-overlay{
    position: absolute;
    inset: 0;
}


/* Le conteneur global peut rester en flex/grid, mais le "canvas" doit coller à l'image */
.wce-product-canvas,
.wce-preview-wrapper,
.wce-canvas-wrapper {
  text-align: center; /* optionnel */
}

/* IMPORTANT : wrapper = taille réelle affichée de l'image */
.wce-canvas-wrapper,
.wce-image-wrapper,
.wce-preview-canvas {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;      /* supprime l'espace sous l'image */
  overflow: hidden;    /* si tu veux clipper ce qui dépasse du cadre */
}

/* Image = référence de taille */
.wce-preview-image,
.wce-canvas-image,
.wce-product-image {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Overlay = exactement la même boîte que l'image */
.wce-zones-overlay,
.wce-zones-layer,
.wce-overlay {
  position: absolute;
  inset: 0;           /* top:0; right:0; bottom:0; left:0 */
  pointer-events: none; /* évite de bloquer les clics si besoin */
}

.wce-preview-image{
  display:block;
  max-width:100%;
  height:auto;
  width:auto;          /* évite d’imposer 100% si l’image est plus petite */
}



/* IMPORTANT : le canvas doit "coller" à l'image */
.wce-preview-wrapper{
  position: relative;
  display: inline-block;   /* au lieu de block */
  max-width: 100%;
  line-height: 0;          /* supprime l'espace sous l'image */
  overflow: hidden;        /* si tu veux clipper ce qui dépasse */
}

/* l'image définit la taille du wrapper */
.wce-preview-wrapper img{
  display: block;
  max-width: 100%;
  height: auto;
}

/* overlay = exactement la même taille que l'image */
.wce-preview-wrapper .wce-zones-overlay{
  position: absolute;
  inset: 0;
}


/* OVERLAY - EXACTEMENT SUR L'IMAGE (0 padding) */
.wce-preview-text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.wce-text-zone{
  box-sizing: border-box;      
  padding: 2px 0;             
  overflow: hidden;            
}

/* CONTENU TEXTE - CRITICAL POUR TEXTFILL */
.wce-text-content {
    font-family: 'Corsiva', serif;
    color: #000;
    text-align: center;

    /* IMPORTANT : ne pas tronquer le texte lui-même */
    overflow: visible;

    /* IMPORTANT : éviter width 100% (mauvaises mesures + coupe) */
    display: inline-block;
    width: auto;
    max-width: 100%;

    white-space: nowrap;
    line-height: 1;  /* plus safe pour les scripts */
}



.wce-preview-info {
    margin-top: 15px;
    padding: 12px;
    background: #fef3c7;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #78350f;
}

/* Formulaire */
.wce-form-side {
    display: none;
}

.wce-form-side.active {
    display: block;
}

/* .wce-form-group { */
    /* margin-bottom: 20px; */
/* } */

.wce-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--wce-gris-fonce);
}

.wce-text-input,
.wce-font-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    font-family: var(--font-texte);
    transition: all 0.3s;
}

.wce-text-input:focus,
.wce-font-select:focus {
    outline: none;
    border-color: var(--wce-bleu);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.wce-char-count {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--wce-gris-moyen);
    text-align: right;
}

.wce-char-count .current {
    font-weight: 600;
    color: var(--wce-bleu);
}

.wce-form-info {
    margin-top: 30px;
    padding: 15px;
    background: var(--wce-blanc);
    border-radius: 6px;
    border-left: 4px solid var(--wce-vert);
}

.wce-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    color: var(--wce-gris-fonce);
    font-size: 14px;
}

.wce-info-item .dashicons {
    color: var(--wce-vert);
}

/* Footer Modal */
.wce-modal-footer {
    padding: 20px 30px;
    background: var(--wce-gris-clair);
    border-radius: 0 0 12px 12px;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.wce-modal-footer .button {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.wce-modal-footer .button-primary {
    background: var(--wce-vert);
    color: var(--wce-blanc);
    border: none;
}

.wce-modal-footer .button-primary:hover {
    background: var(--wce-bleu);
    transform: translateY(-2px);
}

/* Animation pour le dashicons qui tourne */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* ========================================
   RESPONSIVE
======================================== */
@media (max-width: 768px) {
    .wce-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .wce-modal-header {
        padding: 15px 20px;
    }
    
    .wce-modal-header h2 {
        font-size: 18px;
    }
    
    .wce-modal-body {
        padding: 20px;
    }
    
    .wce-modal-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .wce-side-buttons {
        flex-direction: column;
    }
    
    .wce-modal-footer {
        flex-direction: column-reverse;
    }
    
    .wce-modal-footer .button {
        width: 100%;
    }
}
/* ===== FIX ALIGNEMENT FRONT : wrapper = taille image ===== */
#wce-preview-container .wce-preview-wrapper{
  position: relative;
  display: inline-block !important;  /* écrase tes display:block */
  width: auto !important;            /* écrase width:100% */
  max-width: 100%;
  line-height: 0;
  overflow: hidden;                  /* garde tout dans le cadre */
  padding: 0;
}

/* L'image définit la taille */
#wce-preview-container .wce-preview-wrapper > img.wce-preview-image{
  display: block;
  width: auto;        /* IMPORTANT: pas 100% forcé */
  max-width: 100%;
  height: auto;
}

/* L’overlay doit épouser exactement l’image */
#wce-preview-container .wce-preview-text-overlay{
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  pointer-events: none;
}

/* La zone doit centrer son contenu */
#wce-preview-container .wce-text-zone{
  position: absolute;
  display: flex;
  align-items: center;      /* centrage vertical */
  justify-content: center;  /* centrage horizontal */
  padding: 0;               /* important : sinon ça fausse la hauteur utile */
  overflow: hidden;
}
/* Le texte reste mesurable correctement */
#wce-preview-container .wce-text-content{
  display: inline-block;
  margin: 0;
  padding: 0;
}
/* WCE - Cart : cacher le label "Aperçu:" (et donc le ":") */
.woocommerce-cart dl.variation dt.variation-Aperu,
.woocommerce-cart dl.variation dt[class*="variation-Aperu"],
.woocommerce-checkout dl.variation dt.variation-Aperu,
.woocommerce-checkout dl.variation dt[class*="variation-Aperu"]{
  display: none !important;
}
.wce-disabled-atc {
  opacity: .6;
  cursor: not-allowed;
}
.wce-disabled-atc{opacity:.6; cursor:not-allowed;}

/* Bouton fermer modal - rendu propre */
#wce-close-modal-btn,
.wce-modal-close {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 1px solid #e5e7eb;
	border-radius: 999px;
	background: #fff;
	color: #374151;
	cursor: pointer;
	line-height: 1;
	box-shadow: 0 1px 2px rgba(0,0,0,.04);
	transition: transform .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease;
}

/* Icône dashicon centrée correctement */
#wce-close-modal-btn .dashicons,
.wce-modal-close .dashicons {
	display: block !important;
	width: 20px;
	height: 20px;
	font-size: 20px;
	line-height: 20px;
	margin: 0;
	transform-origin: 50% 50%;
	transition: transform .22s ease;
	will-change: transform;
}

/* Hover plus joli (petite rotation + zoom léger) */
#wce-close-modal-btn:hover,
.wce-modal-close:hover {
	background: #f9fafb;
	color: #111827;
	box-shadow: 0 4px 10px rgba(0,0,0,.08);
	transform: translateY(-1px);
}

#wce-close-modal-btn:hover .dashicons,
.wce-modal-close:hover .dashicons {
	transform: rotate(90deg) scale(1.06);
}

/* Click */
#wce-close-modal-btn:active,
.wce-modal-close:active {
	transform: translateY(0) scale(.98);
}

/* Focus clavier (important UX) */
#wce-close-modal-btn:focus,
.wce-modal-close:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(59,130,246,.18);
}
/* ==============================
   WCE - Single product UX simplifiée
   Garde seulement le bouton "Personnalisez-moi"
   ============================== */

/* Cache tout ce qui est après notre bouton dans le form panier (quantité, ATC, boutons thème, etc.) */
form.cart .wce-customize-button-wrapper ~ * {
	display: none !important;
}

/* On garde les champs hidden WCE fonctionnels (pas besoin de les voir) */
form.cart input[type="hidden"] {
	display: none !important;
}

/* Si certains thèmes ajoutent des boutons "buy now" hors form.cart, on les masque aussi (sélecteurs courants) */
.single-product .button.buy-now,
.single-product .buy_now_button,
.single-product .xoo-wsc-buy-now,
.single-product .et_pb_button.buy-now {
	display: none !important;
}
.wce-btn-text{
	color: #ffffff !important;
}
#wce-validate-btn{
	color: #ffffff !important;
}
#wce-cancel-btn{
	color: #ffffff !important;
}
#wce-continue-shopping{
	color: #ffffff !important;	
}
/* Déplace la flèche (pseudo-élément) uniquement sur les boutons WCE */
#wce-gen-overlay .wce-action-btn::after {
  margin-left: 6px !important;   /* espace entre texte et flèche */
  transform: translateX(0) !important; /* position de base */
}

/* Si elle "bouge" au survol, contrôle le déplacement ici */
#wce-gen-overlay .wce-action-btn:hover::after {
  transform: translateX(0) !important; /* mets 0 pour ne plus bouger */
  /* ou: transform: translateX(2px) !important; pour bouger moins/plus */
}

#wce-gen-overlay #wce-go-cart::after,
#wce-gen-overlay #wce-go-cart:hover::after {
  content: none !important;
}

/* Style overlay succès WCE */
#wce-gen-overlay .wce-success{
  text-align:center;
}

#wce-gen-overlay .wce-title {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 6px 0;
    font-style: italic;
}

#wce-gen-overlay .wce-subtitle{
  font-size:16px;
  color:rgba(0,0,0,.65);
  margin:0 0 16px 0;
}

/* Groupe boutons */
#wce-gen-overlay .wce-actions{
  display:flex;
  gap:12px;
  justify-content:center;
  flex-wrap:wrap;
}

/* Base bouton */
#wce-gen-overlay .wce-btn{
  padding:11px 16px !important;
  border-radius:12px !important;
  font-weight:700 !important;
  line-height:1 !important;
  text-decoration:none !important;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:42px;
}

/* Bouton primaire */
#wce-gen-overlay .wce-btn--primary{
  background:#111 !important;
  color:#fff !important;
  border:1px solid #111 !important;
}

/* Bouton secondaire (ghost) */
#wce-gen-overlay .wce-btn--ghost{
  background:transparent !important;
  color:#111 !important;
  border:1px solid rgba(0,0,0,.2) !important;
}

/* Hover simple */
#wce-gen-overlay .wce-btn--primary:hover{ filter:brightness(0.92); }
#wce-gen-overlay .wce-btn--ghost:hover{ background:rgba(0,0,0,.04) !important; }

/* Empêche la flèche du thème qui apparait au hover */
#wce-gen-overlay .wce-btn::after,
#wce-gen-overlay .wce-btn:hover::after{
  content:none !important;
}
@media (max-width: 480px){
  /* Gouttières mobile */
  #wce-gen-overlay{
    padding: 0 16px !important;
    box-sizing: border-box;
  }

  /* Cible le bloc blanc (celui avec background:#fff inline) et le rend responsive */
  #wce-gen-overlay [style*="background:#fff"]{
    width: 100% !important;
    max-width: calc(100vw - 32px) !important; /* 16px à gauche + 16px à droite */
    min-width: 0 !important;                  /* annule min-width:380px */
    box-sizing: border-box !important;
    margin: 0 auto !important;
  }
}
#wce-open-modal-btn.wce-in-cart { opacity: .95; }
/* Bouton WCE désactivé: lisible + propre */
#wce-open-modal-btn.wce-in-cart{
  background: #064e3b !important;
  border-color: #111 !important;
  color: #fff !important;
  opacity: 1 !important;
  cursor: not-allowed !important;
}

/* Empêche les styles "disabled" du thème de griser le texte */
#wce-open-modal-btn.wce-in-cart:disabled,
#wce-open-modal-btn.wce-in-cart[disabled]{
  color: #fff !important;
  -webkit-text-fill-color: #fff !important; /* Safari iOS */
  opacity: 1 !important;
}

/* Si ton texte est dans .wce-btn-text */
#wce-open-modal-btn.wce-in-cart .wce-btn-text{
  color: #fff !important;
}

/* Optionnel: enlève la flèche Divi au hover sur ce bouton */
#wce-open-modal-btn.wce-in-cart:after,
#wce-open-modal-btn.wce-in-cart:hover:after{
  content: none !important;
}