/* Cart Modal Styles */

/* Prevent body scroll when modal is open */
body.cart-modal-open {
    overflow: hidden;
}

/* Backdrop */
#cart-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#cart-modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
#cart-modal {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: auto;
    width: 580px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 120px);
    background: #FFFFFF;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

#cart-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Modal Header */
.cart-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #E2E8E4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.cart-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1b1b1b;
}

.close-cart-modal {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    background: #F6F8F7;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.close-cart-modal:hover {
    background: #E2E8E4;
}

/* Modal Body */
.cart-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    max-height: 315px;
}

/* Cart Items Container */
#cart-items-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Cart Item */
.cart-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: #F6F8F7;
    border-radius: 16px;
    transition: background-color 0.2s ease;
}

.cart-item:hover {
    background: #ecf0ed;
}

/* Line Clamp Utility */
.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Modal Footer */
.cart-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #E2E8E4;
    flex-shrink: 0;
}

.cart-subtotal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #E2E8E4;
}

.cart-subtotal-label {
    font-size: 16px;
    font-weight: 600;
    color: #A0A5A2;
}

.cart-subtotal-amount {
    font-size: 20px;
    font-weight: 700;
    color: #063A28;
}

/* Cart Actions */
.cart-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-action-btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Cart Count Pulse Animation */
@keyframes cartCountPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.cart-count-pulse {
    animation: cartCountPulse 0.6s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    #cart-modal {
        position: fixed;
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        max-height: 80vh;
        border-radius: 24px 24px 0 0;
        transform: translateY(100%);
    }

    #cart-modal.active {
        transform: translateY(0);
    }

    .cart-actions {
        flex-direction: column;
    }

    .cart-action-btn {
        width: 100%;
    }
}

/* Loading Spinner */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Scrollbar Styling */
.cart-modal-body::-webkit-scrollbar {
    width: 6px;
}

.cart-modal-body::-webkit-scrollbar-track {
    background: #F6F8F7;
    border-radius: 10px;
}

.cart-modal-body::-webkit-scrollbar-thumb {
    background: #A0A5A2;
    border-radius: 10px;
}

.cart-modal-body::-webkit-scrollbar-thumb:hover {
    background: #5F6160;
}

/* =========================================
   WooCommerce Cart Page (Block Based)
   ========================================= */

/* Main Container */
.wp-block-woocommerce-cart {
    /* Theme Variables Integration */
    --cart-primary: var(--primary-color, #063A28);
    --cart-secondary: var(--secondary-color, #042b1e);
    
    --cart-text: #1b1b1b;
    --cart-border: #E2E8E4;
    --cart-bg-light: #F6F8F7;
    --cart-bg-white: #FFFFFF;
    --cart-danger: #dc2626;
    
    font-family: inherit;
    color: var(--cart-text);
    margin-top: 2rem;
}

/* Layout Grid - Force Side by Side */
.wc-block-components-sidebar-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 40px;
    align-items: start;
    margin-top: 40px;
}

@media (max-width: 1024px) {
    .wc-block-components-sidebar-layout {
        display: flex;
        flex-direction: column;
    }
    
    .wc-block-cart__sidebar {
        width: 100%;
        position: static;
    }
}

/* Main Cart Area (Left Side) */
.wc-block-components-main {
    background: var(--cart-bg-white);
    border-radius: 24px;
    border: 1px solid var(--cart-border);
    overflow: hidden;
    width: 60%!important;
    padding-left: unset!important;
}

/* Cart Table */
.wc-block-cart-items {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

/* Table Header */
.wc-block-cart-items__header {
    background-color: var(--cart-bg-light);
    border-bottom: 1px solid var(--cart-border);
}

.wc-block-cart-items__header th {
    padding: 20px 24px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    text-align: left;
}

/* Cart Item Rows */
.wc-block-cart-items__row {
    border-bottom: 1px solid var(--cart-border);
    transition: background-color 0.2s ease;
}

.wc-block-cart-items__row:last-child {
    border-bottom: none;
}

.wc-block-cart-items__row:hover {
    background-color: #fafafa;
}

/* Product Image */
.wc-block-cart-item__image {
    width: 120px;
    padding: 24px;
    vertical-align: top;
}

.wc-block-cart-item__image img {
    border-radius: 16px;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Product Details */
.wc-block-cart-item__product {
    padding: 24px 24px 24px 0;
    vertical-align: top;
}

.wc-block-cart-item__wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wc-block-components-product-name {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--cart-text);
    text-decoration: none;
    transition: color 0.2s;
}

.wc-block-components-product-name:hover {
    color: var(--cart-primary);
}

/* Price */
.wc-block-cart-item__prices {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wc-block-components-product-price__regular {
    color: #999;
    text-decoration: line-through;
    font-size: 0.9em;
}

.wc-block-components-product-price__value {
    color: var(--cart-primary);
    font-weight: 700;
}

.wc-block-components-sale-badge {
    display: inline-block;
    background: #e6f7ed; /* Light green background, could use opacity of primary */
    color: var(--cart-primary);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    width: fit-content;
}

/* Quantity Selector & Remove */
.wc-block-cart-item__quantity {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.wc-block-components-quantity-selector {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--cart-border);
    border-radius: 12px;
    padding: 4px;
    background: var(--cart-bg-light);
}

.wc-block-components-quantity-selector__input {
    width: 44px;
    height: 32px;
    text-align: center;
    border: none;
    background: transparent;
    font-weight: 600;
    font-size: 15px;
    color: var(--cart-text);
    padding: 0;
    appearance: none;
    -moz-appearance: textfield;
}

.wc-block-components-quantity-selector__button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    color: var(--cart-text);
    transition: all 0.2s;
    font-size: 16px;
    line-height: 1;
}

.wc-block-components-quantity-selector__button:hover:not(:disabled) {
    background: var(--cart-primary);
    color: #fff;
}

.wc-block-components-quantity-selector__button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wc-block-cart-item__remove-link {
    background: none;
    border: none;
    padding: 0;
    color: #999;
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
}

.wc-block-cart-item__remove-link:hover {
    color: var(--cart-danger);
    text-decoration: none;
}

/* Total Column */
.wc-block-cart-item__total {
    padding: 24px;
    vertical-align: top;
    text-align: right;
    font-weight: 700;
    font-size: 18px;
    color: var(--cart-text);
    white-space: nowrap;
}

/* Sidebar (Right Side) */
.wc-block-cart__sidebar {
    position: sticky;
    top: 40px;
}

.wp-block-woocommerce-cart-order-summary-block {
    background: var(--cart-bg-white);
    border-radius: 24px;
    padding: 32px;
    border: 1px solid var(--cart-border);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

.wc-block-cart__totals-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--cart-text);
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--cart-border);
}

/* Totals Rows */
.wc-block-components-totals-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 15px;
}

.wc-block-components-totals-item__label {
    color: #666;
}

.wc-block-components-totals-item__value {
    font-weight: 600;
    color: var(--cart-text);
}

/* Footer Total */
.wc-block-components-totals-footer-item {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid var(--cart-border);
}

.wc-block-components-totals-footer-item .wc-block-components-totals-item__label {
    font-size: 18px;
    font-weight: 700;
    color: var(--cart-text);
}

.wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
    font-size: 26px;
    font-weight: 800;
    color: var(--cart-primary);
}

/* Proceed to Checkout Button */
.wc-block-cart__submit {
    margin-top: 32px;
}

.wc-block-cart__submit-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 18px 32px;
    background: var(--cart-primary) !important;
    color: #fff !important;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 600;
    text-transform: none;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1); 
    border: none;
    cursor: pointer;
}

.wc-block-cart__submit-button:hover {
    background: var(--cart-secondary) !important; /* Use secondary for hover */
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.wc-block-cart__submit-button:active {
    transform: translateY(0);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .wc-block-cart-items__header {
        display: none;
    }
    
    .wc-block-cart-item__image {
        display: table-cell;
        padding: 16px 8px;
        width: 80px;
    }

    .wc-block-cart-item__product {
        padding: 16px 8px;
    }
    
    .wc-block-cart-item__total {
        display: block;
        padding: 0 8px 16px;
        text-align: left;
    }
}

/* =========================================
   WooCommerce Checkout Page (Block Based)
   ========================================= */

/* Use same variable scope as cart if checkout is separate block */
.wp-block-woocommerce-checkout {
    --checkout-primary: var(--primary-color, #063A28);
    --checkout-secondary: var(--secondary-color, #042b1e);
    --checkout-text: #1b1b1b;
    --checkout-border: #E2E8E4;
    --checkout-bg-light: #F6F8F7;
    --checkout-bg-white: #FFFFFF;
    
    font-family: inherit;
    color: var(--checkout-text);
    margin-top: 2rem;
}

/* Main Layout - Side by Side */
.wc-block-checkout {
    margin-top: 40px;
}

@media (max-width: 1024px) {
    .wc-block-checkout {
        display: flex;
        flex-direction: column;
    }
}

/* Left Side: Forms */
.wc-block-checkout__main {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Sections (Contact, Shipping, Billing, Payment) */
.wc-block-components-checkout-step {
    background: var(--checkout-bg-white);
    border-radius: 24px;
    border: 1px solid var(--checkout-border);
    padding: 32px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

/* Headings */
.wc-block-components-checkout-step__title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--checkout-text);
}

.wc-block-components-checkout-step__description {
    color: #666;
    margin-bottom: 24px;
    font-size: 14px;
}

/* Form Fields */
.wc-block-components-text-input,
.wc-block-components-combobox-control,
.wc-blocks-components-select {
    margin-bottom: 20px;
}

.wc-block-components-text-input input,
.wc-blocks-components-select__select {
    width: 100%;
    height: 52px;
    border: 1px solid var(--checkout-border);
    background-color: var(--checkout-bg-light);
    border-radius: 12px;
    padding: 0 16px;
    font-size: 15px;
    color: var(--checkout-text);
    transition: all 0.2s;
}

.wc-block-components-text-input input:focus,
.wc-blocks-components-select__select:focus {
    border-color: var(--checkout-primary);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(6, 58, 40, 0.1); /* Primary color with opacity */
    outline: none;
}

.wc-block-components-text-input label,
.wc-blocks-components-select__label {
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    display: block;
}

/* Floating label adjustments if theme uses them, but based on snippet simple labels are safer. 
   If using the floating label style from WC blocks: */
.wc-block-components-text-input.is-active label {
    transform: translateY(-24px) scale(0.85);
    background: transparent;
}

/* Right Side: Order Summary */
.wc-block-checkout__sidebar {
    background: var(--checkout-bg-white);
    border-radius: 24px;
    padding: 32px;
    border: 1px solid var(--checkout-border);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
    position: sticky;
    top: 40px;
}

.wc-block-components-checkout-order-summary__title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--checkout-border);
    font-size: 18px;
    font-weight: 700;
}

.wc-block-components-order-summary-item {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--checkout-border);
}

.wc-block-components-order-summary-item:last-child {
    border-bottom: none;
}

.wc-block-components-order-summary-item__quantity {
    background: #666;
    color: #fff;
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 20px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom-left-radius: 8px;
}

.wc-block-components-order-summary-item__description {
    flex: 1;
}

.wc-block-components-product-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 4px;
}

/* Payment Methods */
.wc-block-components-radio-control {
    background: var(--checkout-bg-light);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.wc-block-components-radio-control:hover {
    border-color: #ccc;
}

.wc-block-components-radio-control__input:checked + .wc-block-components-radio-control__label {
    color: var(--checkout-primary);
    font-weight: 700;
}

/* Place Order Button */
.wc-block-components-checkout-place-order-button {
    width: 100%;
    padding: 18px;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 700;
    background-color: var(--checkout-primary) !important;
    color: white !important;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    margin-top: 24px;
}

.wc-block-components-checkout-place-order-button:hover {
    background-color: var(--checkout-secondary) !important;
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

/* Return to Cart Link */
.wc-block-components-checkout-return-to-cart-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    color: #666;
    font-weight: 500;
    text-decoration: none;
    font-size: 15px;
    transition: color 0.2s;
}

.wc-block-components-checkout-return-to-cart-button:hover {
    color: var(--checkout-text);
}

/* Notices/Errors */
.wc-block-components-notice-banner.is-error {
    background-color: #fef2f2;
    border: 1px solid #fee2e2;
    color: #991b1b;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
}
