/**
 * JUP Shipping - Checkout styles
 */

.jup-shipping-fields {
    margin: 20px 0;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e1e1e1;
}

.jup-shipping-fields h4 {
    margin: 0 0 15px;
    padding: 0 0 10px;
    border-bottom: 1px solid #ddd;
    font-size: 16px;
    color: #333;
}

.jup-shipping-fields .form-row {
    margin-bottom: 15px;
}

.jup-shipping-fields label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.jup-shipping-fields label.checkbox {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
}

.jup-shipping-fields label.checkbox input {
    margin-right: 10px;
}

.jup-shipping-fields select {
    width: 100%;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.jup-shipping-fields .description {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

.jup-shipping-fields .optional {
    font-weight: normal;
    color: #999;
}

/* Installation option */
.jup-installation-cost {
    color: #333;
    font-weight: 600;
}

.jup-installation-free {
    color: #46b450;
    font-weight: 600;
}

/* Messages */
.jup-shipping-messages {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed #ddd;
}

.jup-shipping-messages .jup-message {
    margin: 5px 0;
    color: #666;
}

/* Warning/Notice boxes */
.jup-floor-warning,
.jup-quote-notice {
    margin-top: 15px;
}

.jup-floor-warning .woocommerce-info,
.jup-quote-notice .woocommerce-info {
    margin: 0;
    padding: 10px 15px;
    background: #f0f6fc;
    border-left: 4px solid #2196F3;
}

.jup-quote-notice .woocommerce-info {
    background: #fff8e1;
    border-left-color: #ff9800;
}

/* ==========================================================================
   Delivery choice (panier)
   ========================================================================== */

.jup-delivery-choice {
    margin-top: 0;
    position: relative;
}

.jup-delivery-option {
    border: 1px solid #AEAEAE !important;
    margin-bottom: 14px;
    cursor: pointer;
    transition: border-color 120ms ease;
}

.jup-delivery-option:hover {
    border-color: var(--color-black, #111);
}

.jup-delivery-option--active {
    border-color: var(--color-black, #111);
}

.jup-delivery-option__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
}

/* Custom radio dot */
.jup-delivery-option__radio {
    flex: none;
    width: 16px;
    height: 16px;
    border: 1px solid #AEAEAE;
    border-radius: 50%;
    position: relative;
    transition: border-color 120ms ease;
}

.jup-delivery-option--active .jup-delivery-option__radio {
    border-color: var(--color-black, #111);
}

.jup-delivery-option--active .jup-delivery-option__radio::after {
    content: "";
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-black, #111);
}

.jup-delivery-option__name {
    flex: 1;
    font-size: var(--text-xbase, 1.111rem);
    font-weight: 600;
    color: var(--color-black, #000);
}

.jup-delivery-option__price {
    font-family: var(--font-lateef, serif);
    font-size: var(--text-base, 1rem);
    font-weight: 600;
    color: var(--color-black, #000);
}

.jup-delivery-home-fields {
    padding: 0 16px 14px;
    border-top: 1px solid #eee;
}

.jup-delivery-home-fields .form-row {
    margin: 12px 0 0;
}

.jup-delivery-home-fields label {
    display: flex;
    align-items: center;
    gap: 0.6em;
    font-size: var(--text-base, 1rem);
    color: var(--color-black, #000);
    cursor: pointer;
    line-height: 1.4;
    margin-bottom: 4px;
}

.jup-delivery-home-fields .jup-postcode-input,
.jup-delivery-home-fields .jup-floor-select {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #AEAEAE;
    padding: 0.55em 0.9em;
    height: 2.6em;
    line-height: 1.4;
    font-size: var(--text-base, 1rem);
    font-family: inherit;
    color: var(--color-black, #000);
    outline: none;
    transition: border-color 120ms ease;
}

.jup-delivery-home-fields .jup-postcode-input:focus,
.jup-delivery-home-fields .jup-floor-select:focus {
    border-color: var(--color-black, #000);
}

.jup-delivery-home-fields .jup-floor-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.8em;
    background-color: #fff;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--color-black, #000) 50%),
        linear-gradient(135deg, var(--color-black, #000) 50%, transparent 50%);
    background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    cursor: pointer;
}

.jup-delivery-home-fields input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex: none;
    width: 1.1em;
    height: 1.1em;
    border: 1px solid #AEAEAE;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    position: relative;
    transition: border-color 120ms ease, background-color 120ms ease;
}

.jup-delivery-home-fields input[type="checkbox"]:checked {
    background-color: var(--color-red, #c0392b);
    border-color: var(--color-red, #c0392b);
}

.jup-delivery-home-fields input[type="checkbox"]:checked::after {
    content: "";
    display: block;
    position: absolute;
    left: 0.22em;
    top: 0.05em;
    width: 0.35em;
    height: 0.6em;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

.jup-delivery-home-fields .jup-install-price {
    color: var(--color-red, #cc1335);
    font-size: var(--text-sm, 0.778rem);
    white-space: nowrap;
}

/* Counter the global bdi { display:flex } rule that breaks inline price rendering */
.jup-install-price .woocommerce-Price-amount bdi,
.jup-installation-cost .woocommerce-Price-amount bdi,
.jup-installation-option__price .woocommerce-Price-amount bdi {
    display: inline;
    height: auto;
}

/* Loading overlay on delivery choice block */
.jup-delivery-choice--loading::after {
    content: "";
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.65);
    z-index: 10;
    border-radius: 2px;
}

.jup-delivery-choice--loading::before {
    content: "";
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 11;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border: 2px solid rgba(0, 0, 0, 0.12);
    border-top-color: var(--color-black, #111);
    border-radius: 50%;
    animation: jup-spin 0.6s linear infinite;
}

@keyframes jup-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Hide checkout button when cart is in "sur devis" or "unavailable" state (CSS-only, before JS runs) */
body:has(#jup-delivery-choice[data-jup-quote="1"]) .woocommerce-cart-form_updates .checkout-button:not(#jup-quote-cta),
body:has(#jup-delivery-choice[data-jup-quote="1"]) .woocommerce-cart-form_updates .eltd-btn:not(#jup-quote-cta),
body:not(.jup-pickup-active):has(#jup-delivery-choice[data-jup-unavailable="1"]) .woocommerce-cart-form_updates .checkout-button,
body:not(.jup-pickup-active):has(#jup-delivery-choice[data-jup-unavailable="1"]) .woocommerce-cart-form_updates .eltd-btn {
    display: none !important;
}

/* Unavailable delivery notice */
.jup-unavailable {
    color: var(--color-red, #c0392b);
    font-weight: 600;
}

.jup-unavailable-notice {
    margin: 12px 0 4px;
    padding: 12px 16px;
    background: #fff5f5;
    border-left: 4px solid var(--color-red, #c0392b);
    font-size: var(--text-sm, 0.85rem);
    line-height: 1.5;
}

.jup-unavailable-notice p {
    margin: 0;
    color: var(--color-black, #111);
}

/* Installation included notice */
.jup-installation-included-notice {
    margin: 12px 0 0;
    padding: 10px 14px;
    background: #f0f6e8;
    border-left: 4px solid #46b450;
    font-size: var(--text-sm, 0.85rem);
    line-height: 1.5;
}

.jup-installation-included-notice p {
    margin: 0;
    color: var(--color-black, #111);
}

/* Door delivery subtitle (below header, above fields) */
.jup-door-delivery-subtitle {
    margin: 0;
    padding: 12px 16px 0;
    font-size: var(--text-sm, 0.85rem);
    color: #666;
    line-height: 1.5;
}

/* Prominent variant: larger text for zone-independent products (e.g. accessories) */
.jup-door-delivery-subtitle--prominent {
    font-size: var(--text-base, 1rem);
    color: var(--color-black, #333);
    padding-bottom: 10px;
}

/* Hide postcode + grey line when rate is the same for all of France */
.jup-delivery-home-fields--no-postcode {
    display: none;
}

/* ==========================================================================
   Installation section (separate block below delivery)
   ========================================================================== */

.jup-installation-section {
    margin-top: 14px;
}

.jup-section-title {
    color: var(--color-red, #c0392b);
    font-size: var(--text-xbase, 1.111rem);
    font-weight: 600;
    margin: 0 0 10px;
    padding: 0;
}

.jup-installation-option {
    border: 1px solid #AEAEAE;
    background: #ffffff;
}

.jup-installation-option__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
}

.jup-installation-option__label {
    display: flex;
    align-items: center;
    gap: 0.6em;
    flex: 1;
    font-size: var(--text-xbase, 1.111rem);
    font-weight: 600;
    color: var(--color-black, #000);
    cursor: pointer;
    margin: 0;
}

.jup-installation-option__name {
    flex: 1;
    font-size: var(--text-xbase, 1.111rem);
    font-weight: 600;
    color: var(--color-black, #000);
}

.jup-installation-option__price {
    font-family: var(--font-lateef, serif);
    font-size: var(--text-base, 1rem);
    font-weight: 600;
    color: var(--color-black, #000);
    white-space: nowrap;
}

.jup-installation-option__price.jup-free,
.jup-installation-option__price .jup-free {
    font-size: 24px;
}

/* Checkbox inside installation option */
.jup-installation-option input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex: none;
    width: 1.1em;
    height: 1.1em;
    border: 1px solid #AEAEAE;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    position: relative;
    transition: border-color 120ms ease, background-color 120ms ease;
}

.jup-installation-option input[type="checkbox"]:checked {
    background-color: var(--color-red, #c0392b);
    border-color: var(--color-red, #c0392b);
}

.jup-installation-option input[type="checkbox"]:checked::after {
    content: "";
    display: block;
    position: absolute;
    left: 0.22em;
    top: 0.05em;
    width: 0.35em;
    height: 0.6em;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

/* Checkout button blocked state — JS handles actual navigation blocking */
.jup-checkout-blocked {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
}

#jup-checkout-required-notice {
    text-align: center;
    font-size: var(--text-sm, 0.8rem);
    color: var(--color-red, #c0392b);
    margin: 0 0 10px;
    padding: 8px 12px;
    background: #fff5f5;
    border: 1px solid #fcd4d4;
}

/* Shake animation for missing fields on checkout attempt */
@keyframes jup-shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-5px); }
    40%       { transform: translateX(5px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(3px); }
}

@keyframes jup-notice-flash {
    0%, 100% { background: #fff5f5; }
    50%       { background: #fcd4d4; }
}

.jup-field-shake {
    animation: jup-shake 0.45s ease;
}

.jup-field-shake input,
.jup-field-shake.jup-postcode-input {
    border-color: var(--color-red, #c0392b) !important;
    box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.18);
    transition: none;
}

.jup-notice-flash {
    animation: jup-notice-flash 0.3s ease 2;
}

/* Cart shipping fields (legacy, kept for compatibility) */
.jup-shipping-fields-cart {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #AEAEAE;
}

.jup-shipping-fields-cart .form-row {
    margin-bottom: 10px;
}

.jup-shipping-fields-cart label {
    display: flex;
    align-items: center;
    gap: 0.6em;
    font-size: 14px;
    color: var(--color-black, #111);
    cursor: pointer;
    line-height: 1.4;
}

/* Elevator radio buttons */
.jup-elevator-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.jup-elevator-label {
    font-size: var(--text-base, 1rem);
    color: var(--color-black, #000);
    margin-bottom: 0 !important;
    cursor: default !important;
}

.jup-elevator-label .required {
    color: var(--color-red, #c0392b);
}

.jup-elevator-radios {
    display: flex;
    gap: 20px;
}

.jup-radio-label {
    display: flex;
    align-items: center;
    gap: 0.5em;
    cursor: pointer;
    font-size: var(--text-base, 1rem);
    margin-bottom: 0 !important;
}

.jup-radio-label input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    flex: none;
    width: 1.1em;
    height: 1.1em;
    border: 1px solid #AEAEAE;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    position: relative;
    transition: border-color 120ms ease;
	margin-bottom: 8px !important;
}


.jup-radio-label input[type="radio"]:checked {
    border-color: var(--color-red, #c0392b);
    border-width: 4px;
    background-color: var(--color-red, #c0392b);
    box-shadow: inset 0 0 0 3px #fff;
}

/* Postcode input */
.jup-shipping-fields-cart .jup-postcode-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #AEAEAE;
    padding: 0.55em 0.9em;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 120ms ease;
}

.jup-shipping-fields-cart .jup-postcode-input:focus {
    border-color: var(--color-black, #111);
}

/* Floor select – custom arrow matching theme */
.jup-shipping-fields-cart .jup-floor-select {
    display: block;
    width: 100%;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #AEAEAE;
    padding: 0.55em 2.8em 0.55em 0.9em;
    font-size: 14px;
    font-family: inherit;
    color: var(--color-black, #111);
    background-color: #fff;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--color-black, #111) 50%),
        linear-gradient(135deg, var(--color-black, #111) 50%, transparent 50%);
    background-position:
        calc(100% - 14px) 50%,
        calc(100% - 9px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    cursor: pointer;
    outline: none;
    transition: border-color 120ms ease;
}

.jup-shipping-fields-cart .jup-floor-select:focus {
    border-color: var(--color-black, #111);
}

/* Checkbox – custom styled like theme radio buttons */
.jup-shipping-fields-cart input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex: none;
    width: 1.1em;
    height: 1.1em;
    border: 1px solid #AEAEAE;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    position: relative;
    transition: border-color 120ms ease, background-color 120ms ease;
}

.jup-shipping-fields-cart input[type="checkbox"]:checked {
    background-color: var(--color-red, #c0392b);
    border-color: var(--color-red, #c0392b);
}

.jup-shipping-fields-cart input[type="checkbox"]:checked::after {
    content: "";
    display: block;
    position: absolute;
    left: 0.22em;
    top: 0.05em;
    width: 0.35em;
    height: 0.6em;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

#billing_elevator_field .woocommerce-input-wrapper,
#shipping_elevator_field .woocommerce-input-wrapper {
    display: flex;
    gap: 10px;
}

/* Installation price badge */
.jup-shipping-fields-cart .jup-install-price {
    color: var(--color-red, #c0392b);
    font-size: 13px;
}

/* Checkout hors France métropolitaine */
.jup-devis-checkout {
    padding: 24px 0;
    text-align: center;
}

.jup-devis-checkout__message {
    margin-bottom: 20px;
    font-size: 15px;
    color: var(--color-black, #111);
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    .jup-shipping-fields {
        padding: 15px;
    }

    .jup-shipping-fields select {
        max-width: 100%;
    }
}

.jup-delivery-option__price .woocommerce-Price-amount bdi {
    font-size: 24px;
    font-weight: 400;
}

.woocommerce-Price-amount bdi {
    height: 27px;
    display: flex;
}