/**
 * WCPA — Styles Frontend
 */

/* === Wrapper principal des add-ons === */
.wcpa-addons-wrapper {
    background: #f9f9f9;
    border: 1px solid #e2e4e7;
    border-radius: 6px;
    padding: 20px 22px;
    margin: 20px 0;
    font-family: inherit;
}

/* === Titre de section === */
.wcpa-section-title {
    margin: 0 0 18px;
    font-size: 18px;
    font-weight: 600;
    color: #23282d;
    border-bottom: 2px solid #007cba;
    padding-bottom: 8px;
}

/* === Champs === */
.wcpa-field {
    margin-bottom: 18px;
}

.wcpa-field:last-child {
    margin-bottom: 0;
}

/* Label */
.wcpa-field-label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #23282d;
    margin-bottom: 7px;
    cursor: default;
}

.wcpa-field-label .required {
    font-weight: normal;
}

/* Inputs texte et textarea */
.wcpa-input-text,
.wcpa-input-textarea,
.wcpa-input-select {
    width: 100%;
    max-width: 400px;
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    color: #23282d;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
}

.wcpa-input-text:focus,
.wcpa-input-textarea:focus,
.wcpa-input-select:focus {
    border-color: #007cba;
    outline: none;
    box-shadow: 0 0 0 1px rgba(0,124,186,0.3);
}

.wcpa-input-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Select */
.wcpa-input-select {
    cursor: pointer;
}

/* === Checkbox === */
.wcpa-checkbox-option-label,
.wcpa-radio-option-label {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 6px;
    font-size: 14px;
    color: #23282d;
    cursor: pointer;
}

.wcpa-input-checkbox,
.wcpa-input-radio {
    cursor: pointer;
    accent-color: #007cba;
    width: 16px;
    height: 16px;
    margin: 0;
}

/* === Prix des options === */
.wcpa-option-price {
    color: #2e8b57;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}
/* === Boîte d'aperçu (petit carré) === */
.wcpa-preview-box {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 90px;
    height: 90px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    padding: 6px;
    margin-top: 8px;
    text-align: center;
    overflow: hidden;
    box-sizing: border-box;
    vertical-align: top;
}

.wcpa-preview-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.wcpa-preview-text-content {
    display: block;
    font-size: 12px;
    color: #23282d;
    word-break: break-word;
    line-height: 1.3;
    max-height: 100%;
    overflow: hidden;
}

/* Variante utilisée dans le panier / checkout */
.wcpa-preview-box-cart {
    display: inline-flex;
    width: 70px;
    height: 70px;
    margin: 4px 0;
    vertical-align: middle;
}
/* === Prix total dynamique === */
.wcpa-total-price-wrapper {
    background: #e8f4fd;
    border: 1px solid #b8dcf0;
    border-radius: 4px;
    padding: 10px 14px;
    font-size: 15px;
    color: #0e4872;
}

.wcpa-total-price-wrapper strong {
    font-size: 16px;
}

.wcpa-total-price-amount {
    font-weight: 700;
    color: #007cba;
}

/* === Prix total visible quand des add-ons sont présents === */
.wcpa-addons-wrapper.has-addons .wcpa-total-price-wrapper {
    display: block;
}

/* === États vides === */
.wcpa-no-options {
    color: #666;
    font-style: italic;
}

/* === Message d'erreur de validation === */
.wcpa-field-error {
    color: #c0392b;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.wcpa-field.wcpa-has-error .wcpa-field-error {
    display: block;
}

.wcpa-field.wcpa-has-error .wcpa-input-text,
.wcpa-field.wcpa-has-error .wcpa-input-textarea,
.wcpa-field.wcpa-has-error .wcpa-input-select {
    border-color: #c0392b;
}

/* === Notification prix mis à jour === */
.wcpa-total-updated {
    animation: wcpa-flash 0.4s ease;
}

@keyframes wcpa-flash {
    0%   { background-color: #e8f4fd; }
    50%  { background-color: #b8dcf0; }
    100% { background-color: #e8f4fd; }
}

/* === Blocage du bouton ajout au panier si add-ons requis non remplis === */
.wcpa-addons-wrapper.checking .wcpa-submit-wrap {
    opacity: 0.6;
    pointer-events: none;
}

/* === Responsive === */
@media screen and (max-width: 600px) {
    .wcpa-addons-wrapper {
        padding: 15px 12px;
    }

    .wcpa-input-text,
    .wcpa-input-textarea,
    .wcpa-input-select {
        max-width: 100%;
    }

    .wcpa-section-title {
        font-size: 16px;
    }
}
/* Agrandir et mettre en avant le prix variation */
.woocommerce-variation-price {
    margin: 10px 0 20px 0 !important;
}

.woocommerce-variation-price .price,
.woocommerce-variation-price .amount {
    font-size: 28px !important;
    font-weight: 700 !important;
    color: #7a5c3e;
    display: inline-block;
}

/* Réduire la preview box vide pour qu'elle ne casse pas la mise en page */
.wcpa-preview-box.wcpa-preview-empty {
    display: none !important;
}

/* Espacement propre entre le champ texte, la preview, et la quantité */
.wcpa-addons-wrapper {
    margin-bottom: 15px;
}

.quantity {
    margin-top: 15px !important;
}
