/* ==========================================================================
   GK CHECKOUT & THANK YOU PAGES - FINAL REFACTOR
   ========================================================================== */

:root {
    /* Legacy variables mapped to Canonical Tokens */
}

body.gk-checkout-layout .woocommerce * {
    box-sizing: border-box;
    outline: none;
}

/* Main Container */
body.gk-checkout-layout .woocommerce {
    max-width: var(--gk-site-width);
    margin: 0 auto;
    padding: 30px 15px;
    background: var(--gk-background);
}

/* --- Checkout Stepper --- */
body.gk-checkout-layout .gk-checkout-steps {
    width: 100%;
    margin-bottom: 25px;
    background: var(--gk-surface);
    padding: 20px;
    border-radius: var(--gk-radius-lg);
    border: var(--gk-border-width) solid var(--gk-border-color);
}

body.gk-checkout-layout .gk-checkout-steps__list {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 40px !important;
    position: relative;
}

body.gk-checkout-layout .gk-checkout-steps__list::before {
    content: '';
    position: absolute;
    top: 24px;
    left: 60px;
    right: 60px;
    height: 2px;
    background: var(--gk-neutral-100);
    z-index: 0;
}

body.gk-checkout-layout .gk-checkout-steps__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    background: var(--gk-surface);
    padding: 0 15px;
}

body.gk-checkout-layout .gk-checkout-steps__icon {
    width: 48px;
    height: 48px;
    border-radius: var(--gk-radius-round);
    background: var(--gk-surface);
    border: 2px solid var(--gk-border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--gk-heading-weight);
    color: var(--gk-neutral-400);
    margin-bottom: 8px;
    font-size: 16px;
    transition: all 0.3s;
}

body.gk-checkout-layout .gk-checkout-steps__label {
    font-size: 13px;
    font-weight: var(--gk-heading-weight);
    color: var(--gk-neutral-500);
}

/* Active State */
body.gk-checkout-layout .gk-checkout-steps__item.is-current .gk-checkout-steps__icon {
    border-color: var(--gk-primary);
    color: var(--gk-primary);
    background: var(--gk-primary-50);
    transform: scale(1.1);
}
body.gk-checkout-layout .gk-checkout-steps__item.is-current .gk-checkout-steps__label {
    color: var(--gk-primary);
}

/* Completed State */
body.gk-checkout-layout .gk-checkout-steps__item.is-completed .gk-checkout-steps__icon {
    background: var(--gk-primary);
    border-color: var(--gk-primary);
    color: var(--gk-surface);
}
body.gk-checkout-layout .gk-checkout-steps__item.is-completed .gk-checkout-steps__label {
    color: var(--gk-text);
}

/* --- Main Grid Layout --- */
body.gk-checkout-layout form.checkout {
    display: grid !important;
    grid-template-columns: 1fr 380px;
    gap: 25px;
    align-items: start;
}

/* --- Customer Details Forms --- */
body.gk-checkout-layout #customer_details {
    display: flex;
    flex-direction: column;
    gap: 25px;
    width: 100%;
}

body.gk-checkout-layout #customer_details .col-1,
body.gk-checkout-layout #customer_details .col-2 {
    width: 100% !important;
    float: none !important;
    max-width: 100% !important;
    background: var(--gk-surface);
    padding: 25px;
    border-radius: var(--gk-radius-lg);
    border: var(--gk-border-width) solid var(--gk-border-color);
}

body.gk-checkout-layout .woocommerce-additional-fields {
    background: var(--gk-surface);
    padding: 25px;
    border-radius: var(--gk-radius-lg);
    border: var(--gk-border-width) solid var(--gk-border-color);
}

body.gk-checkout-layout .woocommerce-billing-fields h3,
body.gk-checkout-layout .woocommerce-shipping-fields h3,
body.gk-checkout-layout .woocommerce-additional-fields h3 {
    font-size: 16px;
    font-weight: 800;
    color: var(--gk-text);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: var(--gk-border-width) solid var(--gk-neutral-100);
    display: flex;
    align-items: center;
}

body.gk-checkout-layout .woocommerce-billing-fields h3::before {
    content: ''; display: inline-block; width: 8px; height: 8px; background: var(--gk-primary); border-radius: 50%; margin-left: 10px;
}

/* ──────────────────────────────────────
   🔹 Grid فیلدهای billing / shipping
   ────────────────────────────────────── */
body.gk-checkout-layout .woocommerce-billing-fields__field-wrapper,
body.gk-checkout-layout .woocommerce-shipping-fields__field-wrapper,
body.gk-checkout-layout .woocommerce-additional-fields__field-wrapper {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 18px 16px;                         /* ← فاصله عمودی ۱۸، افقی ۱۶ */
    align-items: start;                     /* ← رفع مشکل ناهماهنگی نام / نام‌خانوادگی */
}

/* عرض فیلدها از تنظیمات قالب کنترل می‌شود. */
body.gk-checkout-layout .form-row-wide,
body.gk-checkout-layout .form-row.notes,
body.gk-checkout-layout .form-row.gk-field-width-full {
    grid-column: span 6 / span 6;
}
body.gk-checkout-layout .form-row-first,
body.gk-checkout-layout .form-row-last,
body.gk-checkout-layout .form-row.gk-field-width-half {
    grid-column: span 3 / span 3;
}
body.gk-checkout-layout .form-row.gk-field-width-third {
    grid-column: span 2 / span 2;
}

/* ──────────────────────────────────────
   🔹 .form-row — ریست
   ────────────────────────────────────── */
body.gk-checkout-layout .form-row {
    margin: 0;
    position: relative;
    float: none !important;
    clear: none !important;
    width: auto !important;
    min-width: 0;
}

/* ──────────────────────────────────────
   🔹 Label — ظریف و خوانا
   ────────────────────────────────────── */
body.gk-checkout-layout .form-row label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    color: var(--gk-neutral-700, #404040);
    font-size: 13px;
    letter-spacing: -0.01em;
}

body.gk-checkout-layout .form-row label .required {
    color: var(--gk-danger, #e53935);
    margin-right: 2px;
}

/* ──────────────────────────────────────
   🔹 Input / Select / Textarea — شیک و سنگین
   ────────────────────────────────────── */
body.gk-checkout-layout input.input-text,
body.gk-checkout-layout select,
body.gk-checkout-layout textarea {
    width: 100%;
    border-radius: 6px;                    /* ← گرد ملایم، نه فانتزی */
    border: 1.5px solid var(--gk-neutral-300, #d0d0d0);
    padding: 11px 14px;
    font-size: 13.5px;
    color: var(--gk-neutral-800, #1a1a1a);
    background-color: var(--gk-neutral-50, #fafafa);
    transition: border-color 0.25s ease,
    box-shadow 0.25s ease,
    background-color 0.25s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);    /* ← سایه ظریف = عمق */
    outline: none;
    -webkit-appearance: none;
    line-height: 1.5;
}

/* ── حالت Hover ── */
body.gk-checkout-layout input.input-text:hover,
body.gk-checkout-layout select:hover,
body.gk-checkout-layout textarea:hover {
    border-color: var(--gk-neutral-400, #a0a0a0);
    background-color: #fff;
}

/* ── حالت Focus ── */
body.gk-checkout-layout input.input-text:focus,
body.gk-checkout-layout select:focus,
body.gk-checkout-layout textarea:focus {
    border-color: var(--gk-primary);
    box-shadow: 0 0 0 3px rgba(var(--gk-primary-rgb, 59, 130, 246), 0.12),
    0 1px 2px rgba(0, 0, 0, 0.04);
    background-color: #fff;
    outline: none;
}

/* ── حالت خطا ── */
body.gk-checkout-layout .woocommerce-invalid input.input-text,
body.gk-checkout-layout .woocommerce-invalid select,
body.gk-checkout-layout .woocommerce-invalid textarea {
    border-color: var(--gk-danger, #e53935);
    box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.04);
    background-color: #fffbfb;
}

/* ── Placeholder ── */
body.gk-checkout-layout input.input-text::placeholder,
body.gk-checkout-layout textarea::placeholder {
    color: var(--gk-neutral-400, #a0a0a0);
    font-weight: 400;
}

/* ──────────────────────────────────────
   🔹 Select2 (استان / شهر) — هماهنگ با بقیه
   ────────────────────────────────────── */
body.gk-checkout-layout .select2-container .select2-selection--single {
    height: auto;
    min-height: 42px;
    border-radius: 6px;
    border: 1.5px solid var(--gk-neutral-300, #d0d0d0);
    background-color: var(--gk-neutral-50, #fafafa);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

body.gk-checkout-layout .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 1.5;
    padding: 9px 14px;
    font-size: 13.5px;
    color: var(--gk-neutral-800, #1a1a1a);
}

body.gk-checkout-layout .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
    left: 12px;
    right: auto;
}

body.gk-checkout-layout .select2-container--open .select2-selection--single {
    border-color: var(--gk-primary);
    box-shadow: 0 0 0 3px rgba(var(--gk-primary-rgb, 59, 130, 246), 0.12);
}

/* ── Select2 Dropdown ── */
body.gk-checkout-layout .select2-dropdown {
    border: 1.5px solid var(--gk-neutral-300, #d0d0d0);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    margin-top: 4px;
}

body.gk-checkout-layout .select2-results__option {
    padding: 9px 14px;
    font-size: 13px;
    transition: background 0.15s;
}

body.gk-checkout-layout .select2-results__option--highlighted {
    background-color: var(--gk-primary-50, #eff6ff) !important;
    color: var(--gk-primary, #3b82f6) !important;
}

/* ──────────────────────────────────────
   🔹 Textarea (یادداشت سفارش) — ارتفاع مناسب
   ────────────────────────────────────── */
body.gk-checkout-layout textarea {
    min-height: 100px;
    resize: vertical;
}

/* ──────────────────────────────────────
   🔹 تیترهای بخش‌ها — سنگین‌تر
   ────────────────────────────────────── */
body.gk-checkout-layout .woocommerce-billing-fields h3,
body.gk-checkout-layout .woocommerce-shipping-fields h3,
body.gk-checkout-layout .woocommerce-additional-fields h3 {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--gk-neutral-200, #e5e5e5);
    display: flex;
    align-items: center;
    color: var(--gk-neutral-800, #1a1a1a);
}

body.gk-checkout-layout .woocommerce-billing-fields h3::before,
body.gk-checkout-layout .woocommerce-shipping-fields h3::before,
body.gk-checkout-layout .woocommerce-additional-fields h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: var(--gk-primary);
    border-radius: 2px;
    margin-left: 10px;
    flex-shrink: 0;
}

/* ──────────────────────────────────────
   🔹 موبایل
   ────────────────────────────────────── */
@media (max-width: 768px) {
    body.gk-checkout-layout .woocommerce-billing-fields__field-wrapper,
    body.gk-checkout-layout .woocommerce-shipping-fields__field-wrapper,
    body.gk-checkout-layout .woocommerce-additional-fields__field-wrapper {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 14px;
    }
    body.gk-checkout-layout .form-row-wide,
    body.gk-checkout-layout .form-row-first,
    body.gk-checkout-layout .form-row-last,
    body.gk-checkout-layout .form-row.notes,
    body.gk-checkout-layout .form-row.gk-field-width-full,
    body.gk-checkout-layout .form-row.gk-field-width-half,
    body.gk-checkout-layout .form-row.gk-field-width-third {
        grid-column: span 6 / span 6 !important;
    }
}


body.gk-checkout-layout #ship-to-different-address {
    margin-bottom: 0; display: flex; align-items: center;
}
body.gk-checkout-layout #ship-to-different-address label {
    font-size: 16px; font-weight: var(--gk-heading-weight); color: var(--gk-text); cursor: pointer; display: flex; align-items: center; gap: 10px;
}
body.gk-checkout-layout #ship-to-different-address input {
    width: 18px; height: 18px; accent-color: var(--gk-primary);
}

/* --- Order Review Sidebar --- */
body.gk-checkout-layout h3#order_review_heading { display: none; }

body.gk-checkout-layout #order_review {
    background: var(--gk-surface);
    padding: 25px;
    border-radius: var(--gk-radius-lg);
    border: var(--gk-border-width) solid var(--gk-border-color);
    position: sticky;
    top: 20px;
}

body.gk-checkout-layout table.woocommerce-checkout-review-order-table {
    width: 100%; border-collapse: collapse; margin-bottom: 20px; border: none;
}
body.gk-checkout-layout table.woocommerce-checkout-review-order-table th,
body.gk-checkout-layout table.woocommerce-checkout-review-order-table td {
    border: none; padding: 12px 0; border-bottom: var(--gk-border-width) solid var(--gk-neutral-50); text-align: right; font-size: 14px; color: var(--gk-neutral-600);
}
body.gk-checkout-layout table.woocommerce-checkout-review-order-table td {
    text-align: left; font-weight: var(--gk-heading-weight); color: var(--gk-text);
}
body.gk-checkout-layout .cart_item .product-name { font-weight: 500; color: var(--gk-text); }
body.gk-checkout-layout .cart_item .product-quantity { color: var(--gk-neutral-500); }

body.gk-checkout-layout tr.order-total th {
    font-size: 16px; font-weight: 800; color: var(--gk-text); border-top: 2px solid var(--gk-neutral-100);
}
body.gk-checkout-layout tr.order-total td {
    font-size: 20px; font-weight: 800; color: var(--gk-primary); border-top: 2px solid var(--gk-neutral-100);
}

body.gk-checkout-layout #payment { background: transparent; border-radius: 0; }
body.gk-checkout-layout #payment ul.payment_methods { padding: 0; border-bottom: none; margin-bottom: 20px; }
body.gk-checkout-layout #payment ul.payment_methods li {
    list-style: none; background: var(--gk-neutral-50); margin-bottom: 10px; border-radius: var(--gk-radius-md); padding: 15px; border: var(--gk-border-width) solid var(--gk-neutral-100);
}
body.gk-checkout-layout #payment ul.payment_methods li label { font-weight: var(--gk-heading-weight); color: var(--gk-text); cursor: pointer; font-size: 14px; margin-right: 8px; }
body.gk-checkout-layout #payment div.payment_box {
    background: var(--gk-surface); color: var(--gk-neutral-600); margin-top: 10px; padding: 12px; border-radius: 6px; font-size: 13px; border: 1px dashed var(--gk-border-color);
}
body.gk-checkout-layout #payment div.payment_box::before { display: none; }

body.gk-checkout-layout #place_order {
    background-color: var(--gk-primary) !important;
    color: var(--gk-surface) !important;
    display: block; width: 100%; padding: 16px 0 !important;
    border-radius: var(--gk-radius-md) !important; font-size: 18px !important; font-weight: var(--gk-heading-weight) !important;
    text-align: center; border: none !important; cursor: pointer; transition: background 0.2s;
    box-shadow: var(--gk-shadow);
}
body.gk-checkout-layout #place_order:hover { background-color: var(--gk-primary-600) !important; }

body.gk-checkout-layout .gk-checkout-map-section {
    background: var(--gk-surface); padding: 25px; border-radius: var(--gk-radius-lg); border: var(--gk-border-width) solid var(--gk-border-color); margin-top: 25px;
}
#gk-checkout-map {
    width: 100%; height: 300px; border-radius: var(--gk-radius-md); border: var(--gk-border-width) solid var(--gk-border-color); z-index: 1;
}

@media (max-width: 992px) {
    body.gk-checkout-layout form.checkout {
        grid-template-columns: 1fr;
    }
    body.gk-checkout-layout .woocommerce-billing-fields__field-wrapper,
    body.gk-checkout-layout .woocommerce-shipping-fields__field-wrapper,
    body.gk-checkout-layout .woocommerce-additional-fields__field-wrapper {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
    body.gk-checkout-layout .form-row {
        grid-column: span 6 / span 6 !important;
    }
    body.gk-checkout-layout .gk-checkout-steps__list {
        padding: 0 !important; gap: 10px;
    }
    body.gk-checkout-layout .gk-checkout-steps__list::before {
        top: 20px; left: 20px; right: 20px;
    }
    body.gk-checkout-layout .gk-checkout-steps__icon {
        width: 40px; height: 40px; font-size: 14px;
    }
    body.gk-checkout-layout #order_review {
        position: static;
    }
}

/* --- Thank You Page --- */
.gk-thankyou-wrapper {
    max-width: var(--gk-site-width);   /* ← مثل سبد خرید */
    margin: 0 auto;
    padding: 40px 15px;
    font-family: inherit;
}

.gk-thankyou-header {
    text-align: center;
    margin-bottom: 40px;
}
.gk-thankyou-icon-wrapper {
    width: 80px; height: 80px;
    background: var(--gk-neutral-100);
    border-radius: var(--gk-radius-round);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
}
.gk-thankyou-check {
    font-size: 40px; color: var(--gk-accent);
}
.gk-thankyou-title {
    font-size: 24px; font-weight: 800; color: var(--gk-accent); margin-bottom: 10px;
}
.gk-thankyou-subtitle {
    font-size: 16px; color: var(--gk-neutral-600);
}
.gk-thankyou-subtitle strong {
    color: var(--gk-text); font-size: 18px; margin-right: 5px;
}

.gk-thankyou-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    align-items: start;
}

.gk-thankyou-box {
    background: var(--gk-surface);
    border: var(--gk-border-width) solid var(--gk-border-color);
    border-radius: var(--gk-radius-lg);
    padding: 25px;
    margin-bottom: 25px;
}
.gk-box-title {
    font-size: 16px; font-weight: var(--gk-heading-weight); color: var(--gk-text);
    margin-bottom: 20px; padding-bottom: 15px; border-bottom: var(--gk-border-width) solid var(--gk-neutral-100);
}

.gk-order-overview {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-wrap: wrap; gap: 20px;
}
.gk-order-overview li {
    flex: 1 1 45%;
    display: flex; flex-direction: column; gap: 5px;
}
.gk-order-overview span { font-size: 13px; color: var(--gk-neutral-600); }
.gk-order-overview strong { font-size: 15px; color: var(--gk-text); }

.gk-thankyou-products {
    width: 100%; border-collapse: collapse;
}
.gk-thankyou-products th {
    text-align: right; color: var(--gk-neutral-600); font-weight: 400; padding-bottom: 10px; border-bottom: var(--gk-border-width) solid var(--gk-neutral-100);
}
.gk-thankyou-products td {
    padding: 15px 0; border-bottom: var(--gk-border-width) solid var(--gk-neutral-50); vertical-align: middle;
}
.gk-thankyou-products tr:last-child td { border: none; }
.gk-product-name {
    display: flex; align-items: center; gap: 10px;
}
.gk-product-name img {
    width: 50px; height: 50px; object-fit: contain; border-radius: 4px; border: var(--gk-border-width) solid var(--gk-neutral-100);
}

.gk-delivery-row {
    margin-bottom: 15px; display: flex; flex-direction: column; gap: 5px;
}
.gk-delivery-row .label { color: var(--gk-neutral-600); font-size: 13px; }
.gk-delivery-row .value { color: var(--gk-text); font-weight: 500; font-size: 14px; line-height: 1.6; }

.gk-delivery-map-wrapper { margin-top: 20px; }
.gk-map-label { font-size: 13px; color: var(--gk-neutral-600); margin-bottom: 8px; }
#gk-thankyou-map {
    width: 100%; height: 200px; border-radius: var(--gk-radius-md); border: var(--gk-border-width) solid var(--gk-border-color);
}

.gk-thankyou-actions { display: flex; flex-direction: column; gap: 10px; }
.gk-btn {
    display: block; text-align: center; padding: 12px; border-radius: var(--gk-radius-md); text-decoration: none; font-weight: var(--gk-heading-weight); transition: 0.2s;
}
.gk-btn--primary {
    background: var(--gk-primary); color: var(--gk-surface);
}
.gk-btn--primary:hover { background: var(--gk-primary-600); color: var(--gk-surface); }
.gk-btn--secondary {
    background: var(--gk-surface); border: var(--gk-border-width) solid var(--gk-border-color); color: var(--gk-neutral-600);
}
.gk-btn--secondary:hover { border-color: var(--gk-neutral-500); color: var(--gk-text); }

@media (max-width: 900px) {
    .gk-thankyou-grid { grid-template-columns: 1fr; }
    .gk-order-overview li { flex: 1 1 100%; }
}

.gk-thankyou-header--failed .gk-thankyou-icon-wrapper { background: var(--gk-primary-50); }
.gk-thankyou-header--failed .gk-thankyou-title { color: var(--gk-primary); }
.gk-icon-failed { color: var(--gk-primary); font-size: 40px; font-weight: bold; }

/* ========================================================================== 
   GK Checkout responsive hardening v1.9.2
   ========================================================================== */
body.gk-checkout-layout,
body.gk-checkout-layout .woocommerce {
    overflow-x: hidden;
}

body.gk-checkout-layout .woocommerce {
    width: 100%;
    max-width: min(var(--gk-site-width, 1320px), calc(100vw - 24px));
    padding-inline: clamp(10px, 2.5vw, 24px) !important;
}

body.gk-checkout-layout form.checkout {
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) minmax(300px, var(--gk-cc-checkout-summary-width, 380px));
}

body.gk-checkout-layout #customer_details,
body.gk-checkout-layout #order_review,
body.gk-checkout-layout #customer_details .col-1,
body.gk-checkout-layout #customer_details .col-2,
body.gk-checkout-layout .woocommerce-additional-fields,
body.gk-checkout-layout .gk-checkout-map-section,
body.gk-checkout-layout .woocommerce-billing-fields,
body.gk-checkout-layout .woocommerce-shipping-fields,
body.gk-checkout-layout .woocommerce-checkout-review-order,
body.gk-checkout-layout .woocommerce-checkout-payment {
    min-width: 0;
    max-width: 100%;
}

body.gk-checkout-layout .woocommerce-billing-fields__field-wrapper,
body.gk-checkout-layout .woocommerce-shipping-fields__field-wrapper,
body.gk-checkout-layout .woocommerce-additional-fields__field-wrapper {
    min-width: 0;
}

body.gk-checkout-layout .form-row,
body.gk-checkout-layout .form-row > span,
body.gk-checkout-layout .woocommerce-input-wrapper,
body.gk-checkout-layout .select2-container {
    min-width: 0 !important;
    max-width: 100% !important;
}

body.gk-checkout-layout input.input-text,
body.gk-checkout-layout select,
body.gk-checkout-layout textarea,
body.gk-checkout-layout .select2-container,
body.gk-checkout-layout .select2-container .select2-selection--single,
body.gk-checkout-layout .select2-container .select2-selection__rendered {
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
}

body.gk-checkout-layout .woocommerce-error,
body.gk-checkout-layout .woocommerce-info,
body.gk-checkout-layout .woocommerce-message {
    width: 100%;
    max-width: 100%;
    border-radius: var(--gk-cc-card-radius, var(--gk-radius-lg, 14px));
    overflow-wrap: anywhere;
    line-height: 1.9;
}

body.gk-checkout-layout form.checkout_coupon,
body.gk-checkout-layout form.login,
body.gk-checkout-layout .woocommerce-form-coupon,
body.gk-checkout-layout .woocommerce-form-login {
    max-width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
    border-radius: var(--gk-cc-card-radius, 14px);
}

body.gk-checkout-layout form.checkout_coupon .form-row,
body.gk-checkout-layout form.login .form-row {
    width: auto !important;
    min-width: 0 !important;
}

body.gk-checkout-layout #order_review table,
body.gk-checkout-layout #order_review th,
body.gk-checkout-layout #order_review td,
body.gk-checkout-layout .woocommerce-checkout-review-order-table,
body.gk-checkout-layout .woocommerce-checkout-review-order-table * {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: normal;
}

body.gk-checkout-layout table.woocommerce-checkout-review-order-table .product-name {
    text-align: right !important;
    line-height: 1.8;
}

body.gk-checkout-layout table.woocommerce-checkout-review-order-table .product-total,
body.gk-checkout-layout table.woocommerce-checkout-review-order-table tfoot td {
    text-align: left !important;
    white-space: normal;
    line-height: 1.8;
}

body.gk-checkout-layout table.woocommerce-checkout-review-order-table .product-quantity,
body.gk-checkout-layout table.woocommerce-checkout-review-order-table .amount,
body.gk-checkout-layout table.woocommerce-checkout-review-order-table bdi {
    white-space: nowrap;
}

body.gk-checkout-layout #payment ul.payment_methods,
body.gk-checkout-layout #payment ul.payment_methods li,
body.gk-checkout-layout #payment .payment_box,
body.gk-checkout-layout #payment .place-order,
body.gk-checkout-layout .woocommerce-terms-and-conditions-wrapper {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
}

body.gk-checkout-layout #payment ul.payment_methods li label {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    max-width: calc(100% - 28px);
    line-height: 1.8;
    vertical-align: top;
}

body.gk-checkout-layout #payment ul.payment_methods li img {
    max-width: 84px;
    height: auto;
    object-fit: contain;
}

body.gk-checkout-layout .woocommerce-terms-and-conditions-checkbox-text {
    line-height: 1.9;
}

body.gk-checkout-layout .gk-checkout-map-section__controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

body.gk-checkout-layout .gk-checkout-map__locate-btn,
body.gk-checkout-layout .gk-checkout-map__status {
    max-width: 100%;
    overflow-wrap: anywhere;
}

body.gk-checkout-layout #gk-checkout-map,
body.gk-checkout-layout .gk-checkout-map,
body.gk-checkout-layout .leaflet-container {
    max-width: 100%;
    min-width: 0;
}

body.gk-checkout-layout #order_review .shop_table tfoot th,
body.gk-checkout-layout #order_review .shop_table tfoot td {
    vertical-align: middle;
}

@media (max-width: 1200px) {
    body.gk-checkout-layout form.checkout {
        grid-template-columns: minmax(0, 1fr) minmax(300px, 340px) !important;
        gap: 18px !important;
    }

    body.gk-checkout-layout .woocommerce {
        max-width: min(var(--gk-site-width, 1320px), calc(100vw - 16px));
    }
}

@media (max-width: 1024px) {
    body.gk-checkout-layout form.checkout {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 18px !important;
    }

    body.gk-checkout-layout #order_review {
        position: static !important;
        top: auto !important;
        width: 100% !important;
        grid-column: 1 / -1 !important;
    }

    body.gk-checkout-layout #customer_details {
        grid-column: 1 / -1 !important;
    }
}

@media (max-width: 768px) {
    body.gk-checkout-layout {
        padding-bottom: calc(var(--gk-bottom-nav-height, 72px) + env(safe-area-inset-bottom, 0px));
    }

    body.gk-checkout-layout .woocommerce {
        padding: 14px 10px calc(22px + env(safe-area-inset-bottom, 0px)) !important;
        max-width: 100% !important;
    }

    body.gk-checkout-layout .gk-checkout-steps {
        padding: 12px 8px !important;
        margin-bottom: 14px !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    body.gk-checkout-layout .gk-checkout-steps::-webkit-scrollbar {
        display: none;
    }

    body.gk-checkout-layout .gk-checkout-steps__list {
        min-width: max-content;
        gap: 12px !important;
        padding: 0 6px !important;
        justify-content: flex-start !important;
    }

    body.gk-checkout-layout .gk-checkout-steps__list::before {
        left: 28px !important;
        right: 28px !important;
        top: 18px !important;
    }

    body.gk-checkout-layout .gk-checkout-steps__item {
        padding: 0 8px !important;
        min-width: 72px;
    }

    body.gk-checkout-layout .gk-checkout-steps__icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 13px !important;
        margin-bottom: 6px !important;
    }

    body.gk-checkout-layout .gk-checkout-steps__label {
        font-size: 11px !important;
        white-space: nowrap;
        line-height: 1.6;
    }

    body.gk-checkout-layout #customer_details,
    body.gk-checkout-layout form.checkout {
        gap: 14px !important;
    }

    body.gk-checkout-layout #customer_details .col-1,
    body.gk-checkout-layout #customer_details .col-2,
    body.gk-checkout-layout .woocommerce-additional-fields,
    body.gk-checkout-layout #order_review,
    body.gk-checkout-layout .gk-checkout-map-section {
        padding: 14px !important;
        border-radius: 14px !important;
    }

    body.gk-checkout-layout .woocommerce-billing-fields__field-wrapper,
    body.gk-checkout-layout .woocommerce-shipping-fields__field-wrapper,
    body.gk-checkout-layout .woocommerce-additional-fields__field-wrapper {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 12px !important;
    }

    body.gk-checkout-layout .form-row,
    body.gk-checkout-layout .form-row-wide,
    body.gk-checkout-layout .form-row-first,
    body.gk-checkout-layout .form-row-last,
    body.gk-checkout-layout .form-row.notes,
    body.gk-checkout-layout .form-row.gk-field-width-full,
    body.gk-checkout-layout .form-row.gk-field-width-half,
    body.gk-checkout-layout .form-row.gk-field-width-third {
        grid-column: 1 / -1 !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    body.gk-checkout-layout .woocommerce-billing-fields h3,
    body.gk-checkout-layout .woocommerce-shipping-fields h3,
    body.gk-checkout-layout .woocommerce-additional-fields h3,
    body.gk-checkout-layout .gk-checkout-map-section__title {
        font-size: 14px !important;
        line-height: 1.8;
        margin-bottom: 12px !important;
        padding-bottom: 10px !important;
    }

    body.gk-checkout-layout .form-row label {
        font-size: 12.5px !important;
        line-height: 1.8;
        margin-bottom: 6px !important;
    }

    body.gk-checkout-layout input.input-text,
    body.gk-checkout-layout select,
    body.gk-checkout-layout textarea,
    body.gk-checkout-layout .select2-container .select2-selection--single {
        min-height: 44px !important;
        font-size: 13px !important;
        padding: 10px 12px !important;
    }

    body.gk-checkout-layout .select2-container--default .select2-selection--single .select2-selection__rendered {
        padding: 9px 12px 9px 34px !important;
        font-size: 13px !important;
        line-height: 1.8 !important;
    }

    body.gk-checkout-layout textarea {
        min-height: 92px !important;
    }

    body.gk-checkout-layout form.checkout_coupon,
    body.gk-checkout-layout form.login,
    body.gk-checkout-layout .woocommerce-form-coupon,
    body.gk-checkout-layout .woocommerce-form-login {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 10px !important;
        padding: 14px !important;
    }

    body.gk-checkout-layout form.checkout_coupon button,
    body.gk-checkout-layout form.login button,
    body.gk-checkout-layout form.checkout_coupon .button,
    body.gk-checkout-layout form.login .button {
        width: 100% !important;
        min-height: 44px;
    }

    body.gk-checkout-layout table.woocommerce-checkout-review-order-table,
    body.gk-checkout-layout table.woocommerce-checkout-review-order-table tbody,
    body.gk-checkout-layout table.woocommerce-checkout-review-order-table tfoot,
    body.gk-checkout-layout table.woocommerce-checkout-review-order-table tr,
    body.gk-checkout-layout table.woocommerce-checkout-review-order-table th,
    body.gk-checkout-layout table.woocommerce-checkout-review-order-table td {
        display: block;
        width: 100% !important;
    }

    body.gk-checkout-layout table.woocommerce-checkout-review-order-table thead {
        display: none;
    }

    body.gk-checkout-layout table.woocommerce-checkout-review-order-table tbody tr.cart_item {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px 10px;
        align-items: start;
        padding: 10px 0;
        border-bottom: 1px solid var(--gk-cc-border-color, var(--gk-border-color, #eee));
    }

    body.gk-checkout-layout table.woocommerce-checkout-review-order-table tbody tr.cart_item td {
        border: 0 !important;
        padding: 0 !important;
    }

    body.gk-checkout-layout table.woocommerce-checkout-review-order-table tbody tr.cart_item .product-name {
        grid-column: 1 / 2;
        font-size: 13px !important;
    }

    body.gk-checkout-layout table.woocommerce-checkout-review-order-table tbody tr.cart_item .product-total {
        grid-column: 2 / 3;
        font-size: 13px !important;
        text-align: left !important;
        white-space: nowrap;
    }

    body.gk-checkout-layout table.woocommerce-checkout-review-order-table tfoot tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px 10px;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid var(--gk-cc-border-color, var(--gk-border-color, #eee));
    }

    body.gk-checkout-layout table.woocommerce-checkout-review-order-table tfoot th,
    body.gk-checkout-layout table.woocommerce-checkout-review-order-table tfoot td {
        border: 0 !important;
        padding: 0 !important;
        font-size: 13px !important;
    }

    body.gk-checkout-layout table.woocommerce-checkout-review-order-table tfoot td {
        text-align: left !important;
    }

    body.gk-checkout-layout table.woocommerce-checkout-review-order-table tr.order-total th,
    body.gk-checkout-layout table.woocommerce-checkout-review-order-table tr.order-total td {
        font-size: 15px !important;
    }

    body.gk-checkout-layout table.woocommerce-checkout-review-order-table tr.order-total td {
        font-size: 17px !important;
        white-space: nowrap;
    }

    body.gk-checkout-layout #payment ul.payment_methods li {
        padding: 12px !important;
        margin-bottom: 8px !important;
        border-radius: 12px !important;
    }

    body.gk-checkout-layout #payment ul.payment_methods li input.input-radio {
        margin-top: 7px;
    }

    body.gk-checkout-layout #payment ul.payment_methods li label {
        max-width: calc(100% - 30px);
        font-size: 13px !important;
        line-height: 1.8;
    }

    body.gk-checkout-layout #payment div.payment_box {
        margin: 10px 0 0 !important;
        padding: 10px !important;
        font-size: 12px !important;
        line-height: 1.9;
    }

    body.gk-checkout-layout #payment .place-order {
        padding-top: 12px !important;
    }

    body.gk-checkout-layout .woocommerce-terms-and-conditions-wrapper,
    body.gk-checkout-layout .woocommerce-privacy-policy-text {
        font-size: 12px;
        line-height: 1.9;
    }

    body.gk-checkout-layout #place_order {
        min-height: 48px;
        font-size: 15px !important;
        padding: 13px 16px !important;
        border-radius: 12px !important;
    }

    body.gk-checkout-layout .gk-checkout-map-section__controls {
        flex-direction: column;
        align-items: stretch;
    }

    body.gk-checkout-layout .gk-checkout-map__locate-btn {
        width: 100%;
        min-height: 42px;
    }

    body.gk-checkout-layout #gk-checkout-map,
    body.gk-checkout-layout .gk-checkout-map {
        height: var(--gk-cc-map-mobile-height, 240px) !important;
        min-height: 180px;
    }

    body.gk-checkout-layout .leaflet-control-zoom a {
        width: 32px !important;
        height: 32px !important;
        line-height: 32px !important;
    }
}

@media (max-width: 480px) {
    body.gk-checkout-layout .woocommerce {
        padding-inline: 8px !important;
    }

    body.gk-checkout-layout #customer_details .col-1,
    body.gk-checkout-layout #customer_details .col-2,
    body.gk-checkout-layout .woocommerce-additional-fields,
    body.gk-checkout-layout #order_review,
    body.gk-checkout-layout .gk-checkout-map-section {
        padding: 12px !important;
        border-radius: 12px !important;
    }

    body.gk-checkout-layout table.woocommerce-checkout-review-order-table tbody tr.cart_item,
    body.gk-checkout-layout table.woocommerce-checkout-review-order-table tfoot tr {
        grid-template-columns: minmax(0, 1fr);
    }

    body.gk-checkout-layout table.woocommerce-checkout-review-order-table tbody tr.cart_item .product-total,
    body.gk-checkout-layout table.woocommerce-checkout-review-order-table tfoot td {
        grid-column: 1 / -1;
        text-align: right !important;
        white-space: normal;
    }

    body.gk-checkout-layout table.woocommerce-checkout-review-order-table tr.order-total td {
        white-space: normal;
    }
}
