/* ============================================================
   Simulateur Charpente Bois — WordPress Plugin CSS
   Author : Adrianoh Publithings
   Version: 1.0.0
   Toutes les règles sont scopées sous .cb-simulateur pour
   éviter tout conflit avec le thème WordPress.
   ============================================================ */

/* ---------- Variables ---------- */
.cb-simulateur {
    --cb-primary:    #bf1120;
    --cb-primary-dk: #a30f1c;
    --cb-white:      #ffffff;
    --cb-shadow:     rgba(191, 17, 32, 0.2);
    --cb-bg-light:   #f8f9fa;
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* ---------- Reset interne (sans casser le thème) ---------- */
.cb-simulateur *,
.cb-simulateur *::before,
.cb-simulateur *::after {
    box-sizing: border-box;
}

/* ---------- Layout principal ---------- */
.cb-container {
    display: flex;
    min-height: 520px;
    flex-direction: row;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,.12);
}

/* ---------- Panneau gauche ---------- */
.cb-left-panel {
    flex: 1;
    background-image: url('https://images.unsplash.com/photo-1589939705384-5185137a7f0f?auto=format&fit=crop&q=80');
    background-size: cover;
    background-position: center;
    padding: 2rem;
    color: var(--cb-white);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
}

.cb-left-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(191, 17, 32, 0.85);
    z-index: 0;
}

.cb-title,
.cb-progress-bar {
    position: relative;
    z-index: 1;
    color: var(--cb-white);
}

.cb-title {
    font-size: 1.45rem;
    font-weight: 700;
    margin: 0 0 1.8rem;
    line-height: 1.4;
}

.cb-quote {
    font-style: italic;
    color: #ffe08a;
}

/* ---------- Barre de progression ---------- */
.cb-progress-bar {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
}

.cb-progress {
    position: absolute;
    height: 4px;
    background-color: var(--cb-white);
    width: 0%;
    top: 50%;
    transform: translateY(-50%);
    transition: width .35s ease;
    z-index: 0;
}

.cb-step {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: .9rem;
    z-index: 1;
    background-color: rgba(255,255,255,.35);
    color: var(--cb-white);
    border: 2px solid rgba(255,255,255,.5);
    transition: background-color .3s, color .3s;
}

.cb-step.cb-active {
    background-color: var(--cb-white);
    color: var(--cb-primary);
    border-color: var(--cb-white);
}

/* ---------- Panneau droit ---------- */
.cb-right-panel {
    flex: 2;
    padding: 2.5rem 2rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: var(--cb-white);
    overflow-y: auto;
}

.cb-form-container {
    width: 100%;
    max-width: 700px;
}

/* ---------- Titres d'étape ---------- */
.cb-step-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #222;
    margin: 0 0 1.5rem;
}

/* ---------- Options bois & installation ---------- */
.cb-wood-options,
.cb-installation-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1.2rem;
    margin: 0 0 1.5rem;
}

.cb-wood-card,
.cb-install-card {
    background: var(--cb-white);
    border-radius: 10px;
    padding: 1.4rem 1rem;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 14px var(--cb-shadow);
    transition: transform .25s ease, box-shadow .25s ease, background-color .25s ease;
    position: relative;
    border: 2px solid transparent;
    user-select: none;
}

.cb-wood-card:hover,
.cb-install-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 22px var(--cb-shadow);
}

.cb-wood-card.cb-selected,
.cb-install-card.cb-selected {
    border-color: var(--cb-primary);
    transform: translateY(-4px);
    box-shadow: 0 8px 22px var(--cb-shadow);
    background-color: rgba(191, 17, 32, 0.07);
}

.cb-tree-icon,
.cb-install-icon {
    font-size: 40px;
    margin-bottom: .7rem;
    display: block;
}

.cb-wood-card h4,
.cb-install-card h4 {
    margin: .6rem 0;
    color: #333;
    font-size: 1.05rem;
    font-weight: 600;
}

.cb-price-tag {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: #e8f7e8;
    padding: .3rem .75rem;
    border-radius: 20px;
    font-weight: 700;
    color: #2a7a2a;
    font-size: .8rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
    white-space: nowrap;
}

/* Masquer les radios visuellement mais garder l'accessibilité */
.cb-simulateur input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* ---------- Champ surface ---------- */
.cb-input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.cb-simulateur input[type="number"] {
    padding: .55rem .8rem;
    font-size: 1.15rem;
    border: 2px solid var(--cb-primary) !important;
    border-radius: 6px;
    width: 160px;
    outline: none;
    color: #333;
    background: var(--cb-white);
}

.cb-simulateur label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #555;
}

/* ---------- Messages d'erreur ---------- */
.cb-error-message {
    color: var(--cb-primary);
    font-size: .875rem;
    margin: .4rem 0 0;
    display: none;
}

.cb-step-content.cb-has-error .cb-error-message {
    display: block;
}

/* ---------- Boutons navigation ---------- */
.cb-button-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    gap: 1rem;
}

.cb-btn {
    padding: .75rem 1.8rem;
    background-color: var(--cb-primary);
    color: var(--cb-white) !important;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color .25s ease, transform .2s ease;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    line-height: 1.3;
    text-decoration: none;
}

.cb-btn:hover {
    background-color: var(--cb-primary-dk);
    color: var(--cb-white) !important;
    transform: translateY(-1px);
}

/* ---------- Utilitaires ---------- */
.cb-hidden {
    display: none !important;
}

/* ---------- Résultat ---------- */
#cb-result {
    text-align: center;
    padding-bottom: 1rem;
}

#cb-result h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 1.2rem;
    color: #222;
}

/* Tableau récapitulatif */
.cb-result-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    border-radius: 10px;
    overflow: hidden;
    font-size: .95rem;
}

.cb-result-table thead tr {
    background-color: var(--cb-primary);
}

.cb-result-table th {
    padding: .9rem 1rem;
    text-align: left;
    color: var(--cb-white);
    font-weight: 700;
    font-size: .95rem;
}

.cb-result-table tbody tr {
    background-color: var(--cb-bg-light);
    border-bottom: 1px solid #e9ecef;
}

.cb-result-table tbody tr:last-child {
    border-bottom: none;
}

.cb-result-table td {
    padding: .9rem 1rem;
    color: #333;
}

/* Estimations */
.cb-estimates-container {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.8rem 0;
}

.cb-estimate-box {
    flex: 1;
    padding: 1.3rem 1rem;
    border-radius: 10px;
    text-align: center;
    background-color: var(--cb-bg-light);
}

.cb-estimate-box.cb-highlighted {
    background-color: #fde8e8;
    box-shadow: 0 4px 14px var(--cb-shadow);
}

.cb-estimate-label {
    font-size: .85rem;
    color: #666;
    margin-bottom: .4rem;
}

.cb-estimate-price {
    font-size: 1.45rem;
    color: var(--cb-primary);
    font-weight: 700;
}

/* Bouton devis */
.cb-devis-button {
    display: flex !important;
    width: 100%;
    padding: 1.1rem 1.5rem;
    margin: 1.2rem 0 1.8rem;
    background: linear-gradient(135deg, #152d5d 0%, #102043 100%);
    color: #fff !important;
    border: none;
    border-radius: 25px;
    text-align: center;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 1rem;
    transition: transform .25s ease, box-shadow .25s ease;
    box-shadow: 0 4px 15px rgba(21,45,93,.4);
    align-items: center;
    justify-content: center;
    gap: .8rem;
    line-height: 1.3;
}

.cb-devis-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(21,45,93,.55);
    color: #fff !important;
    text-decoration: none !important;
}

/* Note importante */
.cb-note-importante {
    margin: 1.5rem 0;
    padding: 1rem 1.2rem;
    background-color: var(--cb-bg-light);
    border-radius: 10px;
    text-align: left;
}

.cb-note-importante h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 .7rem;
}

.cb-note-importante ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cb-note-importante li {
    margin: .4rem 0;
    font-size: .88rem;
    color: #555;
    line-height: 1.5;
}

/* Info réduction */
.cb-info-reduction {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .9rem 1rem;
    background-color: var(--cb-bg-light);
    border-radius: 6px;
    margin: 1rem 0 1.5rem;
    font-size: .88rem;
    color: #555;
    text-align: left;
}

/* Bouton nouvelle estimation */
#cb-newEstimation {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin: .5rem auto 1rem;
    padding: .8rem 2rem;
    background-color: var(--cb-primary);
    color: var(--cb-white) !important;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color .25s ease, transform .2s ease;
    text-decoration: none;
}

#cb-newEstimation:hover {
    background-color: var(--cb-primary-dk);
    color: var(--cb-white) !important;
    transform: translateY(-1px);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .cb-container {
        flex-direction: column;
        min-height: unset;
    }

    .cb-left-panel,
    .cb-right-panel {
        width: 100%;
        flex: none;
    }

    .cb-left-panel {
        padding: 1.5rem 1rem;
        min-height: 200px;
    }

    .cb-title {
        font-size: 1.1rem;
        margin-bottom: 1.2rem;
    }

    .cb-right-panel {
        padding: 1.5rem 1rem;
    }

    .cb-estimates-container {
        flex-direction: column;
    }

    .cb-estimate-box {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .cb-wood-options,
    .cb-installation-options {
        grid-template-columns: 1fr;
    }

    .cb-button-group {
        flex-direction: column;
        gap: .8rem;
    }

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

    .cb-input-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .cb-simulateur input[type="number"] {
        width: 100% !important;
    }

    .cb-devis-button {
        font-size: .88rem;
        padding: 1rem;
    }
}
