/* 
 * Antigravity Cart Pro Styles
 */

.ag-cart-container {
    max-width: 1200px;
    margin: 40px auto;
    font-family: 'Inter', sans-serif;
    color: #334155;
}

/* Cart Header Branding */
.ag-cart-page-header {
    margin-bottom: 24px;
    padding-bottom: 12px;
}

.ag-cart-title {
    color: #E84879;
    font-size: 36px;
    font-weight: 700;
    margin: 0 0 8px 0;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.ag-cart-subtitle {
    color: #475569;
    font-size: 16px;
    font-weight: 400;
    margin: 0;
    line-height: 1.5;
}

.ag-cart-count {
    font-weight: 700;
    color: #1e40af;
}

/* Free Shipping Bar */
/* Free Shipping Bar */
.ag-free-shipping-bar-wrapper {
    background: #ffffff;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
    width: 100%;
}

.ag-fs-bar-inner {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ag-fs-bar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.ag-fs-badge {
    background: #13B3D0;
    color: #ffffff;
    padding: 6px 18px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.ag-fs-text {
    font-size: 14px;
    color: #475569;
    text-align: right;
    font-weight: 500;
}

.ag-fs-text strong {
    color: #334155;
    font-weight: 800;
}

.ag-progress {
    height: 8px;
    background: #e2e8f0;
    border-radius: 100px;
    position: relative;
    width: 100%; /* Full width */
}

.ag-progress-fill {
    height: 100%;
    background: linear-gradient(to right, #13b3d0 0%, #e84879 100%);
    border-radius: 100px;
    position: relative;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.ag-progress-icon-wrap {
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    border-radius: 50%;
}

.ag-progress-icon {
    width: 44px;
    height: 44px;
}

/* Main Cart Header Bar */
.ag-cart-main-header-bar {
    background: #1B51A5;
    color: #ffffff;
    padding: 14px 20px;
    border-radius: 16px 16px 0 0;
    text-align: center;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 0;
    letter-spacing: 0.2px;
}

.ag-cart-main-header-bar strong {
    font-weight: 800;
}

/* Layout */
.ag-cart-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.ag-col-main {
    flex: 1 1 65%;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.ag-col-sidebar {
    flex: 1 1 30%;
    min-width: 300px;
}

/* List Header */
.ag-cart-header {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px;
    font-weight: 600;
    font-size: 14px;
    color: #475569;
    justify-content: space-between;
}

.ag-cart-body {
     padding: 16px;
}

.ag-cell-check {
    flex: 0 0 35%;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ag-cell-price {
    flex: 0 0 15%;
    text-align: center;
}

.ag-cell-qty {
    flex: 0 0 18%;
    text-align: center;
}

.product-subtotal,
.ag-cell-subtotal {
    flex: 0 0 18%;
    text-align: center;
}

.ag-cell-action {
    flex: 0 0 40px;
    text-align: right;
}

/* Cart Item */
.ag-cart-item {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f8fafc;
    transition: background 0.3s ease;
    margin-bottom: 5px;
}

.ag-cart-item:hover {
    background: #fdfdfd;
}

/* Checkbox specific */
.ag-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    position: relative;
    user-select: none;
    color: #334155;
}

.ag-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.ag-check-mark {
    height: 18px;
    width: 18px;
    background-color: #fff;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ag-checkbox:hover input~.ag-check-mark {
    border-color: #1e40af;
}

.ag-checkbox input:checked~.ag-check-mark {
    background-color: #1e40af;
    border-color: #1e40af;
}

.ag-checkbox input:checked~.ag-check-mark:after {
    content: "";
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

/* Product Info */
.ag-product-info-wrap {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-left: 10px;
}

.ag-product-thumbnail img {
    width: 120px;
    object-fit: cover;
    border-radius: 8px;
    background: #e2e8f0;
}

.ag-product-name {
    font-weight: 500;
    font-size: 13px;
    line-height: 1.4;
    color: #050505;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-clamp: 3;
    overflow: hidden;
}

.ag-product-name a {
    color: inherit;
    text-decoration: none;
}

.ag-product-name a:hover {
    color: #1e40af;
}

/* Unit and Price */
.ag-cell-price {
    font-weight: 600;
    color: #1e40af;
    font-size: 14px;
}

/* Quantity controls */
.ag-qty-controls {
    display: inline-flex;
    align-items: center;
    background: #f8fafc;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.ag-qty-btn {
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ag-qty-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.ag-qty-controls .ag-qty-input {
    width: 32px;
    text-align: center;
    border: none;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    padding: 2px 0;
    -moz-appearance: textfield;
    appearance: textfield;
    outline: none;
}

.ag-qty-controls .ag-qty-input::-webkit-outer-spin-button,
.ag-qty-controls .ag-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Unit Select */
.ag-unit-select {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
}

/* Remove button */
.ag-remove-btn {
    color: #ef4444;
    /* red icon */
    cursor: pointer;
    transition: transform 0.2s;
    display: inline-block;
}

.ag-remove-btn:hover {
    transform: scale(1.1);
}

/* Hidden update cart button display */
.ag-actions-row {
    display: none;
}

/* Gifts Section (Pink theme, full border) */
.ag-gifts-section {
    margin-top: 24px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e84879;
    /* Exact pink */
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

.ag-gifts-header {
    background: #e84879;
    color: #fff;
    padding: 16px 24px;
    font-weight: 600;
    font-size: 16px;
}

.ag-gifts-body {
    padding: 0 24px;
}

.ag-gift-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid #f1f5f9;
}

.ag-gift-item:last-child {
    border-bottom: none;
}

.ag-gift-item .ag-product-meta {
    color: #1e40af;
    font-size: 13px;
    margin-top: 4px;
}

.ag-gift-qty {
    color: #1e40af;
    font-weight: 600;
    font-size: 14px;
}

.ag-gift-price {
    text-align: right;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ag-gift-price del {
    color: #94a3b8;
}

.ag-gift-price span {
    color: #1e40af;
    font-weight: 600;
    font-size: 14px;
}

/* Sidebar Totals - Cyan Border, Scallop bottom via SVG borders */
.ag-col-sidebar {
    position: relative;
    margin-bottom: 24px;
}

.ag-cart-sidebar {
    background: #ffffff;
    border-radius: 12px 12px 0 0;
    border: 1.5px solid #00c4cc;
    /* Cyan border */
    border-bottom: none;
    padding: 24px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
}

/* In addition to border, to support wavy bottom properly in next step */
.ag-cart-sidebar-container {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.05));
}

.ag-cart-sidebar {
    /* If you want the bottom transparent scallop trick: */
    /* It's more stable to just use border-radius for cross-browser, but here we style exactly like image: Light cyan border */
    border-radius: 12px 12px 12px 12px;
    /* We'll refine the scallop with an SVG mask if needed but rounded borders work nicely for now, let's add the mask pattern */
    /* mask-image: radial-gradient(circle at 10px 100%, transparent 10px, black 11.5px); */
    /* mask-size: 20px 100%; */
    /* mask-repeat: repeat-x; */
}

/* Coupon Box */
.ag-coupon-box {
    margin-bottom: 24px;
}

.ag-coupon-input-wrap {
    display: flex;
    align-items: center;
    background: #f8fafc;
    /* grayish background */
    border-radius: 8px;
    padding: 4px 8px;
}

.ag-coupon-icon {
    padding-left: 8px;
    display: flex;
    color: #00c4cc;
}

.ag-coupon-input-wrap .input-text {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 10px 10px 16px;
    font-size: 15px;
    color: #00c4cc;
    /* text color same as icon */
    outline: none;
    box-shadow: none;
}

.ag-coupon-input-wrap .input-text::placeholder {
    color: #00c4cc;
}

.ag-btn-apply-coupon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #00c4cc;
    transition: transform 0.2s;
}

.ag-btn-apply-coupon:hover {
    transform: scale(1.1);
}

/* Totals Rows */
.ag-cart-totals {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 24px;
    border-top: 1px solid #f1f5f9;
}

.ag-tot-row {
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    color: #050505;
}

.ag-tot-row .ag-val {
    font-weight: 600;
    color: #050505;
}

.ag-tot-row.coupon- discount {
    color: #10b981;
}

.ag-grand-total {
    border-top: 1px solid #e2e8f0;
    padding-top: 24px;
    margin-top: 8px;
    font-size: 18px;
    font-weight: 700;
    color: #050505;
}

.ag-grand-total .ag-val {
    color: #1e40af;
    /* Blue text for total */
    font-size: 20px;
}

/* Checkout Button */
.wc-proceed-to-checkout {
    margin-top: 24px;
}

.ag-btn-checkout {
    display: block;
    width: 100%;
    background: #1e40af;
    /* Dark blue */
    color: #fff;
    text-align: center;
    padding: 14px;
    border-radius: 24px;
    /* pill shape */
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    transition: background 0.3s;
}

.ag-btn-checkout:hover {
    background: #1e3a8a;
    color: #fff;
}

.ag-security-note {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    font-size: 12px;
    color: #475569;
    line-height: 1.4;
    padding: 0 10px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ag-cart-layout {
        flex-direction: column;
    }

    .ag-cart-header {
        display: none;
    }

    .ag-cart-item {
        flex-direction: column;
        align-items: flex-start;
        position: relative;
    }

    .ag-cell-check {
        width: 100%;
        margin-bottom: 10px;
    }

    .ag-cell-price,
    .ag-cell-qty,
    .product-subtotal,
    .ag-cell-subtotal {
        width: 100%;
        text-align: left;
        margin-bottom: 8px;
        padding-left: 36px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .ag-cell-price::before {
        content: "Đơn giá: ";
        color: #64748b;
        font-weight: normal;
    }

    .ag-cell-qty::before {
        content: "Số lượng: ";
        color: #64748b;
        font-weight: normal;
    }

    .product-subtotal::before,
    .ag-cell-subtotal::before {
        content: "Thành tiền: ";
        color: #64748b;
        font-weight: normal;
    }

    .ag-cell-action {
        position: absolute;
        top: 36px;
        right: 0;
    }

    .ag-cart-page-header {
        padding: 20px;
    }

    .ag-product-name {
        width: 80% !important;
    }
}

/* Wavy bottom border hack using pseudo element mask */
.ag-cart-sidebar-wavy {
    position: relative;
}

.ag-cart-sidebar-wavy::after {
    content: "";
    position: absolute;
    bottom: -15px;
    /* adjust based on wave height */
    left: -1.5px;
    width: calc(100% + 3px);
    height: 15px;
    /* Drawing the wavy/scalloped cyan line with semi-circles transparent cutouts */
    background:
        radial-gradient(circle at 12px 14px, transparent 12px, #00c4cc 13px, #00c4cc 14.5px, #fff 15px);
    background-size: 24px 15px;
    background-repeat: repeat-x;
    background-position: bottom;
    z-index: 10;
}

/* Coupon Modal Styles */
.ag-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: none;
    /* hidden by default */
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.ag-modal.open {
    display: flex;
}

.ag-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}

.ag-modal-content {
    position: relative;
    background: #ffffff;
    width: 95%;
    max-width: 480px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    padding: 24px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.ag-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.ag-modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: #050505;
}

.ag-modal-close {
    cursor: pointer;
    line-height: 0;
    transition: transform 0.2s;
}

.ag-modal-close:hover {
    transform: scale(1.1);
}

/* Tabs */
.ag-modal-tabs {
    display: flex;
    background: #edf2f7;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 24px;
}

.ag-tab-btn {
    flex: 1;
    text-align: center;
    background: transparent;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: background 0.3s, box-shadow 0.3s;
}

.ag-tab-btn.active {
    background: #ffffff;
    color: #050505;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Modal Body */
.ag-modal-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.ag-modal-body::-webkit-scrollbar {
    width: 6px;
}

.ag-modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* Empty State */
.ag-empty-state {
    text-align: center;
    padding: 40px 20px;
}

.ag-empty-state h4 {
    margin: 16px 0 8px;
    font-size: 16px;
    color: #050505;
}

.ag-empty-state p {
    color: #64748b;
    font-size: 14px;
    margin: 0;
}

/* Coupon List Layout */
.ag-coupon-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ag-coupon-item {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    background: #f8fafc;
    transition: all 0.3s ease;
}

.ag-coupon-item.eligible {
    background: #ffffff;
    border: 1px solid #00D1FF;
    box-shadow: 0 2px 10px rgba(0, 209, 255, 0.05);
}

.ag-coupon-item.ineligible {
    opacity: 0.8;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    cursor: not-allowed;
}

.ag-c-code {
    font-size: 10px;
    font-weight: 800;
    color: #00D1FF;
    background: rgba(0, 209, 255, 0.08);
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-flex;
    margin-bottom: 4px;
    letter-spacing: 0.8px;
    border: 1px solid rgba(0, 209, 255, 0.15);
}

.ag-coupon-item.ineligible .ag-c-code {
    color: #94a3b8;
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.ag-c-main-line {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 2px;
}

.ag-c-benefit {
    font-size: 15px;
    font-weight: 700;
    color: #1e40af;
}

.ag-coupon-item.ineligible .ag-c-benefit {
    color: #94a3b8;
}

.ag-c-min-spend {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.ag-c-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
    margin-top: 2px;
}

.ag-c-conditions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.ag-c-conditions span {
    font-size: 10px;
    background: #f1f5f9;
    color: #64748b;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
}

.ag-c-error {
    margin-top: 6px;
    font-size: 11px;
    color: #ef4444;
    font-weight: 500;
    padding: 4px 10px;
    background: rgba(239, 68, 68, 0.05);
    border-radius: 4px;
}

.ag-modal-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

button.ag-qty-btn.minus,
input.ag-qty-input,
button.ag-qty-btn.plus {
    margin: 0 !important;
    padding: 0;
}

.ag-qty-controls .ag-qty-input {
    background: transparent;
}

.checkout-page-title.page-title {
    display: none !important;
}

.cart-container.container.page-wrapper.page-checkout {
    padding:  0 !important;
}
