/**
 * Cart Page Styles
 * Matches SmileOffice theme design patterns and existing UI components
 */

.CartPage {
    min-height: 80vh;
    background: #f8f9fa;
    padding: 20px 0;
}

/* Cart Container */
.cartContainer {
    max-width: calc(100% - 11vw);
    margin: 0 auto;
    padding: 0px;
}

.cartContent {
    background: white;
    border-radius: 0px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    justify-content: space-between;
}

/* Empty Cart State */
.cartEmpty {
    text-align: center;
    padding: 80px 40px;
}

.emptyCartIcon {
    margin-bottom: 30px;
}

.emptyCartIcon svg {
    width: 120px;
    height: 120px;
    stroke: #d1d5db;
}

.emptyCartTitle {
    font-family: "Heebo", sans-serif;
    font-size: 28px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 16px;
}

.emptyCartText {
    font-size: 16px;
    color: #6b7280;
    margin-bottom: 32px;
    line-height: 1.6;
}

.continueShoppingBtn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #e9455a 0%, #e9455a 100%);
    color: white;
    padding: 14px 28px;
    border-radius: 0px;
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    transition: all 0.3s ease;
}

.continueShoppingBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    color: white;
    text-decoration: none;
}

.continueShoppingBtn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.continueShoppingBtn:hover svg {
    transform: translateX(-3px);
}

/* Cart Header */
.cartHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 40px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.cartTitle {
    font-family: "Heebo", sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.cartCount {
    background: #f3f4f6;
    color: #374151;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* Cart Table */
.cartTable {
    padding: 0 40px 40px;
    width: 100%;
}

.shop_table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.shop_table th,
.shop_table td {
    padding: 20px 15px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.shop_table th {
    background: #f9fafb;
    color: #374151;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e5e7eb;
}

/* Product Cells */
.product-thumbnail {
    width: 80px;
}

.productImageWrapper {
    width: 60px;
    height: 60px;
    border-radius: 0px;
    overflow: hidden;
    background: #f3f4f6;
}

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

.product-name {
    min-width: 200px;
}

.productInfo {
    padding-right: 15px;
}

.productLink {
    color: #1f2937;
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.productLink:hover {
    color: #e9455a;
}

.productVariations {
    margin-top: 8px;
}

.productVariations .variation {
    display: block;
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 4px;
}

.productVariations .variation strong {
    color: #374151;
}

.backorder_notification {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    margin-top: 8px;
}

/* Price Display */
.priceDisplay {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.priceDisplay .amount {
    color: #e9455a;
}

.priceDisplay del {
    color: #9ca3af;
    font-size: 16px;
    margin-left: 8px;
}

/* Quantity Controls */
.quantityControls {
    display: flex;
    align-items: center;
}

.quantityControls .quantity {
    display: flex;
    align-items: center;
    border: 2px solid #e5e7eb;
    border-radius: 0px;
    background: white;
}

.quantityControls input[type="number"] {
    width: 60px;
    padding: 8px 12px;
    border: none;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    background: transparent;
}

.quantityControls input[type="number"]:focus {
    outline: none;
}

/* Subtotal Display */
.subtotalDisplay {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

/* Remove Button */
.product-remove {
    width: 50px;
}

.product-remove .remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #fef2f2;
    color: #dc2626;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s ease;
}

.product-remove .remove:hover {
    background: #dc2626;
    color: white;
    transform: scale(1.1);
}

.product-remove .remove svg {
    width: 18px;
    height: 18px;
}

/* Cart Actions */
.actions {
    background: #f9fafb;
    border-top: 2px solid #e5e7eb;
}

.cartActions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.couponField {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.couponField label {
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
}

.couponField input {
    padding: 10px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 0px;
    font-size: 14px;
    min-width: 180px;
    transition: border-color 0.3s ease;
}

.couponField input:focus {
    outline: none;
    border-color: #e9455a;
}

.couponBtn,
.updateCartBtn {
    padding: 10px 20px;
    background: #e9455a;
    color: white;
    border: none;
    border-radius: 0px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.couponBtn:hover,
.updateCartBtn:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

/* Cart Collaterals (Totals Section) */
.cartCollaterals {
    background: #f9fafb;
    padding: 40px;
    border-top: 0px solid #e5e7eb;
    min-width: 25%;
}

.cartTotals {
    max-width: 400px;
    margin-left: auto;
}

/* Cart Totals Header */
.cart_totals .totalsTitle {
    font-family: "Heebo", sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9455a;
}

/* Cart Totals Table */
.cart_totals table {
    width: 100%;
    background: white;
    border-radius: 0px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.cart_totals th,
.cart_totals td {
    padding: 15px 20px;
    border-bottom: 1px solid #f3f4f6;
}

.cart_totals th {
    background: #f8f9fa;
    font-weight: 600;
    color: #374151;
    text-align: right;
}

.cart_totals td {
    text-align: left;
    font-weight: 500;
}

.cart_totals .order-total th,
.cart_totals .order-total td {
    background: #2b292a;
    color: white;
    font-size: 18px;
    font-weight: 600;
    border-bottom: none;
}

/* Checkout Button */
.checkout-button {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, #e9455a 0%, #e9455a 100%);
    color: white;
    padding: 16px 32px;
    border: none;
    border-radius: 0px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    margin-top: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.checkout-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    color: white;
    text-decoration: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .CartPage {
        padding: 10px 0;
    }

    .cartContainer {
        padding: 0 10px;
    }

    .cartContent {
        border-radius: 0px;
    }

    .cartEmpty {
        padding: 60px 20px;
    }

    .emptyCartIcon svg {
        width: 80px;
        height: 80px;
    }

    .emptyCartTitle {
        font-size: 22px;
    }

    .cartHeader {
        padding: 20px;
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .cartTable {
        padding: 0 20px 20px;
        overflow-x: auto;
    }

    .shop_table {
        min-width: 600px;
    }

    .shop_table th,
    .shop_table td {
        padding: 15px 8px;
    }

    .cartActions {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

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

    .couponField input {
        min-width: auto;
    }

    .cartCollaterals {
        padding: 20px;
    }

    .cartTotals {
        max-width: none;
    }
}

@media (max-width: 480px) {
    /* .shop_table th:not(.product-name),
    .shop_table td:not(.product-name) {
        display: none;
    } */

    .shop_table th.product-name,
    .shop_table td.product-name {
        display: table-cell;
        width: 100%;
    }

    .shop_table tbody tr {
        display: block;
        border: 1px solid #e5e7eb;
        margin-bottom: 15px;
        border-radius: 0px;
        background: white;
    }

    .shop_table tbody td {
        /* display: block; */
        padding: 10px 15px;
        border-bottom: 1px solid #f3f4f6;
        position: relative;
    }

    .shop_table tbody td:before {
        content: attr(data-title) ": ";
        font-weight: 600;
        color: #374151;
        display: inline-block;
        min-width: 80px;
    }

    .shop_table tbody td:last-child {
        border-bottom: none;
    }

    .productImageWrapper {
        width: 50px;
        height: 50px;
        float: right;
        margin-left: 15px;
    }
}

/* Loading States */
.woocommerce-cart-form.processing {
    opacity: 0.7;
    pointer-events: none;
}

.woocommerce-cart-form.processing::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #e9455a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Animations */
.woocommerce-cart-form__cart-item {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.woocommerce-cart-form__cart-item:nth-child(1) {
    animation-delay: 0.1s;
}
.woocommerce-cart-form__cart-item:nth-child(2) {
    animation-delay: 0.2s;
}
.woocommerce-cart-form__cart-item:nth-child(3) {
    animation-delay: 0.3s;
}
.woocommerce-cart-form__cart-item:nth-child(4) {
    animation-delay: 0.4s;
}
.woocommerce-cart-form__cart-item:nth-child(5) {
    animation-delay: 0.5s;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Success Messages */
.woocommerce-message {
    background: #ecfdf5;
    border: 1px solid #10b981;
    color: #065f46;
    padding: 12px 20px;
    border-radius: 0px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.woocommerce-message::before {
    content: "✓";
    font-weight: bold;
    color: #10b981;
}

/* Error Messages */
.woocommerce-error {
    background: #fef2f2;
    border: 1px solid #dc2626;
    color: #991b1b;
    padding: 12px 20px;
    border-radius: 0px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.woocommerce-error::before {
    content: "⚠";
    font-weight: bold;
    color: #dc2626;
}

/* WooCommerce Addon Fields in Cart */
.cart_item .wapf-cart-item-data,
.cart_item .variation-data,
dl.variation {
    margin-top: 8px !important;
    padding: 8px 0;
    border-top: 1px solid #eee;
    font-size: 14px;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.cart_item .wapf-cart-item-data dt,
.cart_item .variation-data dt,
dl.variation dt {
    font-weight: 500 !important;
    color: #2b2a29 !important;
    margin-bottom: 4px;
    font-family: Heebo !important;
    display: inline-block !important;
}

.cart_item .wapf-cart-item-data dd,
.cart_item .variation-data dd,
dl.variation dd {
    margin: 0 0 8px 0 !important;
    color: #666 !important;
    font-family: Heebo !important;
    display: inline !important;
}

/* Ensure addon fields are visible */
.cart_item p.wapf-cart-item-meta,
.cart_item .wapf-field-value {
    display: block !important;
    margin-top: 8px;
    font-size: 13px;
    color: #6b7280;
}

.cart_item .wapf-field-label {
    font-weight: 500;
    color: #374151;
    margin-left: 5px;
}

/* WAPF specific cart styling */
.wapf-cart-item-data {
    display: block !important;
    margin-top: 8px !important;
}

.wapf-cart-item-data dt {
    font-weight: 600 !important;
    color: #374151 !important;
    margin-bottom: 2px !important;
    font-family: "Heebo", sans-serif !important;
}

.wapf-cart-item-data dd {
    margin: 0 0 6px 0 !important;
    color: #6b7280 !important;
    font-family: "Heebo", sans-serif !important;
}

/* Forced addon display fallback */
.forced-addon-display {
    margin-top: 8px;
    padding: 8px 0;
    border-top: 1px solid #eee;
}

.forced-addon-display .addon-field-display {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 4px;
}

.forced-addon-display .addon-field-display strong {
    color: #374151;
    font-family: "Heebo", sans-serif;
}

.productInfo .productVariations:nth-of-type(2) {
    margin-top: 0px;
}

/* ==========================================================================
   Cart totals - shipping row
   ========================================================================== */

/* Totals table as a grid, so the shipping row can span the full width */
.CartPage .cart_totals .shop_table {
	display: grid;
	grid-template-columns: auto 1fr;
	min-width: 0;
	overflow: visible;
}

.CartPage .cart_totals .shop_table tbody,
.CartPage .cart_totals .shop_table tbody tr {
	display: contents;
}

.CartPage .cart_totals .shop_table th,
.CartPage .cart_totals .shop_table td {
	display: flex;
	align-items: center;
	padding: 15px 20px;
}

.CartPage .cart_totals .shop_table td {
	justify-content: flex-end;
}

/* Low specificity on purpose - the dark total row keeps its own background */
.cart_totals td {
	background: #ffffff;
}

/* Shipping row: title on its own line, methods below it */
.CartPage .cart_totals .shop_table .woocommerce-shipping-totals th,
.CartPage .cart_totals .shop_table .woocommerce-shipping-totals td {
	grid-column: 1 / -1;
}

.CartPage .cart_totals .shop_table .woocommerce-shipping-totals td {
	display: block;
	text-align: right;
}

.cart_totals .woocommerce-shipping-methods {
	margin: 0;
	padding: 0;
	list-style: none;
}

.cart_totals .woocommerce-shipping-methods li {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 10px;
}

.cart_totals .woocommerce-shipping-methods li:last-child {
	margin-bottom: 0;
}

.cart_totals .woocommerce-shipping-methods input[type="radio"] {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	margin: 0;
	accent-color: #e9455a;
	cursor: pointer;
}

/* Method name on the right, its price on the left - like the other amounts */
.cart_totals .woocommerce-shipping-methods label {
	display: flex;
	flex: 1;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 4px 10px;
	font-size: 15px;
	font-weight: 400;
	line-height: 22px;
	color: #374151;
	cursor: pointer;
}

.cart_totals .woocommerce-shipping-methods label .amount {
	font-size: 15px;
	font-weight: 600;
	color: #1f2937;
	white-space: nowrap;
}

.cart_totals .woocommerce-shipping-destination {
	margin: 12px 0 0;
	padding-top: 12px;
	border-top: 1px solid #f3f4f6;
	font-size: 13px;
	font-weight: 400;
	line-height: 20px;
	color: #6b7280;
}
