/* CHECKOUT LAYOUT */
.kapiva-checkout-header {
    background: white;
    padding: 15px 30px;
    border-bottom: 1px solid #eee;
    margin-bottom: 30px;
}

.kapiva-checkout-header .header-inner {
    max-width: none !important;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kapiva-checkout-header .back-link {
    text-decoration: none;
    color: #333;
}

.kapiva-checkout-header .checkout-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    font-family: 'Inter', sans-serif;
}

.kapiva-checkout-wrapper {
    max-width: none !important;
    /* FULL WIDTH OVERRIDE */
    width: 98% !important;
    margin: 0 auto;
    padding: 20px;
}

.woocommerce-checkout {
    display: grid;
    grid-template-columns: 49% 49%;
    gap: 2%;
}

/* Fix Default Container Constraint */
.woocommerce {
    max-width: 100% !important;
}

@media (max-width: 768px) {
    .woocommerce-checkout {
        grid-template-columns: 1fr;
    }

    .checkout-right {
        order: -1;
        /* Show Summary first on mobile? Or verify preference. Usually last for Kapiva. Keep default or specific. Kapiva usually puts it below or collapsible. Let's keep specific order if requested */
    }
}

/* HEADINGS */
.section-title {
    font-size: 18px;
    font-weight: 700;
    color: #111;
    margin-bottom: 15px;
    font-family: 'Inter', sans-serif;
}

.login-prompt {
    margin-bottom: 30px;
}

.login-prompt .login-link {
    color: #D4AF37;
    /* Gold */
    font-weight: 800;
    text-decoration: none;
}

.login-prompt .sub-text {
    font-size: 12px;
    color: #666;
}

/* FIELDS */
/* FIELDS & FORM GRID */
.woocommerce-input-wrapper {
    width: 100%;
}

.form-row {
    margin-bottom: 25px;
    /* More breathing room */
    width: 100%;
    margin-right: 0 !important;
    /* Reset woo default */
}

/* Hide Labels for Clean Look */
.form-row label {
    display: none !important;
}

/* Grid System for Inputs */
.form-row-first {
    width: 48%;
    float: left;
    margin-right: 4%;
    clear: both;
}

.form-row-last {
    width: 48%;
    float: right;
    margin-right: 0;
    clear: right;
}

.form-row-wide {
    width: 100%;
    clear: both;
}

/* Clearfix */
.checkout-fields-group:after {
    content: "";
    display: table;
    clear: both;
}

/* HIDE UNWANTED FIELDS (Aggressive) */
#billing_country_field,
#billing_address_2_field,
#billing_state_field,
#shipping_country_field,
#shipping_address_2_field,
#shipping_state_field,
#order_comments_field {
    display: none !important;
}

/* Hide Default WooCommerce Headings to use our Custom Ones */
.woocommerce-billing-fields>h3,
.woocommerce-shipping-fields>h3,
.woocommerce-additional-fields>h3 {
    display: none !important;
}

.input-text,
select {
    width: 100%;
    padding: 14px 15px;
    /* Taller touch target */
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 15px;
    background: white;
    color: #333;
    outline: none;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.input-text:focus {
    border-color: #2E4F28;
    /* Green Focus */
    background: white;
    box-shadow: 0 0 0 2px rgba(46, 79, 40, 0.1);
}

.input-text::placeholder {
    color: #aaa;
}

/* ERROR STATE (Highlight Required) */
.woocommerce-invalid .input-text {
    border-color: #d32f2f !important;
    /* Red Border */
    background-color: #fff8f8;
    /* Light Red Background */
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.1);
}

.woocommerce-invalid .input-text:focus {
    border-color: #d32f2f !important;
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.15);
}

/* RIGHT COLUMN (SUMMARY) */
.checkout-right {
    position: sticky;
    top: 20px;
    height: fit-content;
}

.order-summary-card {
    background: white;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

.summary-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

/* ORDER SUMMARY CARDS */
.checkout-cart-items {
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.checkout-cart-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #f5f5f5;
    align-items: flex-start;
}

.checkout-cart-item:last-child {
    border-bottom: none;
}

.item-image img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #eee;
}

.item-details {
    flex: 1;
}

.item-name {
    font-size: 13px;
    font-weight: 700;
    color: #111;
    margin-bottom: 5px;
    line-height: 1.4;
}

.item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
}

.item-price {
    font-weight: 800;
    color: #2E4F28;
    font-size: 14px;
}

/* Qty Control (Mini) */
.checkout-qty-control {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.checkout-qty-control .qty-btn {
    background: none;
    border: none;
    width: 24px;
    height: 24px;
    font-size: 14px;
    cursor: pointer;
    color: #555;
    padding: 0;
}

.checkout-qty-control .qty-input {
    width: 24px;
    height: 24px;
    text-align: center;
    border: none;
    font-size: 12px;
    padding: 0;
    background: transparent;
    font-weight: bold;
}

/* TOTALS */
.checkout-totals {
    border-top: 2px solid #eee;
    padding-top: 15px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
    color: #555;
}

.total-row.grand-total {
    font-size: 18px;
    font-weight: 800;
    color: #111;
    margin-top: 15px;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.total-row.shipping {
    color: #2E4F28;
}

/* PAYMENT METHODS - GRID STYLE */
#payment {
    background: transparent;
    border: none;
}

ul.wc_payment_methods {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 0;
    list-style: none;
    margin-bottom: 20px;
}

.wc_payment_method {
    flex: 1 1 45%;
    /* 2 per row */
    min-width: 140px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    /* More padding for card look */
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 80px;
}

.wc_payment_method:hover {
    border-color: #aaa;
}

/* Selected State */
.wc_payment_method.input-radio:checked+label,
.wc_payment_method.payment_method_selected {
    border-color: #2E4F28;
    background-color: #f9fdf9;
    box-shadow: 0 0 0 1px #2E4F28;
}

.wc_payment_method.payment_method_selected:after {
    content: "✔";
    position: absolute;
    top: 5px;
    right: 5px;
    background: #2E4F28;
    color: white;
    font-size: 10px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hide Default Radio but keep accessible */
.wc_payment_method input[type="radio"] {
    opacity: 0;
    position: absolute;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 10;
}

.wc_payment_method label {
    font-weight: 600;
    font-size: 12px;
    margin: 0;
    pointer-events: none;
    /* Let input handle click */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

/* Fake Icons (Material Symbols) */
.wc_payment_method label::before {
    font-family: 'Material Symbols Outlined';
    font-size: 24px;
    color: #555;
    margin-bottom: 5px;
}

/* Map IDs to Icons */
.payment_method_cod label::before {
    content: "payments";
}

.payment_method_bacs label::before {
    content: "account_balance";
}

.payment_method_cheque label::before {
    content: "dataset";
}

.payment_method_upi label::before {
    content: "qr_code_2";
}

/* Payment Box Info (Description) */
.payment_box {
    background: #f0f7f0;
    border: 1px solid #2E4F28;
    /* Green Border */
    padding: 15px;
    font-size: 13px;
    border-radius: 8px;
    margin-top: 15px;
    color: #333;
    display: none;
    /* JS usually toggles this, but grid makes it tricky. Usually displayed below the whole grid in Kapiva design? Or inside? Kapiva shows it below. */
    flex-basis: 100%;
}

.payment_method_selected .payment_box {
    display: block;
    /* But structure is usually li > box. Grid breaks this flow. 
    Fix: We might need Flex row wrap. */
}

/* PLACE ORDER BUTTON */
#place_order {
    background-color: #2E4F28 !important;
    color: white !important;
    font-weight: 800 !important;
    padding: 18px !important;
    border-radius: 12px !important;
    text-transform: uppercase;
    font-size: 16px !important;
    width: 100%;
    margin-top: 20px;
}

#place_order:hover {
    background-color: #1a3016 !important;
}

/* HIDE DEFAULT THEME HEADER/FOOTER on Checkout Page */
.woocommerce-checkout .site-header,
.woocommerce-checkout .site-footer,
.woocommerce-checkout .wp-block-group.global-header {
    display: none !important;
}

body.woocommerce-checkout {
    background-color: #fcfcfc;
}

/* TRUST SEALS (New Section) */
.checkout-trust-seals {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px dashed #e0e0e0;
}

/* 1. Badges Grid */
.trust-badges-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 40px;
    text-align: center;
}

.badge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.badge-icon {
    width: 50px;
    height: 50px;
    background: #f5f5f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.badge-icon .material-symbols-outlined {
    font-size: 24px;
    color: #333;
}

.badge-text {
    font-size: 13px;
    line-height: 1.4;
    color: #111;
    font-weight: 500;
}

/* 2. Payment Row */
.payment-trust-row {
    text-align: center;
}

.trust-heading {
    color: #75b022;
    /* Green */
    font-weight: 700;
    text-transform: uppercase;
    font-size: 14px;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.payment-logos {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.payment-logos img {
    height: 30px;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 2px 5px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .trust-badges-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2x2 on mobile */
        gap: 30px 15px;
    }
}