/* ── WooCommerce Assistant – Frontend Styles ──────────────────────────────────────────── */

:root {
    --wcg-primary:     #177058;
    --wcg-primary-bg:  #e3f1eb;
    --wcg-accent:      #177058;
    --wcg-border:      #e2e8f0;
    --wcg-border-sel:  #177058;
    --wcg-bg:          #f8fafc;
    --wcg-card-bg:     #ffffff;
    --wcg-radius:      12px;
    --wcg-shadow:      0 1px 4px rgba(0,0,0,.08);
    --wcg-shadow-sel:  0 2px 12px rgba(23,112,88,.18);
    --wcg-text:        #1e293b;
    --wcg-muted:       #64748b;
    --wcg-btn-bg:      #1e293b;
    --wcg-btn-hover:   #334155;
    --wcg-star-on:     #f59e0b;
    --wcg-star-off:    #e2e8f0;
}

/* Wrap */
.wc-guide-wrap {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px 16px;
    font-family: inherit;
    color: var(--wcg-text);
}

/* Les contrôles de formulaire (button/input/select) utilisent la police par
   défaut du navigateur et n'héritent pas : on force l'héritage pour suivre la
   typographie native du thème (réglages Divi → Typographie). Les titres
   h1/h2/h3 ne sont jamais surchargés, ils suivent les réglages "Header" de Divi. */
.wc-guide-wrap button,
.wc-guide-wrap input,
.wc-guide-wrap select,
.wc-guide-wrap textarea {
    font-family: inherit;
}

/* ── Header ── */
.wc-guide-header {
    text-align: center;
    margin-bottom: 36px;
}
.wc-guide-title {
    line-height: 1.3;
    margin: 0 0 8px;
    color: var(--wcg-text);
}
.wc-guide-subtitle {
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ── Question ── */
.wc-guide-question {
    border: none;
    padding: 0;
    margin: 0 0 36px;
}
.wc-guide-question-title {
    margin: 0 0 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    color: var(--wcg-text);
}
.wc-guide-prefix {
    color: var(--wcg-text);
    font-weight: 700;
}
.wc-guide-multi-hint {
    margin-left: auto;
    color: var(--wcg-muted);
    font-style: italic;
}

/* ── Options grid ── */
.wc-guide-options {
    display: grid;
    gap: 14px;
}
.wc-guide-cols-2 { grid-template-columns: repeat(2, 1fr); }
.wc-guide-cols-3 { grid-template-columns: repeat(3, 1fr); }
.wc-guide-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Mobile : une seule colonne quel que soit le nombre de réponses */
@media (max-width: 640px) {
    .wc-guide-cols-2,
    .wc-guide-cols-3,
    .wc-guide-cols-4 { grid-template-columns: 1fr; }
}

/* ── Option card ── */
.wc-guide-option {
    display: block;
    cursor: pointer;
    position: relative;
    user-select: none;
}
.wc-guide-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.wc-guide-option-inner {
    background: var(--wcg-card-bg);
    border: 2px solid var(--wcg-border);
    border-radius: var(--wcg-radius);
    padding: 18px 14px 14px;
    text-align: center;
    transition: border-color .15s, box-shadow .15s, background .15s;
    box-shadow: var(--wcg-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 130px;
}
.wc-guide-option:hover .wc-guide-option-inner {
    border-color: #7fc3aa;
    box-shadow: 0 2px 10px rgba(23,112,88,.12);
}

/* Selected state */
.wc-guide-input:checked + .wc-guide-option-inner,
.wc-guide-option.is-selected .wc-guide-option-inner {
    border-color: var(--wcg-border-sel);
    background: var(--wcg-primary-bg);
    box-shadow: var(--wcg-shadow-sel);
}

/* Image */
.wc-guide-option-image {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}
.wc-guide-option-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.wc-guide-option-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--wcg-muted);
}
.wc-guide-option-emoji {
    font-size: 2.4rem;
    margin-bottom: 10px;
    line-height: 1;
}

/* Text */
.wc-guide-option-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
}
.wc-guide-option-label {
    font-weight: 600;
    font-size: 1rem;
    color: var(--wcg-text);
    line-height: 1.3;
}
.wc-guide-input:checked + .wc-guide-option-inner .wc-guide-option-label {
    color: var(--wcg-accent);
}
.wc-guide-option-desc {
    font-size: .90rem;
    color: var(--wcg-muted);
    line-height: 1.4;
}
.wc-guide-input:checked + .wc-guide-option-inner .wc-guide-option-desc {
    color: #177058;
}

/* Check indicator */
.wc-guide-option-check {
    display: block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--wcg-border);
    border-radius: 50%;
    margin-top: 10px;
    flex-shrink: 0;
    position: relative;
    transition: border-color .15s, background .15s;
}
.wc-guide-input[type="checkbox"] + .wc-guide-option-inner .wc-guide-option-check {
    border-radius: 4px;
}
.wc-guide-input:checked + .wc-guide-option-inner .wc-guide-option-check {
    background: var(--wcg-primary);
    border-color: var(--wcg-primary);
}
.wc-guide-input:checked + .wc-guide-option-inner .wc-guide-option-check::after {
    content: '';
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%) rotate(45deg);
    width: 5px;
    height: 9px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
}

/* ── Submit button ── */
.wc-guide-actions {
    text-align: center;
    margin-top: 8px;
}
.wc-guide-btn-submit {
    background: var(--wcg-btn-bg);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 14px 48px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .05em;
    cursor: pointer;
    transition: background .15s, transform .1s;
}
.wc-guide-btn-submit:hover {
    background: var(--wcg-btn-hover);
}
.wc-guide-btn-submit:active {
    transform: scale(.98);
}
.wc-guide-btn-submit:disabled {
    opacity: .6;
    cursor: not-allowed;
}

/* Validation message */
.wc-guide-validation-msg {
    text-align: center;
    color: #dc2626;
    font-size: .9rem;
    margin-top: 12px;
    min-height: 1.2em;
}

/* ── Results ── */
.wc-guide-results {
    animation: wcgFadeIn .3s ease;
}
.wc-guide-results[hidden] {
    display: none;
}
.wc-guide-results-title {
    text-align: center;
    margin-bottom: 28px;
    color: var(--wcg-text);
}
.wc-guide-no-results {
    text-align: center;
    color: var(--wcg-muted);
    padding: 32px;
    font-size: 1rem;
}

/* Product grid */
.wc-guide-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}
.wc-guide-product-card {
    background: var(--wcg-card-bg);
    border: 1px solid var(--wcg-border);
    border-radius: var(--wcg-radius);
    overflow: hidden;
    box-shadow: var(--wcg-shadow);
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s;
}
.wc-guide-product-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
}
.wc-guide-product-img-wrap {
    display: block;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--wcg-bg);
}
.wc-guide-product-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}
.wc-guide-product-card:hover .wc-guide-product-img-wrap img {
    transform: scale(1.04);
}
.wc-guide-no-img {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 3rem;
    color: var(--wcg-border);
}

.wc-guide-product-body {
    padding: 14px 14px 6px;
    flex: 1;
}
.wc-guide-product-title {
    font-size: .95rem;
    margin: 0 0 8px;
    line-height: 1.3;
}
.wc-guide-product-title a {
    color: var(--wcg-text);
    text-decoration: none;
}
.wc-guide-product-title a:hover {
    color: var(--wcg-primary);
}
.wc-guide-stars {
    margin-bottom: 6px;
    font-size: 1rem;
    line-height: 1;
}
.wc-guide-star { color: var(--wcg-star-off); }
.wc-guide-star.filled { color: var(--wcg-star-on); }

.wc-guide-product-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--wcg-primary);
}
.wc-guide-product-price del { color: var(--wcg-muted); font-weight: 400; margin-right: 4px; font-size: .85em; }
.wc-guide-product-price ins { text-decoration: none; }

.wc-guide-product-footer {
    padding: 10px 14px 14px;
}
.wc-guide-btn-product {
    display: block;
    background: var(--wcg-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s;
}
.wc-guide-btn-product:hover {
    background: #0f5a45;
    color: #fff;
}

/* Reset button */
.wc-guide-results-footer {
    text-align: center;
    margin-top: 32px;
}
.wc-guide-btn-reset {
    background: none;
    border: 2px solid var(--wcg-border);
    border-radius: 50px;
    padding: 10px 28px;
    font-size: .9rem;
    cursor: pointer;
    color: var(--wcg-muted);
    transition: border-color .15s, color .15s;
}
.wc-guide-btn-reset:hover {
    border-color: var(--wcg-primary);
    color: var(--wcg-primary);
}

/* Loading spinner */
.wc-guide-loading {
    text-align: center;
    padding: 40px;
    color: var(--wcg-muted);
}
.wc-guide-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--wcg-border);
    border-top-color: var(--wcg-primary);
    border-radius: 50%;
    animation: wcgSpin .7s linear infinite;
    margin-bottom: 12px;
}

@keyframes wcgSpin    { to { transform: rotate(360deg); } }
@keyframes wcgFadeIn  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes wcgSlideIn { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: translateY(0); } }

/* ── Progressive reveal ── */
.wc-guide-question.is-hidden {
    display: none;
}
.wc-guide-actions.is-hidden {
    display: none;
}
/* Option hidden by a conditional "Masquer si" rule */
.wc-guide-option.is-cond-hidden {
    display: none;
}

/* Slide-in animation for newly revealed question */
.wc-guide-question.is-entering {
    animation: wcgSlideIn .45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Answered question: slightly muted, separator below */
.wc-guide-question.is-done {
    padding-bottom: 28px;
    border-bottom: 1px solid var(--wcg-border);
    margin-bottom: 32px;
}
.wc-guide-question.is-done .wc-guide-question-title {
    color: var(--wcg-muted);
}
/* Checkmark badge on the title */
.wc-guide-question.is-done .wc-guide-question-title::after {
    content: '✓';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    min-width: 20px;
    background: #22c55e;
    color: #fff;
    border-radius: 50%;
    font-size: .7rem;
    font-weight: 900;
    margin-left: 8px;
    line-height: 1;
}
/* Dim non-selected options on answered questions */
.wc-guide-question.is-done .wc-guide-option:not(.is-selected) .wc-guide-option-inner {
    opacity: .4;
}

/* ── Progress bar ── */
.wc-guide-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 420px;
    margin: 24px auto 0;
}
.wc-guide-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--wcg-border);
    border-radius: 3px;
    overflow: hidden;
}
.wc-guide-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--wcg-primary);
    border-radius: 3px;
    transition: width .45s cubic-bezier(0.16, 1, 0.3, 1);
}
.wc-guide-progress-text {
    font-size: .82rem;
    color: var(--wcg-muted);
    font-weight: 500;
    white-space: nowrap;
    min-width: 36px;
    text-align: right;
}

/* ── "Continuer" button (multi-choice questions) ── */
.wc-guide-btn-next {
    display: block;
    margin: 22px auto 0;
    background: var(--wcg-btn-bg);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 12px 40px;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .04em;
    cursor: pointer;
    transition: background .15s, opacity .2s, transform .1s;
}
.wc-guide-btn-next:hover:not(:disabled) {
    background: var(--wcg-btn-hover);
}
.wc-guide-btn-next:active:not(:disabled) {
    transform: scale(.97);
}
.wc-guide-btn-next:disabled {
    opacity: .3;
    cursor: not-allowed;
}

/* Submit button reveal animation */
.wc-guide-actions:not(.is-hidden) {
    animation: wcgSlideIn .4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
