/* ============================================================
   Écran « Réparation & panier »
   ------------------------------------------------------------
   Fusion des anciennes étapes Problème + Réparation + Panier.
   Chargé uniquement sur la page du devis instantané.

   Layout : 2 colonnes sur desktop (choix à gauche, panier
   persistant à droite) ; panier en bandeau fixe bas d'écran
   sur mobile. Voir BiscaPhone-Refonte-UX-UI.md, Écran 2.
   ============================================================ */

.rp-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-8);
    max-width: 1120px;
    margin: var(--space-6) auto 0;
    align-items: start;
    text-align: left;
}

@media (min-width: 900px) {
    .rp-layout {
        grid-template-columns: minmax(0, 1fr) 320px;
    }
}

/* ── Colonne de gauche : choix ─────────────────────────────── */

.rp-choices h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-dark);
    margin-bottom: var(--space-4);
}

.rp-repair-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-8);
}

.rp-repair-card {
    background: #fff;
    border: 1.5px solid var(--color-border);
    border-radius: 14px;
    padding: var(--space-4) var(--space-2);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-body);
    position: relative;
    transition: border-color 150ms ease, background-color 150ms ease;
}

.rp-repair-card:hover,
.rp-repair-card:focus-visible {
    border-color: var(--color-accent);
    outline: none;
}

.rp-repair-card:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

.rp-repair-card--selected {
    border-color: var(--color-accent);
    background: #eef2fd; /* fallback */
    background: color-mix(in srgb, var(--color-accent) 6%, white);
}

.rp-repair-card__icon {
    width: 40px;
    height: 40px;
    color: var(--color-dark);
    transition: color 150ms ease;
}

.rp-repair-card--selected .rp-repair-card__icon,
.rp-repair-card:hover .rp-repair-card__icon {
    color: var(--color-accent);
}

.rp-repair-card__label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-dark);
    text-align: center;
}

.rp-repair-card__check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 150ms ease, transform 150ms ease;
}

.rp-repair-card--selected .rp-repair-card__check {
    opacity: 1;
    transform: scale(1);
}

/* ── Grille produits ────────────────────────────────────────── */

.rp-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-4);
}

.rp-product-card {
    background: #fff;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--space-4);
    cursor: pointer;
    text-align: left;
    font-family: var(--font-body);
    transition: border-color 150ms ease, box-shadow 150ms ease;
    position: relative;
}

.rp-product-card:hover,
.rp-product-card:focus-visible {
    border-color: var(--color-accent);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    outline: none;
}

.rp-product-card--in-cart {
    border-color: var(--color-success);
    background: #eefaf1; /* fallback */
    background: color-mix(in srgb, var(--color-success) 6%, white);
}

.rp-product-card__image {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 10px;
    background: #f5f7fb;
    margin-bottom: var(--space-2);
}

.rp-product-card__name {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--color-dark);
}

.rp-product-card__sub {
    font-size: 0.78rem;
    color: var(--color-muted);
    margin-top: 2px;
}

.rp-product-card__price {
    font-weight: 800;
    color: var(--color-accent);
    font-size: 0.98rem;
    margin-top: var(--space-2);
}

.rp-product-card__cta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: var(--space-2);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-accent);
}

.rp-product-card--in-cart .rp-product-card__cta {
    color: var(--color-success);
}

.rp-product-card--in-cart .rp-product-card__cta::before {
    content: '✓ Ajouté — cliquer pour retirer';
}

.rp-product-card:not(.rp-product-card--in-cart) .rp-product-card__cta::before {
    content: '+ Ajouter au panier';
}

/* ── Colonne de droite : panier persistant (desktop) ──────────── */

.rp-cart {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--space-6);
    position: sticky;
    top: calc(var(--navbar-height) + var(--space-4));
}

.rp-cart h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-dark);
    margin-bottom: var(--space-4);
}

.rp-cart__empty {
    color: var(--color-muted);
    font-size: 0.9rem;
    text-align: center;
    padding: var(--space-6) 0;
}

.rp-cart__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    max-height: 340px;
    overflow-y: auto;
}

.rp-cart__item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
}

.rp-cart__item-info { flex: 1; min-width: 0; }

.rp-cart__item-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--color-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rp-cart__item-price {
    font-weight: 700;
    color: var(--color-accent);
    font-size: 0.85rem;
}

.rp-cart__item-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-danger);
    font-size: 1rem;
    padding: 2px 4px;
    border-radius: 6px;
    flex-shrink: 0;
    transition: background-color 150ms ease;
}

.rp-cart__item-remove:hover { background: #fdecea; }

.rp-cart__total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1.5px solid var(--color-border);
    padding-top: var(--space-3);
    margin-bottom: var(--space-4);
    font-weight: 700;
    color: var(--color-dark);
}

.rp-cart__total-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--color-accent);
}

/* ── Bouton principal (réutilisable) ───────────────────────── */

.btn-cta {
    display: block;
    width: 100%;
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 0.85rem 1.5rem;
    font-weight: 700;
    font-size: 1rem;
    font-family: var(--font-body);
    cursor: pointer;
    text-align: center;
    transition: background-color 150ms ease, opacity 150ms ease;
}

.btn-cta:hover { background: var(--color-accent-hover); }

.btn-cta:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ── Panier mobile : bandeau fixe en bas ───────────────────── */

.rp-cart-mobile-bar {
    display: none;
}

@media (max-width: 899px) {
    .rp-cart {
        display: none; /* remplacé par le bandeau fixe */
    }

    .rp-cart-mobile-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-3);
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        background: #fff;
        border-top: 1px solid var(--color-border);
        box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
        padding: var(--space-3) var(--space-4);
    }

    .rp-cart-mobile-bar__info {
        font-size: 0.85rem;
        color: var(--color-muted);
    }

    .rp-cart-mobile-bar__total {
        font-weight: 800;
        color: var(--color-accent);
        font-size: 1.05rem;
        display: block;
    }

    .rp-cart-mobile-bar .btn-cta {
        width: auto;
        padding: 0.7rem 1.25rem;
    }

    /* Laisse la place au bandeau fixe pour ne rien cacher */
    #panel-reparation-panier {
        padding-bottom: 84px;
    }
}

/* Respect du mode "réduire les animations" */
@media (prefers-reduced-motion: reduce) {
    .rp-repair-card,
    .rp-product-card,
    .btn-cta,
    .rp-cart__item-remove {
        transition: none;
    }
}
