/* ============================================================
   Configurateur — CSS Front
   Design : industriel/utilitaire, propre, lisible
   ============================================================ */

:root {
    --rsp-primary:      #e8530a;
    --rsp-primary-dark: #c43f00;
    --rsp-bg:           #f8f8f7;
    --rsp-border:       #e0ddd8;
    --rsp-text:         #1a1a18;
    --rsp-text-muted:   #6b6b65;
    --rsp-success:      #1a7a3a;
    --rsp-success-bg:   #ecfdf3;
    --rsp-error:        #b91c1c;
    --rsp-error-bg:     #fef2f2;
    --rsp-info:         #1d4ed8;
    --rsp-info-bg:      #eff6ff;
    --rsp-radius:       6px;
    --rsp-shadow:       0 1px 4px rgba(0,0,0,.08);
    --rsp-transition:   0.2s ease;
}

/* ============================================================
   Conteneur principal
   ============================================================ */
.rsp-configurator {
    font-family: 'DM Sans', 'Helvetica Neue', sans-serif;
    font-size: 15px;
    color: var(--rsp-text);
    background: var(--rsp-bg);
    border: 1px solid var(--rsp-border);
    border-radius: 10px;
    padding: 28px 32px;
    max-width: 780px;
    margin: 0 auto 2rem;
    box-shadow: var(--rsp-shadow);
}

.rsp-config-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--rsp-border);
}

.rsp-config-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--rsp-text);
}

.rsp-config-subtitle {
    font-size: 0.875rem;
    color: var(--rsp-text-muted);
    margin: 0;
}

/* ============================================================
   Grille de variables
   ============================================================ */
.rsp-variables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px 24px;
    margin-bottom: 20px;
}

.rsp-variable-wrap {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rsp-variable-wrap[style*="display: none"],
.rsp-variable-wrap[style*="display:none"] {
    display: none !important;
}

/* ============================================================
   Labels & champs
   ============================================================ */
.rsp-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--rsp-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.rsp-badge {
    background: var(--rsp-primary);
    color: #fff;
    font-size: 0.65rem;
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: 0.06em;
}

.rsp-field {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--rsp-border);
    border-radius: var(--rsp-radius);
    font-size: 0.9rem;
    color: var(--rsp-text);
    background-color: #fff;
    transition: border-color var(--rsp-transition), box-shadow var(--rsp-transition);
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
}

select.rsp-select {
    background-color: #fff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b6b65' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    background-size: 12px !important;
    padding-right: 32px !important;
    cursor: pointer;
}
.rsp-readonly .rsp-field {
    background: #f3f3f1;
    color: var(--rsp-text-muted);
    cursor: not-allowed;
}

/* ============================================================
   Quantité & Pays
   ============================================================ */
.rsp-quantity-wrap,
.rsp-country-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.rsp-quantity-wrap .rsp-label,
.rsp-country-wrap .rsp-label {
    min-width: 140px;
    margin: 0;
}

.rsp-quantity-wrap .rsp-field,
.rsp-country-wrap .rsp-field {
    max-width: 260px;
}

/* ============================================================
   Boutons délai
   ============================================================ */
.rsp-delai-wrap {
    margin-bottom: 20px;
}

.rsp-delai-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.rsp-delai-btn {
    padding: 8px 16px;
    border: 1.5px solid var(--rsp-border);
    border-radius: 20px;
    background: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--rsp-text);
    cursor: pointer;
    transition: all var(--rsp-transition);
}

.rsp-delai-btn:hover {
    border-color: var(--rsp-primary);
    color: var(--rsp-primary);
}

.rsp-delai-btn.active {
    background: var(--rsp-primary);
    border-color: var(--rsp-primary);
    color: #fff;
}

/* ============================================================
   Boutons CTA
   ============================================================ */
.rsp-actions-primary,
.rsp-actions-secondary {
    margin: 20px 0;
}

.rsp-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--rsp-radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--rsp-transition);
    text-decoration: none;
}

.rsp-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.rsp-btn-price {
    background: var(--rsp-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(232, 83, 10, 0.30);
}

.rsp-btn-price:hover:not(:disabled) {
    background: var(--rsp-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(232, 83, 10, 0.40);
}

.rsp-btn-cart {
    background: var(--rsp-text);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.rsp-btn-cart:hover:not(:disabled) {
    background: #333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
}

/* ============================================================
   Bloc prix résultat
   ============================================================ */
.rsp-price-result {
    background: #fff;
    border: 1.5px solid var(--rsp-border);
    border-radius: 8px;
    overflow: hidden;
    margin: 20px 0;
}

.rsp-price-box {
    padding: 20px 24px;
    background: linear-gradient(135deg, #fff8f5 0%, #fff 100%);
    border-bottom: 1px solid var(--rsp-border);
}

.rsp-price-main {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
}

.rsp-price-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--rsp-text-muted);
}

.rsp-price-ttc {
    font-size: 2rem;
    font-weight: 800;
    color: var(--rsp-primary);
    letter-spacing: -0.02em;
}

.rsp-price-ht {
    font-size: 0.875rem;
    color: var(--rsp-text-muted);
}

.rsp-price-details {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.rsp-price-detail-row {
    font-size: 0.85rem;
    color: var(--rsp-text-muted);
    display: flex;
    gap: 6px;
}

.rsp-price-detail-row strong {
    color: var(--rsp-text);
}

.rsp-options-list {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--rsp-border);
}

.rsp-options-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--rsp-text-muted);
    margin: 0 0 6px;
}

.rsp-option-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    padding: 4px 0;
}

.rsp-config-summary {
    padding: 16px 24px;
}

.rsp-details-text {
    font-family: inherit;
    font-size: 0.8rem;
    color: var(--rsp-text-muted);
    white-space: pre-line;
    margin: 0;
    line-height: 1.6;
}

.rsp-template-wrap {
    padding: 12px 24px;
    border-top: 1px solid var(--rsp-border);
}

.rsp-template-link {
    font-size: 0.85rem;
    color: var(--rsp-info);
    text-decoration: none;
    font-weight: 500;
}

.rsp-template-link:hover {
    text-decoration: underline;
}

/* ============================================================
   Messages
   ============================================================ */
.rsp-message {
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: var(--rsp-radius);
    margin-top: 6px;
    line-height: 1.5;
}

.rsp-msg-error {
    background: var(--rsp-error-bg);
    color: var(--rsp-error);
    border: 1px solid #fecaca;
}

.rsp-msg-success {
    background: var(--rsp-success-bg);
    color: var(--rsp-success);
    border: 1px solid #bbf7d0;
}

.rsp-msg-info {
    background: var(--rsp-info-bg);
    color: var(--rsp-info);
    border: 1px solid #bfdbfe;
}

.rsp-msg-desc {
    background: #f9fafb;
    color: var(--rsp-text-muted);
    border: 1px solid var(--rsp-border);
}

.rsp-global-messages {
    margin-top: 16px;
}

.rsp-global-messages .rsp-message {
    font-size: 0.9rem;
    padding: 12px 16px;
}

.rsp-global-messages a {
    color: inherit;
    font-weight: 600;
}

/* ============================================================
   Erreur bloc
   ============================================================ */
.rsp-error {
    background: var(--rsp-error-bg);
    color: var(--rsp-error);
    border: 1px solid #fecaca;
    border-radius: var(--rsp-radius);
    padding: 16px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 600px) {
    .rsp-configurator {
        padding: 18px 16px;
    }

    .rsp-variables-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .rsp-quantity-wrap,
    .rsp-country-wrap {
        flex-direction: column;
        align-items: flex-start;
    }

    .rsp-quantity-wrap .rsp-field,
    .rsp-country-wrap .rsp-field {
        max-width: 100%;
    }

    .rsp-price-ttc {
        font-size: 1.5rem;
    }

    .rsp-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================
   Admin CSS (inclus ici pour éviter un fichier séparé)
   ============================================================ */
.rsp-wrap h1 {
    font-size: 1.6rem;
}

/* Masquer tout le configurateur au chargement */
.rsp-variable-wrap {
    display: none;
}
#rsp-delai-wrap,
.rsp-quantity-wrap,
.rsp-country-wrap,
.rsp-actions-primary {
    display: none;
}
/* Mention sous le pays de livraison */
.rsp-country-note { margin: 6px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--wy-muted, #5E6E65); }

/* Chargement des options à l'ouverture de la fiche */
.rsp-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 96px;
    color: var(--rsp-text);
    font-weight: 600;
}

.rsp-loading__spin {
    flex: none;
    width: 22px;
    height: 22px;
    border: 3px solid #d7e8dc;
    border-top-color: #04672f;
    border-radius: 50%;
    animation: rsp-spin .8s linear infinite;
}

@keyframes rsp-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .rsp-loading__spin { animation-duration: 3s; }
}

.rsp-retry {
    margin-left: 6px;
    padding: 6px 12px;
    border: 2px solid currentColor;
    border-radius: 8px;
    background: #fff;
    color: inherit;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
