/* =========================================================
   Cadocouches Options — Frontend CSS v2.0
   ========================================================= */

:root {
  --cco-green:       #7FC2A1;
  --cco-green-dark:  #5aaa87;
  --cco-green-light: #e8f5ef;
  --cco-border:      #c8e0d4;
  --cco-text:        #1d2327;
  --cco-text-muted:  #6e7c74;
  --cco-orange:      #d97a00;
  --cco-red:         #cc3333;
}

/* =========================================================
   Wrapper global
   ========================================================= */
.cco-options-wrapper { margin-bottom: 20px; }

/* =========================================================
   Live Preview Canvas (intégré dans la galerie WC ou en bloc)
   ========================================================= */
.cco-preview-canvas { position: relative; width: 100%; max-width: 600px; aspect-ratio: 1 / 1; background: #fff; border: 1.5px solid var(--cco-border); border-radius: 12px; overflow: hidden; box-shadow: 0 4px 16px rgba(127,194,161,.12); margin: 0 auto 18px; }
.cco-preview-base { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; pointer-events: none; transition: opacity .2s ease; }
.cco-preview-layer { position: absolute; transform: translate(-50%, -50%); object-fit: contain; opacity: 0; transition: opacity .25s ease, transform .25s ease; pointer-events: none; user-select: none; }

/* Wrapper inséré dans la galerie WC */
.cco-preview-gallery-slot { width: 100%; max-width: 600px; margin: 0 auto 12px; }
.cco-preview-hidden-image { display: none !important; }

@media (max-width: 600px) {
	.cco-preview-canvas, .cco-preview-gallery-slot { max-width: 100%; }
}

/* =========================================================
   Heading (titre de section dans un groupe)
   ========================================================= */
.cco-field--heading { padding: 12px 14px; background: #fffef0; border-left: 3px solid var(--cco-green); border-radius: 6px; margin-bottom: 14px; }
.cco-heading__title { font-size: 14px; font-weight: 800; color: var(--cco-green-dark); margin: 0 0 6px; text-transform: none; letter-spacing: 0; }
.cco-heading__description { font-size: 12px; color: var(--cco-text); line-height: 1.5; }
.cco-heading__description a { color: var(--cco-green-dark); font-weight: 600; text-decoration: underline; }
.cco-heading__description a:hover { color: var(--cco-orange); }

/* =========================================================
   Select natif (dropdown)
   ========================================================= */
.cco-select-input { width: 100%; max-width: 360px; padding: 9px 12px; border: 1.5px solid var(--cco-border); border-radius: 8px; background: #fff; font-size: 13px; color: var(--cco-text); cursor: pointer; transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235aaa87' stroke-width='2.5' stroke-linecap='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.cco-select-input:focus { outline: none; border-color: var(--cco-green-dark); box-shadow: 0 0 0 3px rgba(127,194,161,.2); }
.cco-select-input option:disabled { color: var(--cco-text-muted); }

/* =========================================================
   Groupe
   ========================================================= */
.cco-group { background: #fff; border: 1.5px solid var(--cco-border); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(127,194,161,.08); }
.cco-group__title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; color: var(--cco-green-dark); margin: 0 0 16px; }

/* =========================================================
   Champ générique
   ========================================================= */
.cco-field { margin-bottom: 18px; }
.cco-field:last-child { margin-bottom: 0; }
.cco-field__label-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.cco-field__label { font-size: 13px; font-weight: 700; color: var(--cco-text); }
.cco-field__hint { font-size: 11px; color: var(--cco-text-muted); }
.cco-field__description { font-size: 12px; color: var(--cco-text-muted); margin: 0 0 8px; }
.cco-required { color: var(--cco-orange); }
.cco-price-tag { color: var(--cco-orange); font-weight: 700; font-size: 12px; }

/* =========================================================
   Radio cards
   ========================================================= */
.cco-radio-group { display: flex; flex-wrap: wrap; gap: 8px; }
.cco-radio-card { display: flex; cursor: pointer; }
.cco-radio-card input { position: absolute; opacity: 0; width: 0; height: 0; }
.cco-radio-card__inner { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1.5px solid var(--cco-border); border-radius: 8px; background: #f7fbf9; transition: border-color .15s, background .15s, box-shadow .15s; font-size: 13px; }
.cco-radio-card input:checked + .cco-radio-card__inner { border-color: var(--cco-green-dark); background: var(--cco-green-light); box-shadow: 0 0 0 2px rgba(127,194,161,.25); }
.cco-radio-card__indicator { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--cco-border); flex-shrink: 0; transition: border-color .15s, background .15s; }
.cco-radio-card input:checked ~ .cco-radio-card__inner .cco-radio-card__indicator,
.cco-radio-card input:checked + .cco-radio-card__inner .cco-radio-card__indicator { border-color: var(--cco-green-dark); background: var(--cco-green-dark); }

/* =========================================================
   Checkbox cards
   ========================================================= */
.cco-checkbox-group { display: flex; flex-direction: column; gap: 6px; }
.cco-checkbox-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cco-checkbox-card { display: flex; cursor: pointer; }
.cco-checkbox-card input { position: absolute; opacity: 0; width: 0; height: 0; }
.cco-checkbox-card__inner { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1.5px solid var(--cco-border); border-radius: 8px; background: #f7fbf9; transition: border-color .15s, background .15s, box-shadow .15s; font-size: 13px; }
.cco-checkbox-card input:checked + .cco-checkbox-card__inner { border-color: var(--cco-green-dark); background: var(--cco-green-light); box-shadow: 0 0 0 2px rgba(127,194,161,.25); }
.cco-checkbox-card__indicator { width: 14px; height: 14px; border-radius: 3px; border: 2px solid var(--cco-border); flex-shrink: 0; transition: border-color .15s, background .15s; }
.cco-checkbox-card input:checked + .cco-checkbox-card__inner .cco-checkbox-card__indicator { border-color: var(--cco-green-dark); background: var(--cco-green-dark); }

/* =========================================================
   Quantité par choix
   ========================================================= */
.cco-qty-ctrl { display: flex; align-items: center; gap: 0; border: 1.5px solid var(--cco-border); border-radius: 7px; overflow: hidden; }
.cco-qty-btn { width: 30px; height: 32px; background: #f7fbf9; border: none; cursor: pointer; font-size: 16px; font-weight: 700; color: var(--cco-green-dark); display: flex; align-items: center; justify-content: center; transition: background .15s; }
.cco-qty-btn:hover { background: var(--cco-green-light); }
.cco-qty-input { width: 40px; height: 32px; border: none; border-left: 1.5px solid var(--cco-border); border-right: 1.5px solid var(--cco-border); text-align: center; font-size: 13px; font-weight: 700; background: #fff; outline: none; -moz-appearance: textfield; }
.cco-qty-input::-webkit-outer-spin-button,
.cco-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* =========================================================
   Color swatches
   ========================================================= */
.cco-color-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.cco-color-swatch { cursor: pointer; display: flex; align-items: center; }
.cco-color-swatch input { position: absolute; opacity: 0; width: 0; height: 0; }
.cco-color-dot { width: 38px; height: 38px; border-radius: 50%; border: 3px solid transparent; outline: 2px solid #ccc; transition: box-shadow .15s, transform .1s; display: block; }
.cco-color-swatch input:checked + .cco-color-dot { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--cco-green-dark); transform: scale(1.1); }

/* =========================================================
   Image swatches
   ========================================================= */
.cco-image-swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.cco-swatch-image-wrap { position: relative; display: flex; flex-direction: column; align-items: center; }
.cco-image-swatch { cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cco-image-swatch input { position: absolute; opacity: 0; width: 0; height: 0; }
.cco-image-swatch img { border: 3px solid transparent; border-radius: 8px; object-fit: contain; background: #fff; transition: border-color .15s, box-shadow .15s; }
.cco-image-swatch input:checked + img,
.cco-image-swatch.is-selected img { border-color: var(--cco-green-dark); box-shadow: 0 0 0 2px rgba(90,170,135,.35); }
.cco-swatch-label { font-size: 11px; color: var(--cco-text-muted); text-align: center; line-height: 1.3; }
.cco-swatches--size-small  .cco-image-swatch img { width: 64px; height: 64px; }
.cco-swatches--size-medium .cco-image-swatch img { width: 96px; height: 96px; }
.cco-swatches--size-large  .cco-image-swatch img { width: 128px; height: 128px; }

/* Bouton zoom — petite loupe discrète en haut à droite de l'image */
/* Préfixe #cco-options + !important : les styles globaux Elementor (.elementor-kit-N button)
   ont une spécificité supérieure à une simple classe et rendaient le bouton en pavé noir. */
#cco-options .cco-zoom-btn { position: absolute; top: 4px; right: 4px; width: 18px !important; height: 18px !important; min-width: 0 !important; min-height: 0 !important; border-radius: 50% !important; background: rgba(255,255,255,.7) !important; border: none !important; box-shadow: none !important; cursor: pointer; display: flex !important; align-items: center; justify-content: center; color: var(--cco-text-muted) !important; transition: background .15s, color .15s, transform .15s; padding: 0 !important; margin: 0 !important; line-height: 1 !important; font-size: 0 !important; opacity: .75; z-index: 2; }
#cco-options .cco-zoom-btn:hover { background: #fff !important; color: var(--cco-green-dark) !important; opacity: 1; transform: scale(1.15); }
#cco-options .cco-zoom-btn svg { width: 10px; height: 10px; }

/* =========================================================
   Champs texte / textarea
   ========================================================= */
.cco-text-wrap { position: relative; }
.cco-text-input, .cco-textarea-input { width: 100%; box-sizing: border-box; border: 1.5px solid var(--cco-border); border-radius: 8px; padding: 10px 14px; font-size: 14px; font-family: inherit; color: var(--cco-text); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
.cco-text-input:focus, .cco-textarea-input:focus { border-color: var(--cco-green-dark); box-shadow: 0 0 0 3px rgba(127,194,161,.2); }
.cco-textarea-input { resize: vertical; min-height: 80px; }

/* Compteur de caractères */
.cco-char-counter { font-size: 11px; color: var(--cco-text-muted); text-align: right; margin-top: 4px; }
.cco-char-counter--near { color: var(--cco-orange); font-weight: 700; }

/* =========================================================
   Champ fichier
   ========================================================= */
.cco-file-wrap { display: flex; flex-direction: column; gap: 8px; }
.cco-file-label { display: inline-flex; cursor: pointer; }
.cco-file-input { position: absolute; opacity: 0; width: 0; height: 0; }
.cco-file-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: 1.5px solid var(--cco-border); border-radius: 7px; background: #f7fbf9; color: var(--cco-green-dark); font-size: 13px; font-weight: 600; transition: background .15s, border-color .15s; }
.cco-file-btn:hover { background: var(--cco-green-light); border-color: var(--cco-green); }
.cco-file-status { font-size: 12px; color: var(--cco-text-muted); }
.cco-file-ok  { color: var(--cco-green-dark); font-weight: 600; }
.cco-file-error { color: var(--cco-red); }

/* =========================================================
   Stock épuisé
   ========================================================= */
.cco-out-of-stock { opacity: .5; cursor: not-allowed; }
.cco-stock-badge { display: inline-block; background: #fff0f0; color: var(--cco-red); border-radius: 4px; font-size: 10px; font-weight: 700; padding: 2px 6px; margin-left: 4px; }

/* =========================================================
   Sticky summary bar
   ========================================================= */
.cco-summary-bar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999; background: #fff; border-top: 2px solid var(--cco-green); box-shadow: 0 -4px 16px rgba(127,194,161,.25); }
.cco-summary-bar__inner { max-width: 900px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 10px; }
.cco-summary-bar__label { font-size: 13px; color: var(--cco-text-muted); font-weight: 600; }
.cco-summary-bar__total { font-size: 18px; font-weight: 800; color: var(--cco-green-dark); }
.cco-summary-bar__detail { font-size: 12px; color: var(--cco-text-muted); font-weight: normal; }
.cco-summary-bar__opts { color: var(--cco-orange); font-weight: 700; }

/* =========================================================
   Lightbox
   ========================================================= */
.cco-lightbox { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; }
.cco-lightbox__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(4px); }
.cco-lightbox__dialog { position: relative; z-index: 1; background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3); max-width: 90vw; max-height: 90vh; display: flex; flex-direction: column; align-items: center; gap: 12px; animation: cco-lb-in .2s ease; }
@keyframes cco-lb-in { from { opacity: 0; transform: translateY(-12px) scale(.97); } to { opacity: 1; transform: none; } }
.cco-lightbox__img { max-width: 80vw; max-height: 70vh; object-fit: contain; border-radius: 8px; }
.cco-lightbox__label { font-size: 13px; color: var(--cco-text-muted); font-weight: 600; text-align: center; }
.cco-lightbox__close { position: absolute; top: 10px; right: 12px; background: none; border: none; cursor: pointer; font-size: 20px; color: var(--cco-text-muted); transition: color .15s; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.cco-lightbox__close:hover { color: var(--cco-red); background: #fff0f0; }
body.cco-lightbox-open { overflow: hidden; }
