/* ==========================================================================
   ZIT Sales — Cart & Checkout Styles
   ========================================================================== */

/* ---------- Mini Cart Dropdown ---------- */

.cart-link {
    position: relative;
}

.mini-cart-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    width: 320px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    padding: 16px;
}

.mini-cart-dropdown.open {
    display: block;
}

.mini-cart__empty {
    text-align: center;
    color: #888;
    padding: 20px 0;
    margin: 0;
}

.mini-cart__items {
    list-style: none;
    padding: 0;
    margin: 0 0 12px;
    max-height: 240px;
    overflow-y: auto;
}

.mini-cart__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.mini-cart__item-image {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5f5f5;
}

.mini-cart__item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mini-cart__item-info {
    flex: 1;
    min-width: 0;
}

.mini-cart__item-name {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-cart__item-meta {
    font-size: 0.8rem;
    color: #888;
}

.mini-cart__remove {
    background: none;
    border: none;
    color: #999;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.mini-cart__remove:hover {
    color: var(--zit-danger);
}

.mini-cart__subtotal {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.95rem;
    border-top: 1px solid #e0e0e0;
    margin-bottom: 12px;
}

.mini-cart__actions {
    display: flex;
    gap: 8px;
}

.mini-cart__actions .btn {
    flex: 1;
    text-align: center;
}

/* ---------- Cart Page ---------- */

.cart-page {
    padding: 30px 0;
}

.cart-page .page-title {
    font-size: 1.5rem;
    margin-bottom: 24px;
}

.cart-empty {
    text-align: center;
    padding: 60px 20px;
}

.cart-empty p {
    font-size: 1.1rem;
    color: #666;
    margin: 16px 0;
}

.cart-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 30px;
    align-items: start;
}

/* Cart Table */

.cart-table {
    width: 100%;
    border-collapse: collapse;
}

.cart-table th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid #e0e0e0;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #666;
}

.cart-table td {
    padding: 16px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.cart-item__image {
    width: 64px;
}

.cart-item__image img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 4px;
}

.cart-item__name a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
}

.cart-item__name a:hover {
    color: var(--zit-primary);
}

.tier-badge {
    display: inline-block;
    font-size: 0.75rem;
    background: #f0f7f0;
    color: var(--zit-primary);
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 6px;
}

.cart-item__price {
    font-weight: 600;
}

.cart-item__total {
    font-weight: 700;
    color: var(--zit-primary);
}

.cart-item__remove {
    width: 40px;
    text-align: center;
}

.cart-remove-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.cart-remove-btn:hover {
    color: var(--zit-danger);
}

/* Cart Totals */

.cart-totals {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    position: sticky;
    top: 20px;
}

.cart-totals h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.totals-table {
    width: 100%;
    margin-bottom: 20px;
}

.totals-table td {
    padding: 8px 0;
    font-size: 0.95rem;
}

.totals-value {
    text-align: right;
    font-weight: 600;
}

.totals-value.discount {
    color: var(--zit-accent, #D32F2F);
}

.totals-total td {
    padding-top: 12px;
    border-top: 2px solid #ddd;
    font-size: 1.1rem;
    font-weight: 700;
}

.totals-total .totals-value {
    color: var(--zit-primary);
    font-size: 1.2rem;
}

.cart-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

/* Qty controls in cart */

.cart-item__qty .qty-control {
    display: inline-flex;
}

.cart-item__qty .qty-control input {
    width: 48px;
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
    .cart-layout {
        grid-template-columns: 1fr;
    }

    .cart-totals {
        position: static;
    }

    .cart-table thead {
        display: none;
    }

    .cart-table tr {
        display: flex;
        flex-wrap: wrap;
        padding: 12px 0;
        border-bottom: 1px solid #f0f0f0;
    }

    .cart-table td {
        border: none;
        padding: 4px 8px;
    }

    .cart-table td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.8rem;
        color: #888;
        display: block;
    }

    .cart-item__image {
        width: 50px;
    }

    .cart-item__image img {
        width: 50px;
        height: 50px;
    }

    .mini-cart-dropdown {
        right: 0;
        left: auto;
        width: min(300px, calc(100vw - 24px));
    }
}

/* ==========================================================================
   Checkout Page
   ========================================================================== */

.checkout-page {
    padding: 40px 0 64px;
}

.checkout-page .page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 2px solid #efefef;
}

/* ── Two-column layout ─────────────────────────────── */

.checkout-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 28px;
    align-items: start;
}

.checkout-fields {
    min-width: 0;
}

/* ── Section cards ─────────────────────────────────── */

.checkout-section {
    background: #fff;
    border-radius: 12px;
    padding: 28px 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
    margin-bottom: 24px;
    border: 1px solid #f0f0f0;
}

.checkout-section h2 {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 24px;
    padding-bottom: 14px;
    border-bottom: 2px solid #f4f4f4;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Form rows ─────────────────────────────────────── */

.form-row {
    margin-bottom: 18px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-row--half {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #555;
    margin-bottom: 7px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-row .required {
    color: #e53935;
    margin-left: 2px;
    font-size: 14px;
}

.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="tel"],
.form-row select,
.form-row textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    color: #1a1a1a;
    background: #fafafa;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
    outline: none;
    font-family: inherit;
    line-height: 1.5;
}

.form-row select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
    cursor: pointer;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    border-color: var(--zit-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.1);
}

.form-row textarea {
    resize: vertical;
    min-height: 84px;
}

/* ── Shipping methods ──────────────────────────────── */

/* Hide the WC table heading row for shipping — the section card title is enough */
.woocommerce-shipping-totals th {
    display: none;
}

.woocommerce-shipping-methods {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.woocommerce-shipping-methods li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
    background: #fafafa;
    user-select: none;
}

.woocommerce-shipping-methods li:hover {
    border-color: var(--zit-primary);
    background: #f4fbf4;
}

.woocommerce-shipping-methods li:has(input[type="radio"]:checked) {
    border-color: var(--zit-primary);
    background: #f0f9f0;
    box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.1);
}

.woocommerce-shipping-methods input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--zit-primary);
    flex-shrink: 0;
    cursor: pointer;
    margin: 0;
}

.woocommerce-shipping-methods label {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    cursor: pointer;
    margin: 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* Shipping price shown inline by WC (e.g. "Free" or "₵5.00") */
.woocommerce-shipping-methods label .woocommerce-Price-amount {
    font-weight: 700;
    color: var(--zit-primary);
    font-size: 13px;
}

/* "Free" text */
.woocommerce-shipping-methods label abbr {
    text-decoration: none;
    color: #15803d;
    font-weight: 700;
}

/* ── Payment methods ───────────────────────────────── */

.payment-methods {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.payment-method {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
    background: #fafafa;
    user-select: none;
}

.payment-method:hover {
    border-color: var(--zit-primary);
    background: #f4fbf4;
}

.payment-method input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--zit-primary);
    flex-shrink: 0;
    cursor: pointer;
    margin: 0;
}

.payment-method:has(input[type="radio"]:checked) {
    border-color: var(--zit-primary);
    background: #f0f9f0;
    box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.1);
}

.payment-method__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.payment-method__icon {
    width: 48px;
    height: 28px;
    object-fit: contain;
}

.payment-method__title {
    font-weight: 600;
    font-size: 14px;
    color: #1a1a1a;
}

.payment-method__desc {
    font-size: 12px;
    color: #757575;
    line-height: 1.5;
}

/* ── Order summary sidebar ─────────────────────────── */

.order-summary {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
    border: 1px solid #f0f0f0;
    position: sticky;
    top: 80px;
}

.order-summary h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid #f4f4f4;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.order-summary__items {
    margin-bottom: 4px;
}

.order-summary__item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 9px 0;
    border-bottom: 1px solid #f5f5f5;
    gap: 12px;
}

.order-summary__item .item-name {
    font-size: 13px;
    color: #333;
    flex: 1;
    line-height: 1.4;
}

.order-summary__item .item-name small {
    display: inline-block;
    margin-left: 5px;
    background: #f0f0f0;
    color: #666;
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
}

.order-summary__item .item-total {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
}

.order-summary__totals {
    width: 100%;
    border-collapse: collapse;
    margin: 4px 0 20px;
}

.order-summary__totals td {
    padding: 8px 0;
    font-size: 14px;
    color: #444;
}

.order-summary__totals td:last-child {
    text-align: right;
    font-weight: 600;
    color: #1a1a1a;
}

.order-summary__totals tr:first-child td {
    padding-top: 14px;
    border-top: 1px solid #efefef;
}

.order-summary__totals .total td {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--zit-primary);
    padding-top: 12px;
    padding-bottom: 4px;
    border-top: 2px solid #e0e0e0;
}

/* Place Order */
#place-order-btn {
    font-size: 15px;
    letter-spacing: 0.02em;
}

/* Processing */
#checkout-processing {
    padding: 20px 0;
    text-align: center;
}

#checkout-processing p {
    margin: 8px 0 0;
    font-size: 13px;
    color: #666;
}

.spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid rgba(27, 94, 32, 0.15);
    border-top-color: var(--zit-primary);
    border-radius: 50%;
    animation: zit-spin 0.75s linear infinite;
}

@keyframes zit-spin {
    to { transform: rotate(360deg); }
}

/* Errors */
.checkout-errors {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 12px;
}

.checkout-errors p {
    color: #c53030;
    font-size: 13px;
    margin: 4px 0;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.5;
}

.checkout-errors p::before {
    content: '⚠';
    flex-shrink: 0;
    margin-top: 1px;
}

/* ==========================================================================
   Coupon UI — Cart & Checkout  (Phase 4.1)
   ========================================================================== */

/* ── Cart page coupon form ─────────────────────────────────────────────── */

.coupon {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 0 4px;
}

.coupon label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.coupon .input-text {
    flex: 1 1 160px;
    min-width: 0;
    padding: 9px 13px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    color: #1a1a1a;
    background: #fafafa;
    transition: border-color 0.18s, box-shadow 0.18s;
    outline: none;
    font-family: inherit;
}

.coupon .input-text:focus {
    border-color: var(--zit-primary, #1B5E20);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.1);
}

.coupon .button {
    padding: 9px 18px;
    background: var(--zit-primary, #1B5E20);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.18s, opacity 0.18s;
    font-family: inherit;
    line-height: 1.5;
}

.coupon .button:hover {
    background: var(--zit-primary);
    filter: brightness(0.85);
}

/* ── Applied coupon tag in cart/checkout totals ─────────────────────────── */

.cart-discount th,
.cart-discount td {
    color: #15803d;
}

.woocommerce-remove-coupon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    width: 18px;
    height: 18px;
    background: #fee2e2;
    color: #b91c1c;
    border-radius: 50%;
    font-size: 13px;
    line-height: 1;
    text-decoration: none;
    font-weight: 700;
    transition: background 0.15s, color 0.15s;
    vertical-align: middle;
}

.woocommerce-remove-coupon:hover {
    background: #b91c1c;
    color: #fff;
    text-decoration: none;
}

/* ── Checkout "Have a coupon?" banner ──────────────────────────────────── */

.woocommerce-form-coupon-toggle {
    margin-bottom: 20px;
}

.woocommerce-form-coupon-toggle .woocommerce-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0f9f0;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 13px 18px;
    font-size: 14px;
    color: #166534;
    list-style: none;
    margin: 0;
}

.woocommerce-form-coupon-toggle .woocommerce-info::before {
    content: '🏷';
    font-size: 16px;
    flex-shrink: 0;
}

.woocommerce-form-coupon-toggle .woocommerce-info .showcoupon {
    color: var(--zit-primary, #1B5E20);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.woocommerce-form-coupon-toggle .woocommerce-info .showcoupon:hover {
    color: var(--zit-primary);
}

/* ── Checkout coupon form (revealed on click) ───────────────────────────── */

.checkout_coupon.woocommerce-form-coupon {
    background: #fff;
    border: 1.5px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;
    display: none; /* WC JS toggles this */
}

.checkout_coupon p:first-of-type {
    font-size: 13px;
    color: #666;
    margin: 0 0 14px;
}

.checkout_coupon .form-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin: 0;
}

.checkout_coupon .form-row input.input-text {
    flex: 1 1 180px;
    min-width: 0;
    padding: 10px 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    color: #1a1a1a;
    background: #fafafa;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
    font-family: inherit;
}

.checkout_coupon .form-row input.input-text:focus {
    border-color: var(--zit-primary, #1B5E20);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.1);
}

.checkout_coupon .form-row .button {
    padding: 10px 20px;
    background: var(--zit-primary, #1B5E20);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.18s;
    font-family: inherit;
    line-height: 1.5;
}

.checkout_coupon .form-row .button:hover {
    background: var(--zit-primary);
    filter: brightness(0.85);
}

/* ── WooCommerce notices (success / error / info) ───────────────────────── */

.woocommerce-message,
.woocommerce-error,
.woocommerce-info {
    border-radius: 10px;
    padding: 13px 18px;
    font-size: 14px;
    list-style: none;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.woocommerce-message {
    background: #f0f9f0;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.woocommerce-error {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    color: #9b2c2c;
}

.woocommerce-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

/* ==========================================================================
   Thank You Page
   ========================================================================== */

.thank-you-page {
    padding: 48px 0 64px;
}

.thank-you-wrap {
    max-width: 620px;
    margin: 0 auto;
}

.thank-you-card {
    background: #fff;
    border-radius: 16px;
    padding: 48px 40px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    border: 1px solid #f0f0f0;
}

.thank-you-icon {
    width: 72px;
    height: 72px;
    background: #e8f5e9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 32px;
    color: var(--zit-primary);
}

.thank-you-card h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px;
    text-align: center;
}

.thank-you-sub {
    text-align: center;
    color: #666;
    font-size: 15px;
    margin-bottom: 32px;
}

/* Meta grid */
.thank-you-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 32px;
}

.thank-you-meta-item {
    background: #f9fafb;
    border-radius: 8px;
    padding: 14px 16px;
    border: 1px solid #efefef;
}

.thank-you-meta-item .meta-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    font-weight: 700;
    margin-bottom: 5px;
}

.thank-you-meta-item .meta-value {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
}

/* Items list */
.thank-you-items {
    border-top: 1px solid #efefef;
    margin-bottom: 8px;
}

.thank-you-items-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    font-weight: 700;
    padding: 14px 0 8px;
}

.thank-you-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
    gap: 12px;
}

.thank-you-item .item-name {
    font-size: 14px;
    color: #333;
    flex: 1;
}

.thank-you-item .item-qty {
    font-size: 12px;
    background: #f0f0f0;
    color: #666;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.thank-you-item .item-price {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
}

.thank-you-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0 24px;
    font-size: 1.05rem;
    font-weight: 800;
    border-top: 2px solid #e0e0e0;
}

.thank-you-total-row .total-label {
    color: #1a1a1a;
}

.thank-you-total-row .total-value {
    color: var(--zit-primary);
}

.thank-you-actions {
    text-align: center;
}

/* ── Checkout responsive ───────────────────────────── */

@media (max-width: 900px) {
    .checkout-layout {
        grid-template-columns: 1fr;
    }

    .order-summary {
        position: static;
    }
}

@media (max-width: 600px) {
    .checkout-page {
        padding: 24px 0 48px;
    }

    .checkout-section {
        padding: 20px 18px;
    }

    .form-row--half {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .thank-you-card {
        padding: 32px 20px;
    }

    .thank-you-meta {
        grid-template-columns: 1fr;
    }
}
