:root {
    --brand: #1b3c53;
    --brand-dark: #213c51;
    --brand-soft: rgba(27, 60, 83, 0.08);
    --ink: #111827;
    --muted: #6b7280;
    --bg: #f8fafc; /* softer off-white for better contrast */
    --card: #ffffff; /* keep card white for now to preserve card contrast */
    --radius: 14px;

    /* Font family */
}

/* body {
    background: var(--bg);
} */
.rc-checkout-page {
    min-height: 60vh;
    font-family: var(--font-primary);
}

/* =========================
   PRESERVE ICON FONTS
   ========================= */

/* Font Awesome icons */
.fa,
.fas,
.far,
.fab,
.fal,
.fad,
.fass,
.fasr,
[class*="fa-"],
[class^="fa-"],
i[class*="fa"],
i[class^="fa"] {
    font-family:
        "Font Awesome 6 Free", "Font Awesome 5 Free", "Fontawesome",
        var(--fa-style-family, "Font Awesome 6 Free") !important;
}

/* Boxicons */
.bx,
[class*="bx-"],
[class^="bx"],
i[class*="bx"],
i[class^="bx"] {
    font-family: boxicons !important;
}

/* Feather icons */
.feather,
[class*="feather-"],
[class^="feather"],
i[class*="feather"],
i[class^="feather"] {
    font-family: "Feather" !important;
}
/* alerts */
.rc-alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
}
.rc-alert--success {
    background: #e6f8ee;
    color: #166534;
}
.rc-alert--danger {
    background: #fde8e8;
    color: #991b1b;
}
.rc-alert--warning {
    background: #fff7ed;
    color: #92400e;
}

/* Clickable alert - styled like a button */
.clickable-alert {
    transition: all 0.3s ease;
    border: 2px dashed #fbbf24;
}
.clickable-alert:hover {
    background: #fef3c7 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #f59e0b;
}
.clickable-alert i {
    font-size: 32px;
    color: #f59e0b;
}

/* card */
.rc-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
    margin-bottom: 16px;
}
.rc-card h5 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
}

/* Card header layout and 'Ganti' link button */
.rc-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.rc-card__header .btn-link {
    color: var(--brand);
    background: transparent;
    border: none;
    padding: 6px 8px;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    border-radius: 8px;
}

.rc-card__header .btn-link:hover,
.rc-card__header .btn-link:focus {
    color: var(--brand-dark);
    text-decoration: none;
    background: var(--brand-soft);
}

/* address */
.rc-address__top {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Badge styling untuk checkout - override Bootstrap default */
.rc-address__top > .badge {
    flex: 0 0 auto;
    background: var(--brand-soft) !important;
    color: var(--brand-dark) !important;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    border-radius: 999px;
    padding: 4px 10px;
    display: inline-flex;
    align-items: center;
    border: none !important;
}

.rc-address__top strong {
    flex: 1 1 auto;
    min-width: 0; /* allow flex children to shrink properly */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
}

/* Smaller address detail text and tighter spacing */
.rc-address p {
    font-size: 13px;
    color: #374151;
    margin: 4px 0 0;
    line-height: 1.3;
}

.rc-address {
    font-size: 13px;
}

/* product */
.rc-product {
    display: flex;
    gap: 12px;
}
.rc-product img {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    object-fit: cover;
}
.rc-product__info h4 {
    font-size: 14px;
    font-weight: 600;
}
.rc-product__bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.price {
    font-weight: 700;
    color: var(--brand);
}

/* qty */
.qty-control {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 10px;
}
.qty-control button {
    border: none;
    background: var(--brand-soft);
    padding: 6px 10px;
    color: var(--brand-dark);
    font-weight: 700;
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
}
.qty-control button:hover {
    background: var(--brand);
    color: #fff;
}
.qty-display {
    width: 32px;
    text-align: center;
    border: none;
}

/* note */
.rc-note button {
    font-size: 12px;
    color: var(--brand);
    background: none;
    border: none;
    margin-top: 6px;
}
.note-container textarea {
    width: 100%;
    border-radius: 10px;
    border: 1px solid #ddd;
    padding: 8px;
}

/* summary */
.rc-summary {
    position: sticky;
    top: 90px;
}
.rc-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 8px;
    color: #222;
}
.rc-summary-row span:first-child {
    color: #666;
    font-weight: 500;
}
.rc-summary-row span:last-child {
    color: #111827;
    font-weight: 700;
}
.rc-summary-total {
    border-top: 1px dashed var(--line);
    padding-top: 12px;
    font-weight: 800;
    font-size: 16px;
    color: var(--brand);
}
.rc-summary-total span {
    color: var(--brand);
}

/* button */
.btn-primary {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--brand);
    border: 1px solid rgba(0, 0, 0, 0.06);
    color: #fff;
    font-weight: 700;
    margin-top: 12px;
    box-shadow: 0 6px 18px rgba(27, 60, 83, 0.12);
}
.btn-primary:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

/* Modal-specific override to ensure 'Tambah Alamat Baru' uses brand colors */
#modalChangeAddress a.btn.btn-outline-primary,
#modalChangeAddress a.btn.btn-outline-primary.btn {
    color: var(--brand) !important;
    border-color: var(--brand) !important;
}
#modalChangeAddress a.btn.btn-outline-primary:hover,
#modalChangeAddress a.btn.btn-outline-primary.btn:hover {
    background: var(--brand) !important;
    color: #fff !important;
    border-color: var(--brand) !important;
}

/* Payment Options - Modern & Clean */
.payment-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    margin-bottom: 6px;
    padding: 12px 16px;
    gap: 16px;
    position: relative;
    background: #ffffff;
    border: 1px solid transparent;
}

.payment-option:hover {
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.payment-option:active {
    transform: translateY(0);
}

.payment-option.selected {
    background: linear-gradient(
        135deg,
        rgba(27, 60, 83, 0.04) 0%,
        rgba(27, 60, 83, 0.02) 100%
    );
    border-color: rgba(27, 60, 83, 0.15);
    box-shadow:
        0 2px 8px rgba(27, 60, 83, 0.08),
        0 0 0 1px rgba(27, 60, 83, 0.05);
    transform: translateY(0);
}

/* Selected indicator - subtle left border */
.payment-option.selected::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: linear-gradient(
        180deg,
        var(--brand) 0%,
        var(--brand-dark) 100%
    );
    border-radius: 0 4px 4px 0;
}

.payment-option.selected .payment-radio {
    border-color: var(--brand);
    background: var(--brand);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z'/%3e%3c/svg%3e");
}

.payment-logo {
    width: 50px;
    height: 30px;
    object-fit: contain;
    flex-shrink: 0;
    filter: brightness(1) saturate(1);
    transition: filter 0.25s ease;
}

.payment-option:hover .payment-logo {
    filter: brightness(1.05) saturate(1.1);
}

/* Improve the flex layout for payment option content */
.payment-option .d-flex {
    flex: 1;
    min-width: 0;
}

.payment-option .d-flex.align-items-center.gap-2 {
    gap: 12px !important;
}

/* Radio button - modern styling */
.payment-option .payment-radio {
    flex-shrink: 0;
    margin: 0;
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    transition: all 0.2s ease;
    cursor: pointer;
}

.payment-option .payment-radio:hover {
    border-color: var(--brand);
}

.payment-option .payment-radio:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(27, 60, 83, 0.15);
}

/* Payment method name */
.payment-option .d-flex.align-items-center span {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    transition: color 0.2s ease;
}

.payment-option.selected .d-flex.align-items-center span {
    color: var(--brand);
    font-weight: 600;
}

/* Make payment-option keyboard-focusable and hover-friendly */
.payment-option {
    transition:
        transform 0.12s ease,
        box-shadow 0.12s ease,
        border-color 0.12s ease,
        background 0.12s ease;
}
.payment-option:focus-within,
.payment-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

/* Address modal styles */
.address-card {
    transition: all 0.12s ease;
    border: 1px solid #e6e6e6;
}
.address-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}
.address-card.selected {
    border-color: var(--brand);
    background: rgba(27, 60, 83, 0.04);
}

/* Modal footer buttons consistent sizing */
.modal-footer .btn {
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 600;
}
.modal-footer .btn-sm {
    padding: 6px 12px;
}

/* Improve readability of muted/small text inside the address modal */
#modalChangeAddress .small.text-muted,
#modalChangeAddress .text-muted {
    color: #374151 !important;
}

/* Address radio: stabilize layout on mobile + brand color */
#modalChangeAddress .address-card .form-check {
    margin: 0;
    padding-left: 0;
    min-height: 0;
    display: flex;
    align-items: flex-start;
}

#modalChangeAddress .address-card .address-radio {
    float: none !important; /* override bootstrap float on .form-check-input */
    margin: 2px 0 0 0 !important;
    flex: 0 0 auto;
    width: 1.15rem;
    height: 1.15rem;
    border-color: #1b3c53;
    accent-color: #1b3c53;
    cursor: pointer;
}

#modalChangeAddress .address-card .address-radio:checked {
    background-color: #1b3c53;
    border-color: #1b3c53;
}

#modalChangeAddress .address-card .address-radio:focus {
    box-shadow: 0 0 0 0.2rem rgba(27, 60, 83, 0.18) !important;
}

@media (max-width: 767.98px) {
    #modalChangeAddress .modal-dialog {
        margin: 0.75rem;
    }

    #modalChangeAddress .address-card .card-body {
        gap: 0.75rem !important;
        align-items: flex-start !important;
    }

    #modalChangeAddress .address-card .address-card-body {
        min-width: 0;
    }
}

/* responsive */
@media (max-width: 991px) {
    .rc-summary {
        position: static;
    }
    .rc-product {
        flex-direction: column;
    }
}

/* Desktop: make checkout qty controls match cart styles */
@media (min-width: 992px) {
    .rc-checkout-page .btn-minus-js,
    .rc-checkout-page .btn-plus-js {
        width: 30px;
        height: 30px;
        border-radius: 999px;
        border: 1px solid rgba(0, 0, 0, 0.1);
        background: #fff;
        font-weight: 800;
        color: #111827;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition:
            transform 0.15s ease,
            background 0.15s ease,
            border-color 0.15s ease;
        padding: 0;
    }
    .rc-checkout-page .btn-minus-js:hover,
    .rc-checkout-page .btn-plus-js:hover {
        transform: translateY(-1px);
        border-color: rgba(17, 24, 39, 0.22);
        background: #fff;
    }

    .rc-checkout-page .qty-display {
        width: 44px;
        text-align: center;
        border: none;
        background: transparent;
        font-weight: 700;
        color: #111827;
        padding: 0;
    }

    /* Desktop payment options enhancement */
    .payment-option {
        padding: 14px 18px;
        min-height: 60px;
        margin-bottom: 8px;
    }

    .payment-option.selected {
        padding: 14px 18px;
    }

    .payment-logo {
        width: 64px;
        height: 40px;
    }

    /* Better spacing for payment option text */
    .payment-option .d-flex.align-items-center.gap-2 {
        gap: 14px !important;
    }

    .payment-option .d-flex.align-items-center.gap-2 span {
        font-size: 15px;
        font-weight: 500;
        color: #111827;
    }

    .payment-option.selected .d-flex.align-items-center.gap-2 span {
        font-size: 15px;
        font-weight: 600;
    }

    /* Radio button with better sizing */
    .payment-option .payment-radio {
        width: 22px;
        height: 22px;
        cursor: pointer;
    }

    /* Payment accordion improvements */
    .payment-accordion .accordion-button {
        font-size: 15px;
        font-weight: 600;
        padding: 14px 16px;
        background: #f8fafc;
        border-bottom: 1px solid #e5e7eb;
        color: #374151;
    }

    .payment-accordion .accordion-button:not(.collapsed) {
        background: linear-gradient(
            135deg,
            rgba(27, 60, 83, 0.06) 0%,
            rgba(27, 60, 83, 0.03) 100%
        );
        color: var(--brand);
        border-bottom-color: transparent;
    }

    .payment-accordion .accordion-button:hover {
        background: #f1f5f9;
    }

    .payment-accordion .accordion-button:not(.collapsed):hover {
        background: linear-gradient(
            135deg,
            rgba(27, 60, 83, 0.08) 0%,
            rgba(27, 60, 83, 0.04) 100%
        );
    }

    .payment-accordion .accordion-body {
        padding: 10px 0 0;
    }

    .payment-accordion .accordion-item {
        border: none;
        border-radius: 0;
        overflow: hidden;
        margin-bottom: 12px;
        background: #ffffff;
        border-radius: 12px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    .payment-accordion .accordion-item .accordion-button {
        border-radius: 12px;
    }

    .payment-accordion .accordion-item .accordion-button:not(.collapsed) {
        border-radius: 12px 12px 0 0;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }
}

/* Prevent conflicting focus/checked outlines inside the change-address modal
   Some global/component CSS (compiled style.css and plugins) apply colored
   box-shadows on focused/checked inputs which can show purple/green rings.
   Force modal-scoped neutralization and a single brand-highlight state. */
#modalChangeAddress .address-card,
#modalChangeAddress .address-card .address-card-body,
#modalChangeAddress .address-card .form-check-input {
    outline: none !important;
    box-shadow: none !important;
}

#modalChangeAddress input.address-radio:focus,
#modalChangeAddress input.address-radio:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

/* use a subtle brand ring for keyboard/focus-within, and make selected consistent */
#modalChangeAddress .address-card:focus-within {
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 4px rgba(27, 60, 83, 0.08) !important;
}

#modalChangeAddress .address-card.selected {
    border-color: var(--brand) !important;
    background: rgba(27, 60, 83, 0.04) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06) !important;
}

/* Radios: use brand color where supported */
input[type="radio"].form-check-input,
input[type="radio"].address-radio,
input[type="radio"].payment-radio {
    accent-color: var(--brand) !important;
}

/* Focus ring for accessibility */
input[type="radio"].form-check-input:focus,
input[type="radio"].address-radio:focus,
input[type="radio"].payment-radio:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(27, 60, 83, 0.08);
    border-radius: 50%;
}

/* =========================
   INSURANCE CHECKBOX - SIMPLE
   ========================= */

.insurance-option-simple {
    margin: 12px 0;
}

.insurance-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.insurance-checkbox-label:hover {
    background: rgba(27, 60, 83, 0.04);
}

.insurance-checkbox-label input[type="checkbox"] {
    display: none;
}

.insurance-checkbox-custom {
    width: 16px;
    height: 16px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    flex-shrink: 0;
    transition: all 0.2s ease;
    position: relative;
    background: #ffffff;
}

.insurance-checkbox-custom::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 9px;
    height: 9px;
    background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z'/%3e%3c/svg%3e")
        no-repeat center/cover;
    border-radius: 2px;
    transition: transform 0.2s ease;
}

.insurance-checkbox-label
    input[type="checkbox"]:checked
    ~ .insurance-checkbox-custom {
    background: var(--brand);
    border-color: var(--brand);
}

.insurance-checkbox-label
    input[type="checkbox"]:checked
    ~ .insurance-checkbox-custom::after {
    transform: translate(-50%, -50%) scale(1);
}

.insurance-checkbox-label
    input[type="checkbox"]:focus-visible
    ~ .insurance-checkbox-custom {
    box-shadow: 0 0 0 3px rgba(27, 60, 83, 0.15);
}

.insurance-text {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.insurance-label {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}

.insurance-price-display {
    font-size: 13px;
    font-weight: 600;
    color: #10b981;
}

/* =========================
   SHIPPING LOADING STATE
   ========================= */

.shipping-loading-wrapper {
    padding: 20px 0;
}

.shipping-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.shipping-content-wrapper {
    transition: opacity 0.2s ease;
}

.shipping-content-wrapper.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Button disabled state during shipping calculation */
.btn-process-checkout:disabled,
.btn-process-checkout.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--muted) !important;
    border-color: var(--muted) !important;
}
