/* ================================================================
   Configurateur Gréements Courants v2 — Sparcraft
   ================================================================ */

/* Classe utilitaire : masquage par PHP (placeholder ###...###) */
.hide {
    display: none !important;
}

/* ── Wrapper principal ─────────────────────────────────────────── */
.sparcraft-gc-configurator {
    position: relative;
    max-width: 1150px;
    margin: 0 auto;
    padding: 1rem 0.75rem;
}

/* ── Section globale du devis ──────────────────────────────────── */
.gc-global-section {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

/* ── Titres des étapes ─────────────────────────────────────────── */
.gc-step-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid #005198;
    color: #1a1a2e;
}

/* ── Légendes des sous-étapes ──────────────────────────────────── */
.gc-legend {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    color: #495057;
}

/* ── Étapes / sous-étapes ──────────────────────────────────────── */
.gc-step {
    margin-bottom: 1.5rem;
}

.gc-substep {
    padding: 0.75rem 0;
    border-bottom: 1px solid #e9ecef;
}

.gc-substep:last-child {
    border-bottom: none;
}

/* ── Images produits ───────────────────────────────────────────── */
.gc-product-img {
    max-height: 80px;
    max-width: 160px;
    object-fit: contain;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 4px;
    background: #fff;
}

/* Images de synthèse */
.gc-synth-img {
    max-height: 120px;
    max-width: 180px;
    object-fit: contain;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 4px;
    background: #fff;
}

/* ── Synthèse des prix ─────────────────────────────────────────── */
.gc-synthese-prix {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 0.75rem 1rem;
}

.gc-synthese-prix table {
    margin-bottom: 0;
}

/* ── Devis résumé (liste des items ajoutés) ────────────────────── */
.gc-devis-resume {
    background: #fff;
    border: 1px solid #005198;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.gc-devis-title {
    color: #005198;
    margin-bottom: 0.75rem;
}

.gc-devis-item {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
}

.gc-item-unavailable {
    background: #fffbf0;
    border: 1px solid #ffc107;
}

.gc-unavailable-badge {
    display: block;
    font-size: 0.82rem;
    color: #856404;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 6px 10px;
}
.gc-unavailable-badge ul {
    font-size: 0.80rem;
    font-weight: 400;
}

/* ── Overlay de chargement ─────────────────────────────────────── */
#gc-form-submit-overlay {
    position: absolute;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.gc-overlay-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
    animation: gcOverlayIn 0.18s ease forwards;
    pointer-events: auto;
}

@keyframes gcOverlayIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0);    }
}

/* ── Progress ring ─────────────────────────────────────────────── */
.gc-progress-ring-wrap {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.gc-progress-ring {
    display: block;
    width: 80px;
    height: 80px;
    animation: gcRingSpin 1.1s linear infinite;
}

.gc-ring-track {
    fill: none;
    stroke: #e9ecef;
    stroke-width: 6;
}

/* Indeterminate : arc partiel tournant */
.gc-ring-fill {
    fill: none;
    stroke: #005198;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 140 61.062;
    stroke-dashoffset: 0;
}

@keyframes gcRingSpin {
    to { transform: rotate(360deg); }
}

/* Tracking mode (JS-driven) : animation CSS désactivée */
.gc-progress-tracking .gc-progress-ring {
    animation: none;
}

.gc-progress-tracking .gc-ring-fill {
    stroke-dasharray: 201.062;
    stroke-dashoffset: 201.062;
}

.gc-ring-percent {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    color: #005198;
    opacity: 0;
    transition: opacity 0.15s;
}

.gc-progress-tracking .gc-ring-percent {
    opacity: 1;
}

/* ── Boutons radio style Bootstrap (Btn-check) ─────────────────── */
#gc-categories .btn-check + label,
#gc-diametres .btn-check + label,
#gc-couleurs .btn-check + label {
    min-width: 80px;
    text-align: center;
}

/* ── Select2 client (init form) — aligné sur .form-select Bootstrap 5 ── */
#gc-init-form .select2-container {
    width: 100% !important;
}

#gc-init-form .select2-container--default .select2-selection--single {
    position: relative;
    height: calc(1.5em + .75rem + 2px);
    padding: .375rem .75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: .375rem;
    display: flex;
    align-items: center;
}

#gc-init-form .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 0;
    line-height: 1.5;
    color: #212529;
}

#gc-init-form .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #6c757d;
}

#gc-init-form .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
    top: 0;
    right: .5rem;
}

#gc-init-form .select2-container--default .select2-selection--single .select2-selection__clear {
    position: absolute;
    right: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    font-size: 1rem;
    line-height: 1;
    color: #6c757d;
}

/* ── Barre d'info devis (client + libellé) ─────────────────────── */
.gc-devis-info-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    background: #eaf2fb;
    border: 1px solid #9dc3e0;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.gc-info-label {
    color: #6c757d;
}

.gc-info-sep {
    color: #adb5bd;
}

/* ── Stepper de navigation ─────────────────────────────────────── */
.gc-stepper {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1.75rem;
}

.gc-stepper-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    text-align: center;
    min-width: 48px;
}

.gc-stepper-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 6px;
    transition: background 0.25s, color 0.25s;
    border: 2px solid #dee2e6;
}

.gc-stepper-label {
    font-size: 0.90rem;
    color: #6c757d;
    font-weight: 500;
    white-space: nowrap;
}

.gc-stepper-line {
    flex: 1;
    height: 2px;
    background: #dee2e6;
    margin-top: 17px;
    transition: background 0.25s;
}

.gc-stepper-item.active .gc-stepper-circle,
.gc-stepper-item.done .gc-stepper-circle {
    background: #005198;
    color: #fff;
    border-color: #005198;
}

.gc-stepper-item.active .gc-stepper-label,
.gc-stepper-item.done .gc-stepper-label {
    color: #005198;
    font-weight: 600;
}

.gc-stepper-line.done {
    background: #005198;
}

/* ── Transitions slide entre étapes ────────────────────────────── */
#gc-steps-wrapper {
    position: relative;
    overflow: hidden;
    padding: 4px 6px;
    margin: 0 -6px;
}

.gc-slide-in-right  { animation: gcSlideInRight  0.28s ease forwards; }
.gc-slide-in-left   { animation: gcSlideInLeft   0.28s ease forwards; }
.gc-slide-out-left  { animation: gcSlideOutLeft  0.28s ease forwards; }
.gc-slide-out-right { animation: gcSlideOutRight 0.28s ease forwards; }

@keyframes gcSlideInRight  { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes gcSlideInLeft   { from { transform: translateX(-100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes gcSlideOutLeft  { from { transform: translateX(0); opacity: 1; } to { transform: translateX(-100%); opacity: 0; } }
@keyframes gcSlideOutRight { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ── Panneau de prévisualisation (bloc sous le configurateur) ───── */
.gc-preview-panel {
    margin-top: 1.5rem;
}

.gc-preview-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.gc-preview-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #005198;
    border-bottom: 2px solid #005198;
    padding-bottom: 0.4rem;
    margin-bottom: 0.85rem;
}

/* Message vide */
.gc-prev-empty-msg {
    font-size: 0.85rem;
    color: #adb5bd;
    font-style: italic;
    text-align: center;
    padding: 0.5rem 0;
}

/* Ligne de détails texte (en haut) */
.gc-prev-details-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e9ecef;
}

.gc-prev-detail-item {
    display: none; /* affiché par JS */
}

.gc-prev-detail-item dt {
    display: inline;
    color: #6c757d;
    font-weight: 500;
    font-style: normal;
    font-size: 0.82rem;
}

.gc-prev-detail-item dd {
    display: inline;
    margin: 0 0 0 0.25rem;
    color: #212529;
    font-weight: 600;
    font-size: 0.82rem;
}

/* Prix (dans la ligne de détails) */
.gc-prev-prix-row {
    display: none;
    margin-left: auto;
    padding-left: 1rem;
    border-left: 2px solid #005198;
    font-size: 0.92rem;
    font-weight: 700;
    color: #005198;
    white-space: nowrap;
}

/* Rangée d'images (en bas, grandes) */
.gc-prev-images {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.gc-prev-img-slot {
    display: none; /* affiché par JS */
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.gc-prev-img {
    max-height: 110px;
    max-width: 140px;
    object-fit: contain;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 6px;
    background: #f8f9fa;
}

.gc-prev-img-label {
    font-size: 0.75rem;
    color: #6c757d;
    text-align: center;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 576px) {
    .gc-synth-img {
        max-height: 80px;
        max-width: 120px;
    }

    .gc-step-title {
        font-size: 1.2rem;
    }

    #gc-synthese-images {
        flex-wrap: wrap;
    }

    .gc-stepper-label {
        font-size: 0.55rem;
    }

    .gc-stepper-circle {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .gc-stepper-line {
        margin-top: 13px;
    }
}

/* ── Override couleur brand #005198 sur classes Bootstrap ─────── */
.sparcraft-gc-configurator .btn-primary {
    background-color: #005198;
    border-color: #005198;
}

.sparcraft-gc-configurator .btn-primary:hover,
.sparcraft-gc-configurator .btn-primary:focus,
.sparcraft-gc-configurator .btn-primary:active {
    background-color: #003f78;
    border-color: #003f78;
}

.sparcraft-gc-configurator .btn-primary:focus-visible {
    box-shadow: 0 0 0 0.25rem rgba(0, 81, 152, 0.35);
}

.sparcraft-gc-configurator .text-primary {
    color: #005198 !important;
}

.sparcraft-gc-configurator .border-primary {
    border-color: #005198 !important;
}

.sparcraft-gc-configurator .spinner-border.text-primary {
    color: #005198 !important;
}
