/* ── Cart Page Styles ── */

/* ── WooCommerce Default Overrides ── */
.woocommerce-cart .woocommerce,
.woocommerce-cart .woocommerce-message,
.woocommerce-cart .woocommerce-error,
.woocommerce-cart .woocommerce-info {
    margin: 0;
}

.woocommerce-cart .woocommerce-message,
.woocommerce-cart .woocommerce-error,
.woocommerce-cart .woocommerce-info {
    padding: 16px 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.5;
}

.woocommerce-cart .woocommerce-message {
    background: rgba(0, 168, 107, 0.08);
    border: 1px solid rgba(0, 168, 107, 0.2);
    color: var(--brand-accent);
}

.woocommerce-cart .woocommerce-info {
    background: rgba(0, 114, 255, 0.08);
    border: 1px solid rgba(0, 114, 255, 0.2);
    color: var(--brand-sky);
}

.woocommerce-cart .woocommerce-error {
    background: rgba(255, 61, 129, 0.08);
    border: 1px solid rgba(255, 61, 129, 0.2);
    color: var(--brand-secondary);
}

.woocommerce-cart .woocommerce-message::before,
.woocommerce-cart .woocommerce-info::before,
.woocommerce-cart .woocommerce-error::before {
    display: none;
}

.woocommerce-cart table.shop_table {
    display: none;
}

.woocommerce-cart .cart-collaterals {
    display: none;
}

.cart_totals {
    display: none;
}

.woocommerce-cart {
    background: var(--brand-bg);
    min-height: 100vh;
}

.woocommerce-page .woocommerce {
    margin: 0;
}

/* ── Page Head ── */
.cart-page-head {
    margin-bottom: 28px;
}

.cart-page-title {
    font-family: var(--font-display);
    font-size: clamp(26px, 3.4vw, 34px);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
    color: var(--brand-dark);
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.cart-page-title .cart-count {
    font-size: 18px;
    font-weight: 400;
    color: var(--brand-text-muted);
}

.cart-subtitle {
    color: var(--brand-text-muted);
    font-size: 14px;
    margin: 6px 0 0;
}

/* ── Cart Layout ── */
.cart-layout {
    display: grid;
    grid-template-columns: 1fr 370px;
    gap: 30px;
    align-items: flex-start;
    margin-bottom: 60px;
}

.cart-items {
    display: flex;
    flex-direction: column;
}

/* ── Cart Table ── */
.cart-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--brand-card);
    border: 1px solid var(--brand-border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.cart-table thead th {
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--brand-text-muted);
    padding: 16px 12px;
    background: var(--brand-bg-secondary);
    border-bottom: 1px solid var(--brand-border-light);
}

.cart-table thead th.center,
.cart-table thead th.col-price,
.cart-table thead th.col-qty,
.cart-table thead th.col-subtotal,
.cart-table thead th.col-action {
    text-align: center;
}

.cart-table thead th:first-child {
    padding-left: 24px;
}

.cart-item {
    transition: opacity var(--transition-fast);
    animation: fadeInUp 0.4s ease-out;
    animation-fill-mode: both;
}

.cart-item:nth-child(1) { animation-delay: 0.04s; }
.cart-item:nth-child(2) { animation-delay: 0.08s; }
.cart-item:nth-child(3) { animation-delay: 0.12s; }
.cart-item:nth-child(4) { animation-delay: 0.16s; }
.cart-item:nth-child(5) { animation-delay: 0.20s; }

.cart-item td {
    padding: 22px 12px;
    border-bottom: 1px solid var(--brand-border-light);
    vertical-align: top;
}

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

.cart-item.removing {
    opacity: 0.3;
    pointer-events: none;
}

.cart-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ── Product Cell ── */
.product-cell-inner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.product-checkbox {
    display: flex;
    align-items: center;
    margin-top: 30px;
    flex-shrink: 0;
}

.product-checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--brand-dark);
}

.item-image {
    width: 80px;
    height: 80px;
    border: 1px solid var(--brand-border-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--brand-bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.item-image a {
    display: block;
    width: 100%;
    height: 100%;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.item-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--brand-dark);
}

.item-name a {
    color: var(--brand-dark);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.item-name a:hover {
    color: var(--brand-accent-warm);
}

.item-variant {
    font-size: 13px;
    color: var(--brand-text-muted);
}

.item-variant p {
    margin: 0;
}

.item-variant .variation {
    display: block;
    margin-bottom: 2px;
}

.item-variant .wc-item-meta {
    margin: 0;
    padding: 0;
    list-style: none;
}

.item-variant .wc-item-meta li {
    font-size: 13px;
    color: var(--brand-text-muted);
}

.backorder_notification {
    font-size: 12px;
    color: var(--brand-highlight);
    background: rgba(255, 184, 0, 0.1);
    border-radius: 4px;
    padding: 3px 8px;
    display: inline-block;
    width: fit-content;
}

.in-stock {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 500;
    color: var(--brand-accent);
}

.out-of-stock {
    font-size: 13px;
    font-weight: 500;
    color: var(--brand-secondary);
}

/* ── Price / Subtotal Cells ── */
.price-cell,
.subtotal-cell {
    text-align: center;
    vertical-align: middle;
    font-size: 15px;
    font-weight: 600;
    color: var(--brand-dark);
}

.subtotal-cell {
    font-weight: 700;
}

.price-cell .woocommerce-Price-amount,
.subtotal-cell .woocommerce-Price-amount {
    font-weight: 600;
}

.subtotal-cell .woocommerce-Price-amount {
    font-weight: 700;
}

/* old price label retained for AJAX spinner hook */
.item-price {
    position: relative;
}

/* ── Quantity Cell ── */
.qty-cell {
    text-align: center;
    vertical-align: middle;
}

.quantity-control {
    display: inline-flex;
}

.quantity-control .quantity,
.quantity-control .qty-wrapper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--brand-card);
    gap: 0;
}

.quantity-control .qty-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 0;
    background: var(--brand-card);
    font-size: 16px;
    cursor: pointer;
    color: var(--brand-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background var(--transition-fast);
}

.quantity-control .qty-btn:hover {
    background: var(--brand-bg-secondary);
}

.quantity-control .qty-btn:active {
    transform: scale(0.94);
}

.quantity-control .qty-wrapper input[type="number"],
.quantity-control input[type="number"] {
    width: 40px;
    height: 34px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-left: 1px solid var(--brand-border-light);
    border-right: 1px solid var(--brand-border-light);
    background: var(--brand-card);
    color: var(--brand-dark);
    -moz-appearance: textfield;
    outline: none;
    padding: 0;
}

.quantity-control input[type="number"]::-webkit-outer-spin-button,
.quantity-control input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ── Action Cell ── */
.action-cell {
    text-align: center;
    vertical-align: middle;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-sm);
    background: var(--brand-card);
    color: var(--brand-dark);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.action-btn:hover {
    background: var(--brand-bg-secondary);
    border-color: var(--brand-text-muted);
    color: var(--brand-secondary);
}

/* ── Cart Actions Bar ── */
.cart-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 18px 4px 4px;
}

.cart-actions-left {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 14px;
    color: var(--brand-dark);
    flex-wrap: wrap;
}

.select-all {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.select-all input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--brand-dark);
}

.link-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--brand-text-muted);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color var(--transition-fast);
}

.link-btn:hover {
    color: var(--brand-secondary);
}

.link-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.continue-shopping-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--brand-border);
    background: var(--brand-card);
    color: var(--brand-dark);
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.continue-shopping-btn:hover {
    background: var(--brand-bg-secondary);
    border-color: var(--brand-text-muted);
}

.continue-shopping-btn svg {
    transition: transform var(--transition-fast);
}

.continue-shopping-btn:hover svg {
    transform: translateX(-3px);
}

/* ── Order Summary ── */
.cart-summary {
    background: var(--brand-card);
    border: 1px solid var(--brand-border-light);
    border-radius: var(--radius-md);
    padding: 24px;
    position: sticky;
    top: calc(var(--header-height) + 24px);
}

.summary-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 20px;
    color: var(--brand-dark);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--brand-dark);
    margin-bottom: 14px;
}

.summary-row .summary-value {
    font-weight: 600;
    color: var(--brand-dark);
}

.summary-row.discount-line .summary-value,
.summary-row.discount-line .summary-value.discount {
    color: var(--brand-accent);
}

.summary-row .summary-value .free-text,
.summary-row .summary-value#shippingVal {
    color: var(--brand-accent);
}

.summary-row.total {
    font-size: 18px;
    font-weight: 700;
    border-top: 1px solid var(--brand-border-light);
    padding-top: 16px;
    margin-top: 4px;
    margin-bottom: 18px;
}

.summary-row.total .summary-value {
    font-size: 18px;
    font-weight: 700;
}

/* ── Free Shipping Note ── */
.free-shipping-note {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 168, 107, 0.1);
    color: var(--brand-accent);
    font-size: 13px;
    font-weight: 500;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
}

/* ── Checkout Button ── */
.wc-proceed-to-checkout {
    margin-bottom: 18px;
}

.btn-checkout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: var(--brand-dark);
    color: #fff;
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
}

.btn-checkout:hover {
    background: #333;
    color: #fff;
    box-shadow: 0 6px 24px rgba(28, 28, 28, 0.12);
}

.btn-checkout:active {
    transform: translateY(1px);
}

/* ── Coupon Box ── */
.promo-input-group {
    border-top: 1px solid var(--brand-border-light);
    padding-top: 18px;
}

.promo-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--brand-dark);
    margin-bottom: 12px;
}

.promo-label svg {
    color: var(--brand-text-muted);
}

.promo-box {
    display: flex;
    gap: 10px;
}

.promo-input {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--brand-bg);
    color: var(--brand-dark);
    font-family: var(--font-sans);
    outline: none;
    transition: border var(--transition-fast);
}

.promo-input:focus {
    border-color: var(--brand-text-muted);
}

.promo-input::placeholder {
    color: var(--brand-text-muted);
}

.promo-input.error {
    border-color: var(--brand-secondary);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.promo-btn {
    padding: 12px 22px;
    background: var(--brand-dark);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    font-family: var(--font-sans);
    transition: background var(--transition-fast);
}

.promo-btn:hover {
    background: #333;
}

.promo-btn:active {
    transform: scale(0.98);
}

/* ── Empty Cart State ── */
.cart-empty-wrapper {
    padding: 80px 24px;
    background: var(--brand-bg);
    min-height: 0;
}

.empty-cart {
    text-align: center;
    max-width: 480px;
    margin: 0 auto;
}

.empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--brand-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    color: #fff;
}

.empty-icon svg {
    width: 36px;
    height: 36px;
    stroke: #fff;
    fill: none;
}

.empty-cart h2 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 500;
    color: var(--brand-dark);
    margin: 0 0 12px;
}

.empty-cart p {
    font-size: 15px;
    color: var(--brand-text-muted);
    line-height: 1.7;
    margin: 0 0 32px;
}

.btn-shop {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 16px 32px;
    border-radius: 50px;
    background: var(--brand-dark);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
}

.btn-shop:hover,
.btn-shop:focus {
    background: #333;
    color: #fff;
    outline: none;
}

.btn-shop svg {
    width: 18px;
    height: 18px;
    stroke: #fff;
    fill: none;
    transition: transform var(--transition-fast);
}

.btn-shop:hover svg {
    transform: translateX(4px);
}

.woocommerce-cart .return-to-shop {
    display: none !important;
}

.cart-collaterals {
    margin-top: 40px;
}

/* ── Animations ── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Loading States ── */
.shopbar-cart-updating {
    position: relative;
}

.shopbar-cart-updating .item-price {
    color: transparent !important;
}

.shopbar-cart-updating .item-price::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid var(--brand-border);
    border-top-color: var(--brand-dark);
    border-radius: 50%;
    animation: shopbarSpin 0.6s linear infinite;
}

@keyframes shopbarSpin {
    to { transform: rotate(360deg); }
}

.shopbar-summary-updating .summary-value,
.shopbar-summary-updating .subtotal-cell {
    position: relative;
    color: transparent !important;
}

.shopbar-summary-updating .summary-value::after,
.shopbar-summary-updating .subtotal-cell::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 14px;
    transform: translateY(-50%);
    background: linear-gradient(90deg, var(--brand-border-light) 25%, var(--brand-bg-secondary) 50%, var(--brand-border-light) 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: shopbarSkeletonPulse 1.2s ease-in-out infinite;
}

@keyframes shopbarSkeletonPulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.cart-item.removing {
    animation: slideOut 0.3s ease-out forwards;
}

@keyframes slideOut {
    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

.wp-block-woocommerce-cart {
    margin-top: 20px;
}

.wc-block-cart__totals-title {
    margin-top: 0;
}

/**
====================================================================
  Responsive Styles
====================================================================
*/

@media (max-width: 1024px) {
    .cart-layout {
        grid-template-columns: 1fr 330px;
        gap: 24px;
    }
}

@media (max-width: 900px) {
    .cart-layout {
        grid-template-columns: 1fr;
    }

    .cart-summary {
        position: static;
    }
}

@media (max-width: 768px) {
    /* Stack table into card-like rows */
    .cart-table thead {
        display: none;
    }

    .cart-table,
    .cart-table tbody,
    .cart-table tr,
    .cart-table td {
        display: block;
        width: 100%;
    }

    .cart-item {
        border: 1px solid var(--brand-border-light);
        border-radius: var(--radius-md);
        margin-bottom: 16px;
        overflow: hidden;
    }

    .cart-item td {
        border: none;
        border-bottom: 1px solid var(--brand-border-light);
        padding: 14px 16px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 16px;
        text-align: right;
    }

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

    .cart-item td::before {
        content: attr(data-label);
        font-size: 13px;
        font-weight: 600;
        color: var(--brand-text-muted);
        text-transform: uppercase;
        letter-spacing: 0.02em;
        text-align: left;
    }

    .cart-item td.product-cell {
        display: block;
        text-align: left;
    }

    .cart-item td.product-cell::before {
        display: none;
    }

    .cart-item td.price-cell,
    .cart-item td.subtotal-cell,
    .cart-item td.qty-cell,
    .cart-item td.action-cell {
        justify-content: space-between;
    }

    .cart-page-title {
        font-size: 26px;
    }

    .cart-summary {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .product-cell-inner {
        gap: 12px;
    }

    .item-image {
        width: 64px;
        height: 64px;
    }

    .item-name {
        font-size: 14px;
    }

    .cart-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .continue-shopping-btn {
        justify-content: center;
    }

    .promo-box {
        flex-direction: column;
    }

    .promo-btn {
        width: 100%;
    }

    .btn-checkout {
        padding: 14px;
        font-size: 14px;
    }
}
