/* ── 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 .shop-breadcrumbs {
    background: transparent;
    border-bottom: none;
    padding: 24px 0 16px;
}

.woocommerce-cart .shop-breadcrumbs .container {
    padding-top: 0;
    padding-bottom: 0;
}

.woocommerce-cart .shop-breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 0;
    font-size: 12px;
    color: var(--brand-text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.woocommerce-cart .shop-breadcrumb-nav a {
    color: var(--brand-text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.woocommerce-cart .shop-breadcrumb-nav a:hover {
    color: var(--brand-dark);
}

.woocommerce-cart .shop-breadcrumb-sep {
    opacity: 0.5;
    margin: 0 8px;
}

.woocommerce-cart .shop-breadcrumb-current {
    color: var(--brand-text-muted);
    font-weight: 400;
}

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

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

/* ── Page Title ── */
.cart-page-title {
    font-family: var(--font-display);
    font-size: clamp(30px, 4vw, 44px);
    font-weight: 500;
    letter-spacing: -0.015em;
    margin-bottom: 36px;
    color: var(--brand-dark);
}

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


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

/* ── Cart Item ── */
.cart-item {
    display: grid;
    grid-template-columns: 100px 1fr auto;
    gap: 20px;
    align-items: center;
    padding: 24px 0;
    border-bottom: 1px solid var(--brand-border-light);
    transition: opacity var(--transition-fast);
}


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

/* Product Image */
.item-image {
    width: 100px;
    height: 125px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--brand-bg-secondary);
}


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

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

/* Product Details */
.item-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.item-name {
    font-size: 16px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--brand-dark);
    line-height: 1.4;
}

.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);
    margin: 4px 0 0;
    padding: 4px 8px;
    background: rgba(255, 184, 0, 0.1);
    border-radius: 4px;
    display: inline-block;
}

.item-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--brand-dark);
}

.item-price .woocommerce-Price-amount {
    font-weight: 600;
}

/* ── Item Actions ── */
.item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}


/* ── Quantity Control ── */
.quantity-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quantity-control .quantity {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quantity-control .qty-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid var(--brand-border);
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-dark);
    transition: all var(--transition-fast);
    padding: 0;
    font-family: var(--font-sans);
}

.qty-btn:hover {
    border-color: var(--brand-dark);
    background: var(--brand-bg-secondary);
}

.qty-btn:active {
    transform: scale(0.95);
}

/* Quantity Input */
.quantity input[type="number"],
.ci-qty input[type="number"] {
    width: 32px;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    border: none;
    background: transparent;
    color: var(--brand-dark);
    font-family: var(--font-sans);
    -moz-appearance: textfield;
    padding: 0;
    height: auto;
}

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

.quantity input[type="number"]:focus,
.ci-qty input[type="number"]:focus {
    outline: none;
    box-shadow: none;
}

.quantity-control .quantity {
    border: none;
    border-radius: 0;
    overflow: visible;
    background: transparent;
}

.remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: var(--brand-text-muted);
    letter-spacing: 0.03em;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color var(--transition-fast);
    font-family: var(--font-sans);
}

.remove-btn:hover {
    color: #C44D4D;
}

.cart-summary {
    background: var(--brand-card);
    border-radius: var(--radius-md);
    padding: 28px;
    border: 1px solid var(--brand-border-light);
    position: sticky;
    top: calc(var(--header-height) + 30px);
}


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

.summary-products {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--brand-border-light);
    max-height: 320px;
    overflow-y: auto;
}

.summary-product-item {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--brand-border-light);
}

.summary-product-item:last-child {
    border-bottom: none;
}

.summary-product-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--brand-bg-secondary);
}

.summary-product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.summary-product-thumb a {
    display: block;
    width: 100%;
    height: 100%;
}

.summary-product-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.summary-product-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--brand-dark);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

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

.summary-product-qty {
    font-size: 12px;
    color: var(--brand-text-muted);
}

.summary-product-total {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-dark);
    white-space: nowrap;
}

.summary-product-total .woocommerce-Price-amount {
    font-weight: 600;
}

/* Scrollbar for products list */
.summary-products::-webkit-scrollbar {
    width: 4px;
}

.summary-products::-webkit-scrollbar-track {
    background: transparent;
}

.summary-products::-webkit-scrollbar-thumb {
    background: var(--brand-border);
    border-radius: 2px;
}


/* ── Summary Rows ── */
.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--brand-muted);
    margin-bottom: 12px;
}

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

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

.summary-row.total {
    font-weight: 600;
    color: var(--brand-dark);
    font-size: 18px;
    border-top: 1px solid var(--brand-border-light);
    padding-top: 16px;
    margin-top: 8px;
    margin-bottom: 0;
}

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

.summary-tax {
    font-size: 12px;
    color: var(--brand-text-muted);
    text-align: center;
    margin: 8px 0 16px;
}

/* ── Promo Input Group ── */
.promo-input-group {
    margin: 20px 0 24px;
}

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

.promo-input {
    flex: 1;
    padding: 12px 16px;
    border: 1.5px solid var(--brand-border);
    border-radius: 50px;
    font-size: 13px;
    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);
    box-shadow: none;
}

.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 20px;
    background: var(--brand-dark);
    color: #fff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.03em;
    transition: all var(--transition-fast);
    white-space: nowrap;
    font-family: var(--font-sans);
}

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

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

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

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

.btn-checkout:hover {
    background: #333;
    box-shadow: 0 4px 20px rgba(28, 28, 28, 0.06);
    color: #fff;
}

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

.btn-checkout svg {
    width: 18px;
    height: 18px;
}

.btn-continue-shopping {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 16px 32px;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-decoration: none;
    border-radius: 50px;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: 1.5px solid var(--brand-border);
    background: transparent;
    color: var(--brand-dark);
    font-family: var(--font-sans);
    margin-top: 10px;
}

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

/* ── 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);
    border: none;
    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(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cart-item {
    animation: fadeInUp 0.4s ease-out;
    animation-fill-mode: both;
}

.cart-item:nth-child(1) { animation-delay: 0.05s; }
.cart-item:nth-child(2) { animation-delay: 0.1s; }
.cart-item:nth-child(3) { animation-delay: 0.15s; }
.cart-item:nth-child(4) { animation-delay: 0.2s; }
.cart-item:nth-child(5) { animation-delay: 0.25s; }

/* Loading State */
.cart-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

.shopnex-cart-updating {
    position: relative;
}

.shopnex-cart-updating::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.6);
    border-radius: inherit;
    z-index: 2;
}

.shopnex-summary-updating .summary-value,
.shopnex-summary-updating .summary-product-total,
.shopnex-summary-updating .summary-product-qty {
    position: relative;
    color: transparent !important;
}

.shopnex-summary-updating .summary-value::after,
.shopnex-summary-updating .summary-product-total::after,
.shopnex-summary-updating .summary-product-qty::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: shopnexSkeletonPulse 1.2s ease-in-out infinite;
}

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

/* Spinner for cart item row updating */
.shopnex-cart-updating .item-price {
    position: relative;
    color: transparent !important;
}

.shopnex-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: shopnexSpin 0.6s linear infinite;
}

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

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

@keyframes slideOut {
    to {
        opacity: 0;
        transform: translateX(40px);
        height: 0;
        padding: 0;
        margin: 0;
        border: none;
        overflow: hidden;
    }
}

/* ── WooCommerce Notices Override ── */
.woocommerce-cart .woocommerce-message,
.woocommerce-cart .woocommerce-info,
.woocommerce-cart .woocommerce-error {
    margin-bottom: 24px;
}

.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 320px;
        gap: 32px;
    }
}

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

    .cart-item {
        grid-template-columns: 80px 1fr auto;
        gap: 14px;
    }

    .item-image {
        width: 80px;
        height: 100px;
    }

    .cart-summary {
        position: static;
        margin-top: 20px;
    }

    .summary-product-item {
        grid-template-columns: 40px 1fr auto;
        gap: 8px;
    }

    .summary-product-thumb {
        width: 40px;
        height: 40px;
    }

    .cart-page-title {
        margin-bottom: 24px;
    }

    .cart-layout {
        margin-bottom: 40px;
    }

    .cart-summary {
        padding: 24px;
    }

    .summary-title {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .cart-item {
        grid-template-columns: 70px 1fr;
    }

    .item-image {
        width: 70px;
        height: 90px;
    }

    .item-actions {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-top: 8px;
    }

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

    .promo-btn {
        width: 100%;
    }

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

    .btn-continue-shopping {
        padding: 14px 24px;
        font-size: 13px;
    }
}
