/* =========================
   Zenzee Customizer – Fonts (LOCAL)
   ========================= */

@font-face {
    font-family: "Montserrat";
    src: url("../fonts/Montserrat-Regular.woff2") format("woff2");
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Playfair Display";
    src: url("../fonts/PlayfairDisplay-Regular.woff2") format("woff2");
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Pacifico";
    src: url("../fonts/Pacifico-Regular.woff2") format("woff2");
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Bebas Neue";
    src: url("../fonts/BebasNeue-Regular.woff2") format("woff2");
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Amatic SC";
    src: url("../fonts/AmaticSC-Regular.woff2") format("woff2");
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Amatic SC";
    src: url("../fonts/AmaticSC-Bold.woff2") format("woff2");
    font-weight: 700; font-style: normal; font-display: swap;
}

/* =========================
   Bloc de personnalisation cote client
   ========================= */

.zenzee-customizer-box {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    background: #fafafa;
}

.zenzee-customizer-title {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 1.1em;
    font-weight: 600;
}

.zenzee-customizer-help {
    font-size: 0.9em;
    color: #666;
    margin-top: 0;
    margin-bottom: 10px;
}

.zenzee-line-block {
    margin-bottom: 10px;
    border: 1px dashed #ddd;
    padding: 8px;
}

.zenzee-line-block legend {
    font-size: 0.9em;
    font-weight: 600;
}

.zenzee-extra-price {
    margin-top: 10px;
    font-weight: 600;
}

/* =========================
   Selecteur de supports visuels
   ========================= */

.zenzee-supports-section {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e1e1e1;
}

.zenzee-supports-label {
    margin: 0 0 8px 0;
    font-size: 0.95em;
}

.zenzee-supports-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}

/* Bouton/vignette de support */
.zenzee-support-item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 5px;
    width: 80px;
    min-height: 80px;
    border: 2px solid #d0d0d0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
    text-align: center;
    font-family: inherit;
    font-size: 0.75em;
    line-height: 1.2;
    color: #333;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}

.zenzee-support-item:hover {
    border-color: #999;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

/* Support actif (selectionne) */
.zenzee-support-item.is-active {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.25);
    background: #f0f6fb;
}

.zenzee-support-item.is-active .zenzee-support-item-label {
    color: #2271b1;
    font-weight: 600;
}

/* Focus clavier (accessibilite) */
.zenzee-support-item:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.zenzee-support-thumb {
    display: block;
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 3px;
}

.zenzee-support-item-label {
    display: block;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8em;
    color: #444;
}

/* Bouton de soumission pendant la generation de preview */
form.cart [type="submit"].zenzee-processing {
    opacity: 0.65;
    cursor: wait;
    pointer-events: none;
}

/* Responsive mobile */
@media (max-width: 480px) {
    .zenzee-supports-grid { gap: 6px; }
    .zenzee-support-item  { width: 68px; min-height: 68px; }
    .zenzee-support-thumb { width: 50px; height: 50px; }
}

/* =========================
   Overlay sur l'image produit
   ========================= */

/*
   CORRECTION : position:absolute manquante dans la version precedente.
   Sans ca, l'overlay n'est pas superpose a l'image (il s'affiche en dessous).
   Le JS pose position:relative sur le conteneur parent.
*/
.zenzee-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

/*
   Le wrapper texte est positionne en absolu au point d'ancrage (offsetX/Y).
   transform:translate(-50%,-50%) centre le bloc sur ce point.
   top/left sont poses par le JS (ex: top:50%, left:50% = centre).
*/
.zenzee-text-wrapper {
    position: absolute;
    transform: translate(-50%, -50%);
    max-width: 80%;
    text-align: center;
    overflow-wrap: anywhere;
    word-break: normal;
    /* Couleur, font, font-size, top, left geres en JS */
}

/* Chaque ligne de texte */
.zenzee-text-line {
    display: block;
    margin: 2px 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* Compatibilite galerie WooCommerce */
.woocommerce-product-gallery__wrapper,
.woocommerce-product-gallery__image {
    overflow: hidden;
}

/* =========================
   Vignette Zenzee dans le panier
   ========================= */

/*
 * Remplace la vignette WooCommerce par defaut.
 * Affichee dans la colonne "Produit" a gauche, a la place de l'image produit originale.
 */
.zenzee-cart-thumb-wrap {
    position: relative;
    display: inline-block;
}

/* Image personnalisee (preview canvas ou support) */
.zenzee-cart-thumb-img {
    display: block;
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    background: #fafafa;
    transition: box-shadow 0.15s ease;
}

/* Lien cliquable autour de la vignette */
.zenzee-cart-thumb-link {
    display: block;
    position: relative;
    text-decoration: none;
}

.zenzee-cart-thumb-link:hover .zenzee-cart-thumb-img {
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
    border-color: #bbb;
}

/* Icone loupe affichee au survol */
.zenzee-cart-thumb-zoom {
    position: absolute;
    bottom: 4px;
    right: 4px;
    font-size: 16px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s ease;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
    pointer-events: none;
}

.zenzee-cart-thumb-link:hover .zenzee-cart-thumb-zoom {
    opacity: 1;
}

/* Responsive : un peu plus petite sur mobile */
@media (max-width: 480px) {
    .zenzee-cart-thumb-img {
        width: 72px;
        height: 72px;
    }
}

/* =========================
   Section upload logo client
   ========================= */

.zenzee-logo-sep {
    margin: 16px 0 12px;
    border: none;
    border-top: 1px solid #e1e1e1;
}

.zenzee-logo-title {
    margin: 0 0 4px;
    font-size: 1em;
}

.zenzee-logo-optional {
    font-size: 0.8em;
    color: #888;
    font-weight: 400;
    margin-left: 5px;
}

.zenzee-logo-help {
    font-size: 0.82em;
    color: #666;
    margin: 0 0 10px;
    line-height: 1.4;
}

/* Zone de depot (dropzone) */
.zenzee-logo-dropzone {
    position: relative;
    border: 2px dashed #c0c0c0;
    border-radius: 8px;
    background: #fafafa;
    padding: 20px 14px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}

.zenzee-logo-dropzone:hover,
.zenzee-logo-dropzone:focus,
.zenzee-logo-dropzone.is-dragover {
    border-color: #2271b1;
    background: #f0f6fb;
    outline: none;
}

.zenzee-logo-dropzone.is-dragover {
    border-style: solid;
}

/* Input file cache (accessible via le clic sur la dropzone) */
.zenzee-logo-file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    font-size: 0; /* empeche le texte du fichier selectionne d'apparaitre */
}

.zenzee-logo-dropzone-inner {
    pointer-events: none; /* les clics passent a travers vers l'input */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #555;
}

.zenzee-logo-icon {
    font-size: 28px;
    line-height: 1;
    opacity: 0.6;
    margin-bottom: 4px;
}

.zenzee-logo-drop-label {
    font-size: 0.9em;
    font-weight: 500;
}

.zenzee-logo-or {
    font-size: 0.8em;
    color: #999;
}

.zenzee-logo-btn-label {
    display: inline-block;
    padding: 5px 14px;
    background: #2271b1;
    color: #fff;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    margin-top: 2px;
}

.zenzee-logo-dropzone:hover .zenzee-logo-btn-label,
.zenzee-logo-dropzone.is-dragover .zenzee-logo-btn-label {
    background: #135e96;
}

/* Feedback analyse / erreur */
.zenzee-logo-feedback {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 5px;
    font-size: 0.85em;
    line-height: 1.4;
}

.zenzee-logo-feedback--loading {
    background: #f0f6fb;
    border: 1px solid #c2d9ee;
    color: #2271b1;
}

.zenzee-logo-feedback--ok {
    background: #edfaf0;
    border: 1px solid #a8e6b5;
    color: #1e5b2c;
}

.zenzee-logo-feedback--warn {
    background: #fff8e5;
    border: 1px solid #f0d080;
    color: #7a5500;
}

.zenzee-logo-feedback--error {
    background: #fdf0f0;
    border: 1px solid #f0a8a8;
    color: #7a0000;
}

.zenzee-logo-feedback--info {
    background: #f7f7f7;
    border: 1px solid #ddd;
    color: #444;
}

/* Pastilles de couleur detectees */
.zenzee-color-chips {
    display: inline-flex;
    gap: 4px;
    vertical-align: middle;
    margin-left: 4px;
}

.zenzee-color-chip {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.15);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

/* Ligne miniature logo + bouton supprimer */
.zenzee-logo-preview-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 6px 8px;
    background: #f5f5f5;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
}

.zenzee-logo-preview-thumb {
    width: 48px;
    height: 48px;
    object-fit: contain;
    background: #fff;
    border-radius: 3px;
    border: 1px solid #ddd;
    padding: 2px;
    flex-shrink: 0;
}

.zenzee-logo-remove {
    margin-left: auto;
    background: none;
    border: 1px solid #c00;
    color: #c00;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 0.8em;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
    line-height: 1.4;
}

.zenzee-logo-remove:hover {
    background: #c00;
    color: #fff;
}

/* Controles position + taille */
.zenzee-logo-controls {
    margin-top: 10px;
    padding: 10px;
    background: #f7f7f7;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.zenzee-logo-controls-inner {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.zenzee-logo-ctrl-label {
    margin: 0 0 6px;
    font-size: 0.8em;
    font-weight: 600;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Grille 3x3 de position */
.zenzee-logo-pos-grid {
    display: grid;
    grid-template-columns: repeat(3, 30px);
    grid-template-rows: repeat(3, 30px);
    gap: 3px;
}

.zenzee-pos-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s, border-color 0.1s;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.zenzee-pos-btn:hover {
    background: #f0f6fb;
    border-color: #2271b1;
}

.zenzee-pos-btn.is-active {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}

/* Boutons taille S / M / L */
.zenzee-logo-scale-btns {
    display: flex;
    gap: 4px;
}

.zenzee-scale-btn {
    width: 36px;
    height: 30px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85em;
    font-family: inherit;
    transition: background 0.1s, border-color 0.1s;
    -webkit-appearance: none;
    appearance: none;
}

.zenzee-scale-btn:hover {
    background: #f0f6fb;
    border-color: #2271b1;
}

.zenzee-scale-btn.is-active {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}

/* Overlay logo sur l'image produit (live preview) */
.zenzee-logo-overlay {
    position: absolute;
    pointer-events: none;
    object-fit: contain;
    max-height: 55%;
    /* left, top, width, transform geres en JS */
}

/* Responsive */
@media (max-width: 480px) {
    .zenzee-logo-controls-inner { gap: 12px; }
    .zenzee-logo-pos-grid { grid-template-columns: repeat(3, 26px); grid-template-rows: repeat(3, 26px); }
    .zenzee-pos-btn { width: 26px; height: 26px; font-size: 12px; }
}
