/* ============================================================
   Cart & Checkout Styles - 广州知谨贸易
   ============================================================ */

/* ===== Cart toggle in nav ===== */
.cart-toggle {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    padding: 4px 8px;
    line-height: 1;
    display: flex;
    align-items: center;
}
.cart-badge {
    position: absolute;
    top: -4px;
    right: -2px;
    background: #c0392b;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}
.cart-badge.hidden { display: none; }

/* ===== Quantity stepper on product cards ===== */
.product-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.qty-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid #d8d8d8;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.qty-stepper button {
    width: 30px;
    height: 34px;
    border: none;
    background: #f4f4f4;
    font-size: 16px;
    cursor: pointer;
    color: #333;
    line-height: 1;
}
.qty-stepper button:hover { background: #e8e8e8; }
.qty-stepper input {
    width: 46px;
    height: 34px;
    border: none;
    text-align: center;
    font-size: 14px;
    -moz-appearance: textfield;
    appearance: textfield;
}
.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.product-addcart {
    flex: 1;
    min-width: 110px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: #1f6f4a;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}
.product-addcart:hover { background: #185a3c; }

/* keep card click (open modal) but not on controls */
.product-card .product-actions { pointer-events: auto; }

/* ===== Cart Drawer ===== */
.cart-drawer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    visibility: hidden;
    pointer-events: none;
}
.cart-drawer.open { visibility: visible; pointer-events: auto; }
.cart-drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.45);
    opacity: 0;
    transition: opacity .25s;
}
.cart-drawer.open .cart-drawer-overlay { opacity: 1; }
.cart-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 380px;
    max-width: 92vw;
    background: #fff;
    box-shadow: -8px 0 30px rgba(0,0,0,.18);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .28s ease;
}
.cart-drawer.open .cart-drawer-panel { transform: translateX(0); }
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid #eee;
}
.cart-header h3 { font-size: 18px; margin: 0; }
.cart-close {
    background: none; border: none; font-size: 26px; cursor: pointer; color: #888; line-height: 1;
}
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}
.cart-empty {
    text-align: center;
    color: #999;
    padding: 60px 20px;
    font-size: 15px;
}
.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f2f2f2;
}
.cart-item-img {
    width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: #f6f6f6;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 14px; font-weight: 600; margin: 0 0 4px; line-height: 1.3; }
.cart-item-meta { font-size: 12px; color: #888; margin-bottom: 6px; }
.cart-item-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cart-item .qty-stepper { transform: scale(.92); transform-origin: left; }
.cart-item-price { font-size: 13px; font-weight: 700; color: #1f6f4a; white-space: nowrap; }
.cart-item-remove {
    background: none; border: none; color: #c0392b; font-size: 12px; cursor: pointer; padding: 0;
}
.cart-footer {
    border-top: 1px solid #eee;
    padding: 16px 20px 22px;
}
.cart-total-row {
    display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px;
    font-size: 15px; font-weight: 600;
}
.cart-total-amount { font-size: 20px; color: #1f6f4a; }
.cart-total-note { font-size: 12px; color: #999; margin: 0 0 12px; }
.cart-footer .btn { margin-top: 8px; }

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1f6f4a;
    color: #fff;
    padding: 12px 22px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s, transform .25s;
    z-index: 3000;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Checkout page ===== */
.checkout-wrap {
    max-width: 980px;
    margin: 120px auto 60px;
    padding: 0 20px;
}
.checkout-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 30px;
    align-items: start;
}
.checkout-card {
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 14px;
    padding: 24px;
}
.checkout-card h2 { margin-top: 0; font-size: 20px; }
.checkout-form .form-group { margin-bottom: 14px; }
.checkout-form label { display: block; font-size: 13px; color: #555; margin-bottom: 6px; font-weight: 600; }
.checkout-form input, .checkout-form select {
    width: 100%; height: 42px; border: 1px solid #d8d8d8; border-radius: 8px; padding: 0 12px; font-size: 14px; box-sizing: border-box;
}
.checkout-form .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.order-summary { position: sticky; top: 120px; }
.order-line {
    display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f2f2f2; font-size: 14px;
}
.order-line .nm { flex: 1; }
.order-total-row { display: flex; justify-content: space-between; font-size: 18px; font-weight: 700; margin-top: 12px; }
.order-total-row .amt { color: #1f6f4a; }
.checkout-note { font-size: 12px; color: #999; margin: 10px 0 16px; line-height: 1.5; }
.checkout-empty { text-align: center; padding: 80px 20px; }
.checkout-back { display: inline-block; margin-bottom: 16px; color: #1f6f4a; font-weight: 600; text-decoration: none; }

/* ===== Responsive ===== */
@media (max-width: 760px) {
    .checkout-grid { grid-template-columns: 1fr; }
    .order-summary { position: static; }
    .checkout-wrap { margin-top: 90px; }
}

/* ===== Legal pages ===== */
.legal-wrap { max-width: 820px; margin: 120px auto 70px; padding: 0 24px; }
.legal-wrap h1 { font-size: 28px; margin-bottom: 6px; }
.legal-wrap .legal-sub { color: #999; font-size: 14px; margin-bottom: 28px; }
.legal-wrap h2 { font-size: 19px; margin: 28px 0 10px; }
.legal-wrap p, .legal-wrap li { color: #444; line-height: 1.8; font-size: 15px; }
.legal-wrap ul { padding-left: 22px; }
.legal-wrap a { color: #1f6f4a; }
@media (max-width: 760px) { .legal-wrap { margin-top: 90px; } }
