/**
 * J&T Pouch Shipping - Frontend Checkout & Cart Shipping Method UI Styles
 * Refined, full-width modern boxed cards aligned with Loela's warm minimalist luxury theme.
 */

/* Shipping Table Row - Reduce excess top and bottom space */
tr.woocommerce-shipping-totals.shipping.jtps-shipping-row {
    border-top: 1px solid #f0eee8 !important;
    border-bottom: 1px solid #f0eee8 !important;
}

tr.woocommerce-shipping-totals.shipping.jtps-shipping-row > td.jtps-shipping-full-cell,
td.shipping__inner.jtps-shipping-full-cell {
    width: 100% !important;
    max-width: 100% !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border: none !important;
}

/* Shipment Section Title - Flush left and larger (matching table headers) */
.jtps-shipping-header-row {
    margin: 2px 0 8px 0 !important;
    text-align: left !important;
    width: 100% !important;
    display: block !important;
}

.jtps-package-title {
    display: block !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #414138 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    line-height: 1.3 !important;
    text-align: left !important;
}

/* Shipping Cards List - Full width, clean gaps */
ul.jtps-shipping-list,
ul.shipping__list.jtps-shipping-list {
    list-style: none !important;
    margin: 4px 0 0 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
    text-align: left !important;
}

/* Shipping Card Box */
li.jtps-shipping-card,
ul.jtps-shipping-list li.shipping__list_item.jtps-shipping-card {
    position: relative !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    border: 1.5px solid #e7e5df !important;
    border-radius: 9px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    display: block !important;
    min-height: auto !important;
}

li.jtps-shipping-card:hover {
    border-color: #949085 !important;
    background: #fdfcf9 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
}

li.jtps-shipping-card.jtps-selected {
    border-color: #23221e !important;
    background: #faf8f3 !important;
    box-shadow: 0 2px 7px rgba(35, 34, 30, 0.06) !important;
}

/* Card Label (Clickable area) */
.jtps-shipping-label,
label.shipping__list_label.jtps-shipping-label {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 14px 16px !important;
    margin: 0 !important;
    width: 100% !important;
    cursor: pointer !important;
    text-align: left !important;
    font-weight: normal !important;
    opacity: 1 !important;
    gap: 12px !important;
    box-sizing: border-box !important;
}

/* Left Section: Radio + Details */
.jtps-card-left {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    margin: 0 !important;
}

/* Radio Button Wrapper & Custom Indicator */
.jtps-radio-wrapper {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    width: 22px !important;
    height: 22px !important;
    margin: 0 !important;
}

/* Native input hidden visually but accessible */
.jtps-radio-wrapper input[type="radio"].jtps-radio-input {
    position: absolute !important;
    opacity: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    cursor: pointer !important;
    z-index: 2 !important;
}

/* Custom Circle Button */
.jtps-radio-circle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    border: 2px solid #b8b5ac !important;
    background-color: #ffffff !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
}

/* Inner Dot */
.jtps-radio-dot {
    display: block !important;
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    background-color: #ffffff !important;
    transform: scale(0) !important;
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

/* Checked Radio State */
.jtps-shipping-card.jtps-selected .jtps-radio-circle,
.jtps-radio-wrapper input[type="radio"]:checked + .jtps-radio-circle {
    border-color: #23221e !important;
    background-color: #23221e !important;
}

.jtps-shipping-card.jtps-selected .jtps-radio-dot,
.jtps-radio-wrapper input[type="radio"]:checked + .jtps-radio-circle .jtps-radio-dot {
    transform: scale(1) !important;
}

/* Hover state on circle */
.jtps-shipping-card:hover .jtps-radio-circle {
    border-color: #5a574f !important;
}

/* Info Block - Title & Description Stack */
.jtps-info-block {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: flex-start !important;
    text-align: left !important;
    gap: 3px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    margin: 0 !important;
}

/* Shipping Method Title - Extra weight */
.jtps-method-title {
    font-size: 15px !important;
    font-weight: 750 !important;
    color: #1a1916 !important;
    line-height: 1.3 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    word-break: break-word !important;
    text-align: left !important;
}

.jtps-shipping-card.jtps-selected .jtps-method-title {
    color: #0a0909 !important;
    font-weight: 800 !important;
}

/* Shipping Method Description - Lighter / Muted & Left-aligned */
.jtps-method-description {
    font-size: 12.5px !important;
    font-weight: 400 !important;
    color: #6e6b62 !important;
    line-height: 1.35 !important;
    word-break: break-word !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    text-align: left !important;
    display: block !important;
    width: 100% !important;
}

/* Estimate Badge Pill */
.jtps-estimate-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 2px 7.5px !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    line-height: 1.25 !important;
    color: #4b4840 !important;
    background-color: #eae7df !important;
    border: 1px solid #ddd9ce !important;
    border-radius: 999px !important;
    white-space: nowrap !important;
    margin-top: 3px !important;
    text-align: left !important;
}

.jtps-estimate-icon {
    flex-shrink: 0 !important;
    color: #635f55 !important;
}

/* Right Section: Price - Extra bold & easy to see */
.jtps-card-right {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    flex-shrink: 0 !important;
    margin-left: 10px !important;
}

.jtps-price-text,
.jtps-price-text .woocommerce-Price-amount {
    font-size: 16px !important;
    font-weight: 800 !important;
    color: #0a0909 !important;
    letter-spacing: -0.01em !important;
    white-space: nowrap !important;
}

.jtps-free-tag {
    display: inline-block !important;
    padding: 2px 7px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #285430 !important;
    background-color: #e5f2e8 !important;
    border-radius: 4px !important;
}

/* Mobile Responsive Optimizations */
@media (max-width: 768px) {
    tr.woocommerce-shipping-totals.shipping.jtps-shipping-row > td.jtps-shipping-full-cell {
        padding-top: 8px !important;
        padding-bottom: 8px !important;
    }

    .jtps-package-title {
        font-size: 14px !important;
    }

    .jtps-shipping-label,
    label.shipping__list_label.jtps-shipping-label {
        padding: 12px 14px !important;
        margin: 0 !important;
        gap: 10px !important;
        align-items: center !important;
    }

    .jtps-card-left {
        align-items: center !important;
        margin: 0 !important;
    }

    .jtps-method-title {
        font-size: 14px !important;
        font-weight: 750 !important;
    }

    .jtps-method-description {
        font-size: 12px !important;
        text-align: left !important;
    }

    .jtps-price-text,
    .jtps-price-text .woocommerce-Price-amount {
        font-size: 15px !important;
        font-weight: 800 !important;
        color: #0a0909 !important;
    }

    .jtps-radio-wrapper {
        width: 20px !important;
        height: 20px !important;
        margin: 0 !important;
    }

    .jtps-radio-circle {
        width: 19px !important;
        height: 19px !important;
    }
}

@media (max-width: 480px) {
    .jtps-shipping-label,
    label.shipping__list_label.jtps-shipping-label {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 12px !important;
        gap: 6px !important;
    }

    .jtps-card-left {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
    }

    .jtps-card-right {
        width: 100% !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin-top: 4px !important;
        padding-top: 6px !important;
        border-top: 1px dashed #e8e6df !important;
    }

    .jtps-method-breakdown-badge {
        font-size: 11px !important;
        padding: 2px 6px !important;
    }

    .jtps-price-text,
    .jtps-price-text .woocommerce-Price-amount {
        font-size: 16px !important;
    }
}

/* ==========================================================================
   Payment Methods Selection - Keep visible & selected (even when single gateway)
   ========================================================================== */
.woocommerce-checkout #payment ul.payment_methods {
    text-align: left !important;
    margin-bottom: 1em !important;
}

.woocommerce-checkout #payment ul.payment_methods li.wc_payment_method {
    text-align: left !important;
    margin-bottom: 10px !important;
}

.woocommerce-checkout #payment ul.payment_methods li input[type="radio"],
.woocommerce-checkout #payment ul.payment_methods li input[name="payment_method"] {
    display: inline-block !important;
    opacity: 1 !important;
    visibility: visible !important;
    cursor: pointer !important;
    vertical-align: middle !important;
    margin: 0 8px 0 0 !important;
    width: 18px !important;
    height: 18px !important;
    accent-color: #23221e !important;
}

.woocommerce-checkout #payment ul.payment_methods li label {
    display: inline !important;
    cursor: pointer !important;
    vertical-align: middle !important;
    font-weight: 600 !important;
    color: #1a1916 !important;
    font-size: 14px !important;
}

.woocommerce-checkout #payment div.payment_box {
    margin-top: 8px !important;
}

