#md-trigger-calculator {
    font-family: 'Raleway', sans-serif;
    font-weight: 700;
    font-size: 0.8em;
    text-transform: uppercase;
    background-color: #00223F;
    color: #ffffff;
    border: none;
    border-radius: 50px;
    padding: 0.5vw 1.3vw;
    width: 45%;
    min-width: 250px;
    cursor: pointer;
    display: block !important;
    margin-bottom: 20px;
    transition: background-color 0.2s ease-in-out;
}

#md-trigger-calculator:hover {
    background-color: #001527;
}

#md-calc-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    font-family: 'Raleway', sans-serif;
}

#md-calc-modal .md-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 650px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

#md-calc-close {
    position: absolute;
    right: 20px;
    top: 20px;
    cursor: pointer;
    color: #7A7A7A;
    transition: color 0.2s;
}

#md-calc-close:hover {
    color: #00223F;
}

#md-calc-modal .title-popup {
    color: #00223F;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #00223F;
    padding-bottom: 10px;
    font-weight: 700;
    font-size: 1.75rem;
    font-family: inherit;
    line-height: 1.2;
    margin-block-end: 1rem;
    margin-block-start: .5rem;
}

#md-calc-modal .title-openings-popup {
    margin: 0 0 10px 0;
    color: #00223F;
    font-weight: 600;
    font-size: 1.5rem;
    font-family: inherit;
    line-height: 1.2;
    margin-block-end: 1rem;
    margin-block-start: .5rem;
}

.md-wall-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    background: #F1F3F5;
    padding: 10px;
    border-radius: 6px;
    align-items: flex-end;
}

.md-wall-row label {
    font-size: 12px;
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
}

.md-wall-row input, 
.md-opening-row input {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: 'Raleway', sans-serif;
}

.md-opening-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: flex-end;
}

#md-add-wall {
    background: none;
    border: 1px dashed #00223F;
    color: #00223F;
    padding: 8px 15px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    margin-bottom: 20px;
    font-family: 'Raleway', sans-serif;
}

#md-add-opening {
    background: #ffffff;
    border: 1px solid #c7c7c7;
    color: #333;
    padding: 5px 10px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 13px;
    font-family: 'Raleway', sans-serif;
}

.md-remove-row {
    background: #C32E00;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 50px;
    cursor: pointer;
}

.md-opening-row .md-remove-row {
    background: #7A7A7A;
    padding: 5px 8px;
}

#md-btn-execute-calc {
    background-color: #C32E00;
    color: white;
    border: none;
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 50px;
    margin-top: 25px;
    cursor: pointer;
    font-family: 'Raleway', sans-serif;
    text-transform: uppercase;
}

#md-calc-results {
    display: none;
    margin-top: 25px;
    padding: 20px;
    border-top: 2px dashed #00223F;
    background: #FFFDFB;
}

#md-calc-results p {
    margin: 8px 0;
}

#md-btn-apply-to-cart {
    background-color: #00223F;
    color: white;
    border: none;
    width: 100%;
    padding: 12px;
    font-weight: bold;
    border-radius: 50px;
    margin-top: 15px;
    cursor: pointer;
    font-family: 'Raleway', sans-serif;
}

#md-global-loader {
    display: none;
    position: fixed;
    z-index: 999999;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 34, 63, 0.8);
    backdrop-filter: blur(3px);
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: #ffffff;
    font-family: 'Raleway', sans-serif;
}

.md-global-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: mdGlobalSpinner 1s linear infinite;
    margin-bottom: 15px;
}

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

.md-field-row {
    margin-bottom: 15px;
}

#md-nomenclature-results {
    display: none;
    margin-top: 25px;
    padding: 20px;
    border-top: 2px dashed #00223F;
    background: #FFFDFB;
}

.md-nomenclature-list {
    margin: 10px 0;
}

.md-nomenclature-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #E9ECEF;
    font-size: 14px;
}

.md-nomenclature-row-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    background: #F1F3F5;
}

.md-nomenclature-row-name {
    flex: 2;
    font-weight: 600;
    color: #00223F;
}

.md-nomenclature-row-qty {
    flex: 1;
    text-align: right;
    color: #C32E00;
    font-weight: 600;
}

.md-nomenclature-row-price {
    flex: 1;
    text-align: right;
}

#md-btn-apply-bundle {
    background-color: #00223F;
    color: white;
    border: none;
    width: 100%;
    padding: 12px;
    font-weight: bold;
    border-radius: 50px;
    margin-top: 15px;
    cursor: pointer;
    font-family: 'Raleway', sans-serif;
}

.md-nomenclature-error {
    display: none;
    color: #C32E00;
    font-weight: 600;
    margin-top: 10px;
}

/* --- [formulaire_calculateur_ite] : formulaire en 2 étapes (includes/product-form.php) --- */

#md-ite-product-form {
    font-family: 'Raleway', sans-serif;
    max-width: 750px;
    margin: 0 auto;
    position: relative;
}

#md-ite-product-form .md-pf-title {
    color: #00223F;
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1.2;
    margin: 0 0 20px 0;
}

#md-ite-product-form .title-openings-popup {
    margin: 0 0 10px 0;
    color: #00223F;
    font-weight: 600;
    font-size: 1.25rem;
    line-height: 1.2;
}

.md-pf-search {
    position: relative;
}

#md-pf-search-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid #00223F;
    border-radius: 6px;
    font-family: 'Raleway', sans-serif;
    box-sizing: border-box;
}

.md-pf-results {
    display: none;
    position: absolute;
    z-index: 100;
    left: 0;
    right: 0;
    top: 100%;
    margin: 4px 0 0 0;
    padding: 0;
    list-style: none;
    background: #ffffff;
    border: 1px solid #E9ECEF;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    max-height: 420px;
    overflow-y: auto;
}

.md-pf-results.is-open {
    display: block;
}

.md-pf-result,
.md-pf-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
}

.md-pf-result {
    margin: 0;
    border-bottom: 1px solid #E9ECEF;
    cursor: pointer;
}

.md-pf-result:last-child {
    border-bottom: none;
}

.md-pf-result:hover,
.md-pf-result.is-active {
    background: #F1F3F5;
}

.md-pf-result-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    background: #F1F3F5;
}

.md-pf-result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 8px;
}

.md-pf-result-name {
    font-weight: 600;
    color: #00223F;
}

.md-pf-result-sku {
    font-size: 12px;
    color: #7A7A7A;
}

.md-pf-result-price {
    margin-left: auto;
    font-weight: 700;
    color: #00223F;
    white-space: nowrap;
    text-align: right;
}

.md-pf-result-price del {
    font-weight: 400;
    color: #7A7A7A;
    margin-right: 4px;
}

.md-pf-status {
    font-size: 14px;
    color: #7A7A7A;
    margin: 8px 0 0 0;
    min-height: 1em;
}

.md-pf-selected {
    background: #F8F9FA;
    border: 1px solid #E9ECEF;
    border-radius: 6px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

#md-pf-change {
    background: none;
    border: 1px solid #00223F;
    color: #00223F;
    padding: 6px 12px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 13px;
    font-family: 'Raleway', sans-serif;
}

@media (max-width: 600px) {
    .md-pf-result-img {
        width: 40px;
        height: 40px;
    }

    #md-ite-product-form .md-wall-row,
    #md-ite-product-form .md-nomenclature-row {
        flex-wrap: wrap;
    }
}


/* Stepper (toujours visible) : is-current / is-complete / is-upcoming, piloté par setStep() dans product-form.js */

.md-pf-stepper {
    display: flex;
    align-items: center;
    gap: 12px;
    list-style: none;
    margin: 0 0 30px 0;
    padding: 0 0 20px 0;
    border-bottom: 2px solid #00223F;
}

.md-pf-stepper-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: #00223F;
    font-weight: 700;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.md-pf-stepper-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #C32E00;
    background: #C32E00;
    color: #ffffff;
    font-size: 16px;
    flex-shrink: 0;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.md-pf-stepper-check {
    display: none;
}

.md-pf-stepper-item.is-current .md-pf-stepper-num {
    box-shadow: 0 0 0 4px rgba(195, 46, 0, 0.15);
}

.md-pf-stepper-item.is-upcoming {
    opacity: 0.45;
}

.md-pf-stepper-item.is-upcoming .md-pf-stepper-num {
    background: #ffffff;
    border-color: #7A7A7A;
    color: #7A7A7A;
}

.md-pf-stepper-item.is-upcoming .md-pf-stepper-label {
    color: #7A7A7A;
}

.md-pf-stepper-item.is-complete {
    cursor: pointer;
}

.md-pf-stepper-item.is-complete .md-pf-stepper-num {
    background: #00223F;
    border-color: #00223F;
}

.md-pf-stepper-item.is-complete .md-pf-stepper-digit {
    display: none;
}

.md-pf-stepper-item.is-complete .md-pf-stepper-check {
    display: block;
}

.md-pf-stepper-item.is-complete:hover .md-pf-stepper-label {
    text-decoration: underline;
}

.md-pf-stepper-sep {
    flex: 1;
    height: 2px;
    margin: 0;
    background: #DEE2E6;
    transition: background-color 0.2s ease;
}

.md-pf-stepper-sep.is-complete {
    background: #00223F;
}

/* Carrousel produits (étape 1) */

.md-pf-carousel {
    margin-top: 30px;
}

.md-pf-carousel-title {
    color: #00223F;
    font-weight: 600;
    font-size: 1.1rem;
    margin: 0 0 12px 0;
}

.md-pf-carousel-frame {
    position: relative;
}

.md-pf-carousel-track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 4px 2px 12px 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.md-pf-carousel-track::-webkit-scrollbar {
    display: none;
}

.md-pf-carousel-track.is-dragging {
    cursor: grabbing;
}

.md-pf-carousel-track.is-dragging .md-pf-card {
    pointer-events: none;
}

.md-pf-card {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #E9ECEF;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.md-pf-card:hover {
    box-shadow: 0 6px 18px rgba(0, 34, 63, 0.12);
    transform: translateY(-2px);
}

.md-pf-card-img-wrap {
    aspect-ratio: 1 / 1;
    margin-bottom: 6px;
    border-radius: 6px;
    overflow: hidden;
    background: #F1F3F5;
}

.md-pf-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    -webkit-user-drag: none;
}

.md-pf-card-name {
    font-weight: 600;
    color: #00223F;
    font-size: 14px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

.md-pf-card-sku {
    font-size: 12px;
    color: #7A7A7A;
}

.md-pf-card-price {
    font-weight: 700;
    color: #00223F;
    margin-top: auto;
    padding-top: 4px;
}

.md-pf-card-price del {
    font-weight: 400;
    color: #7A7A7A;
    margin-right: 4px;
}

.md-pf-card-btn {
    margin-top: 8px;
    width: 100%;
    background-color: #C32E00;
    color: #ffffff;
    border: none;
    border-radius: 50px;
    padding: 9px 10px;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Raleway', sans-serif;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.md-pf-card-btn:hover {
    background-color: #A02500;
}

.md-pf-card-btn.is-loading {
    opacity: 0.6;
    cursor: wait;
}

.md-pf-carousel-arrow {
    position: absolute;
    top: 40%;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #00223F;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transform: translateY(-50%);
    transition: background-color 0.2s ease;
}

.md-pf-carousel-arrow:hover {
    background: #001527;
}

.md-pf-carousel-prev {
    left: -14px;
}

.md-pf-carousel-next {
    right: -14px;
}

.md-pf-carousel.is-static .md-pf-carousel-arrow {
    display: none;
}

@media (max-width: 600px) {
    .md-pf-stepper-label {
        font-size: 13px;
    }

    .md-pf-card {
        flex-basis: 160px;
    }

    .md-pf-carousel-prev {
        left: -6px;
    }

    .md-pf-carousel-next {
        right: -6px;
    }
}

/* Loader sur tout le formulaire pendant le chargement du produit choisi (selectProduct() dans product-form.js) */

.md-pf-loading {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 10;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
    border-radius: 8px;
    color: #00223F;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: wait;
}

.md-pf-loading.is-active {
    display: flex;
}

.md-pf-loading .md-global-spinner {
    border-color: rgba(0, 34, 63, 0.2);
    border-top-color: #00223F;
}

.md-pf-loading p {
    margin: 0;
}


/* Choix du mode de saisie : largeur × hauteur ou surface globale ([formulaire_calculateur_ite]) */

.md-surface-mode-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.md-surface-mode-btn {
    flex: 1;
    min-width: 160px;
    background: #ffffff;
    border: 1px solid #00223F;
    color: #00223F;
    padding: 8px 15px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    font-family: 'Raleway', sans-serif;
}

.md-surface-mode-btn.is-active {
    background: #00223F;
    color: #ffffff;
}

.md-surface-mode-btn:hover,
.md-surface-mode-btn:focus,
.md-surface-mode-btn:focus-visible {
    outline: 2px solid #00223F;
    outline-offset: 2px;
    border-color: #00223F;
    box-shadow: none;
    background: #ffffff;
    color: #00223F;
}

.md-surface-mode-btn.is-active:hover,
.md-surface-mode-btn:focus,
.md-surface-mode-btn:focus-visible {
    background: #00223F;
    color: #ffffff;
}

#md-field-surface {
    margin-bottom: 20px;
    background: #F1F3F5;
    padding: 10px;
    border-radius: 6px;
}

/* Variation picker (round image swatches) on nomenclature lines whose product is variable.
   Geometry is !important: theme button rules (Elementor's pink [type=button] border/padding, product-page
   button widths) otherwise turn the circles into wide rectangles. */

.md-nomenclature-variations {
    display: block;
    margin-top: 6px;
}

.md-variation-swatches {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
}

.md-variation-swatches .md-variation-swatch,
.md-variation-swatches .md-variation-swatch:hover,
.md-variation-swatches .md-variation-swatch:focus {
    display: block !important;
    flex: 0 0 auto !important;
    width: 36px !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 36px !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 2px solid #ffffff !important;
    border-radius: 50px !important;
    box-shadow: 0 0 0 1px #ccc;
    background: #F1F3F5 !important;
    color: #00223F !important;
    line-height: 1 !important;
    overflow: hidden;
    cursor: pointer;
}

.md-variation-swatches .md-variation-swatch img {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    margin: 0 !important;
    object-fit: cover;
    border-radius: 50px !important;
}

.md-variation-swatches .md-variation-swatch:hover,
.md-variation-swatches .md-variation-swatch:focus-visible {
    box-shadow: 0 0 0 2px #00223F;
    outline: none;
}

.md-variation-swatches .md-variation-swatch.is-selected,
.md-variation-swatches .md-variation-swatch.is-selected:hover,
.md-variation-swatches .md-variation-swatch.is-selected:focus {
    box-shadow: 0 0 0 3px #00223F;
}

/* No variation image: pill with the variation label instead */
.md-variation-swatches .md-variation-swatch.has-no-image,
.md-variation-swatches .md-variation-swatch.has-no-image:hover,
.md-variation-swatches .md-variation-swatch.has-no-image:focus {
    width: auto !important;
    padding: 0 12px !important;
    font-size: 12px !important;
    font-weight: 600;
}

.md-variation-selected-label {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    font-weight: normal;
    color: #00223F;
}

.md-nomenclature-variations.is-missing .md-variation-selected-label {
    color: #C32E00;
    font-weight: 600;
}

#md-btn-apply-bundle:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#md-calc-variations {
    margin: 10px 0;
}

#md-btn-apply-to-cart:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
