/*
Theme Name: Gram&Kilogram Child
Theme URI: https://gramkilogram.ru
Description: Child theme for gramkilogram — checkout redesign + RU translations.
Author: GK Team
Template: gramkilogram
Version: 1.0.0
Text Domain: gramkilogram
Requires PHP: 7.4
Requires at least: 6.4
*/

/* ───────────── переменные локальные (parent уже определяет --color-brand) ───────────── */
:root {
    --gk-co-gap: 32px;
    --gk-co-input-h: 44px;
    --gk-co-radius: 6px;
    --gk-co-cta-h: 52px;
    --gk-co-border: #e5e5e5;
}

/* ───────────── Checkout: two-column grid на десктопе ───────────── */
@media (min-width: 768px) {
    form.checkout.woocommerce-checkout {
        display: grid;
        grid-template-columns: minmax(0, 60%) minmax(0, 40%);
        grid-template-areas:
            "details         review-h"
            "details         review"
            "addl            review"
            "before-pay      review";
        gap: var(--gk-co-gap);
        align-items: start;
    }
    #customer_details                       { grid-area: details; min-width: 0; }
    .woocommerce-additional-fields          { grid-area: addl; min-width: 0; }
    h3#order_review_heading                 { grid-area: review-h; margin: 0 0 12px 0; }
    #order_review,
    .woocommerce-checkout-review-order      { grid-area: review; position: sticky; top: 100px; align-self: start; }
}

/* ───────────── Form fields ───────────── */
form.checkout .form-row {
    margin: 0 0 16px 0;
    padding: 0;
}
form.checkout .form-row label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #1f2937;
}
form.checkout .form-row .required {
    color: #ef4444;
    text-decoration: none;
}
form.checkout .form-row input.input-text,
form.checkout .form-row textarea,
form.checkout .form-row select {
    width: 100%;
    height: var(--gk-co-input-h);
    padding: 10px 12px;
    font-size: 15px;
    line-height: 1.4;
    border: 1px solid #d4d4d4;
    border-radius: var(--gk-co-radius);
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
form.checkout .form-row textarea {
    height: auto;
    min-height: 90px;
}
form.checkout .form-row input:focus,
form.checkout .form-row textarea:focus,
form.checkout .form-row select:focus {
    outline: none;
    border-color: #C8A96E;
    box-shadow: 0 0 0 3px rgba(200, 169, 110, 0.18);
}

/* ───────────── Order review (правая колонка) ───────────── */
#order_review,
.woocommerce-checkout-review-order {
    background: #fff;
    border: 1px solid var(--gk-co-border);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
#order_review .shop_table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}
#order_review .shop_table thead {
    display: none;                /* "Product / Subtotal" headers — не нужны, у нас row layout */
}
#order_review .shop_table tr.cart_item {
    border-bottom: 1px solid var(--gk-co-border);
}
#order_review .shop_table tr.cart_item:last-of-type {
    border-bottom: 1px solid var(--gk-co-border);
}
#order_review .shop_table th,
#order_review .shop_table td {
    padding: 12px 0;
    text-align: left;
    vertical-align: top;
    border: none;
}
#order_review .shop_table .product-thumb {
    width: 62px;
    padding-right: 12px;
}
#order_review .shop_table .product-thumb img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}
#order_review .shop_table .product-name {
    font-size: 14px;
    line-height: 1.4;
    color: #1f2937;
}
#order_review .shop_table .product-quantity {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}
#order_review .shop_table .product-total {
    text-align: right;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    padding-left: 8px;
}
/* Скрыть subtotal/shipping rows — оставляем только Итого */
#order_review .cart-subtotal,
#order_review tr.shipping {
    display: none;
}
#order_review .order-total {
    border-top: 2px solid #1f2937;
}
#order_review .order-total th,
#order_review .order-total td {
    padding-top: 16px;
    padding-bottom: 4px;
    font-size: 18px;
    font-weight: 700;
    text-transform: none;   /* parent CSS делает uppercase, отменяем */
    letter-spacing: 0;
}
#order_review .order-total td {
    text-align: right;
}
#order_review .cart-discount th,
#order_review .cart-discount td {
    font-size: 13px;
    color: #6b7280;
    padding: 4px 0;
}

/* ───────────── Payment + Place order ───────────── */
#order_review #payment {
    background: transparent;
    margin-top: 16px;
    border: 0;
    padding: 0;
}
#order_review .wc_payment_methods {
    list-style: none;
    margin: 0 0 16px 0;
    padding: 0;
    border: 1px solid var(--gk-co-border);
    border-radius: 6px;
    overflow: hidden;
}
#order_review .wc_payment_method {
    padding: 12px;
    border-bottom: 1px solid var(--gk-co-border);
}
#order_review .wc_payment_method:last-child { border-bottom: none; }
#order_review .wc_payment_method label {
    font-weight: 500;
    margin-left: 6px;
    cursor: pointer;
}
#order_review .payment_box {
    background: #FAF6ED;
    padding: 10px 12px;
    margin-top: 8px;
    font-size: 13px;
    color: #4b5563;
    border-radius: 4px;
}

#place_order,
form.checkout #place_order {
    width: 100%;
    height: var(--gk-co-cta-h);
    background: #C8A96E;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--gk-co-radius);
    border: none;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.15s ease;
    line-height: 1;
}
#place_order:hover {
    background: #B8965A;
}
#place_order:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.woocommerce-terms-and-conditions-wrapper,
.woocommerce-privacy-policy-text {
    font-size: 12px;
    color: #6b7280;
    margin-top: 12px;
    line-height: 1.5;
}
.woocommerce-privacy-policy-text p { margin: 4px 0; }

/* ───────────── Coupon toggle (наш, parent banner отключён hook'ом) ───────────── */
.gk-coupon-section {
    grid-area: before-pay;
    margin-top: 8px;
}
.gk-coupon-toggle {
    font-size: 14px;
    color: #C8A96E;
    cursor: pointer;
    text-decoration: underline;
    background: none;
    border: none;
    padding: 0;
    font-weight: 500;
}
.gk-coupon-toggle:hover { color: #A07840; }

form.checkout_coupon {
    display: none;
    margin-top: 12px;
    padding: 16px;
    border: 1px solid var(--gk-co-border);
    border-radius: 6px;
    background: #FAF6ED;
    width: 100%;
    box-sizing: border-box;
}
form.checkout_coupon.gk-open { display: flex; gap: 8px; align-items: center; }
form.checkout_coupon .woocommerce-info,
.gk-coupon-section > .woocommerce-info { display: none; }   /* избыточный notice внутри coupon-form */
form.checkout_coupon .form-row { margin: 0; flex: 1; }
form.checkout_coupon input.input-text { height: 40px; }
form.checkout_coupon button {
    height: 40px;
    padding: 0 16px;
    background: #C8A96E;
    color: #fff;
    border: none;
    border-radius: var(--gk-co-radius);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
form.checkout_coupon button:hover { background: #B8965A; }

/* ───────────── Mobile (<768px) ───────────── */
@media (max-width: 767px) {
    form.checkout.woocommerce-checkout {
        display: block;
    }
    #order_review,
    .woocommerce-checkout-review-order {
        position: static;
        margin-top: 24px;
    }
    h3#order_review_heading {
        margin: 24px 0 12px 0;
    }
}

/* ───────────── Cart / общие правки ───────────── */
.woocommerce-cart .shop_table thead { background: #FAF6ED; }
.woocommerce-cart .shop_table th { padding: 12px; font-size: 14px; }
.woocommerce-cart .actions .button {
    background: #C8A96E;
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: var(--gk-co-radius);
    cursor: pointer;
}
.woocommerce-cart .actions .button:hover { background: #B8965A; }
