/**
 * ============================================================================
 * AMITRAFLEX - CART & CHECKOUT STYLES
 * ============================================================================
 */

/* ============================================================================
 * PAGE TITLES - CART & CHECKOUT
 * ============================================================================ */

/* Cart Page Title */
.woocommerce-cart .entry-title,
.woocommerce-cart .wp-block-post-title,
.woocommerce-cart h1.wp-block-post-title,
.woocommerce-cart .page-title,
.woocommerce-cart .woocommerce-products-header__title,
.woocommerce-cart .et_pb_title_container h1 {
    text-align: center !important;
    width: 100% !important;
    display: block !important;
    font-size: clamp(32px, 5vw, 48px) !important;
    font-weight: 700 !important;
    color: #212121 !important;
    margin: 0 auto 16px !important;
    padding: 10px 20px 20px !important;
    position: relative !important;
    letter-spacing: -0.5px !important;
}

/* Checkout Page Title */
.woocommerce-checkout .entry-title,
.woocommerce-checkout .wp-block-post-title,
.woocommerce-checkout h1.wp-block-post-title,
.woocommerce-checkout .page-title,
.woocommerce-checkout .woocommerce-products-header__title,
.woocommerce-checkout .et_pb_title_container h1 {
    text-align: center !important;
    width: 100% !important;
    display: block !important;
    font-size: clamp(32px, 5vw, 48px) !important;
    font-weight: 700 !important;
    color: #212121 !important;
    margin: 0 auto 16px !important;
    padding: 10px 20px 20px !important;
    position: relative !important;
    letter-spacing: -0.5px !important;
}

/* Underline accent for titles */
.woocommerce-cart .entry-title::after,
.woocommerce-cart .wp-block-post-title::after,
.woocommerce-cart h1.wp-block-post-title::after,
.woocommerce-checkout .entry-title::after,
.woocommerce-checkout .wp-block-post-title::after,
.woocommerce-checkout h1.wp-block-post-title::after,
.woocommerce-cart .et_pb_title_container h1::after,
.woocommerce-checkout .et_pb_title_container h1::after {
    content: '' !important;
    display: block !important;
    width: 80px !important;
    height: 4px !important;
    background: linear-gradient(90deg, #ff8057 0%, #ff6b3d 100%) !important;
    margin: 16px auto 0 !important;
    border-radius: 4px !important;
}

/* Center titles in Divi */
.woocommerce-cart .et_pb_title_container,
.woocommerce-checkout .et_pb_title_container {
    text-align: center !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Subtitle / Description under title */
.woocommerce-cart .entry-title + p,
.woocommerce-checkout .entry-title + p {
    text-align: center !important;
    color: #757575 !important;
    font-size: 16px !important;
    margin-bottom: 32px !important;
}

/* Responsive Title Adjustments */
@media (max-width: 768px) {
    .woocommerce-cart .entry-title,
    .woocommerce-cart .wp-block-post-title,
    .woocommerce-cart h1.wp-block-post-title,
    .woocommerce-cart .et_pb_title_container h1,
    .woocommerce-checkout .entry-title,
    .woocommerce-checkout .wp-block-post-title,
    .woocommerce-checkout h1.wp-block-post-title,
    .woocommerce-checkout .et_pb_title_container h1 {
        padding: 32px 16px 16px !important;
        margin-bottom: 12px !important;
    }
    
    .woocommerce-cart .entry-title::after,
    .woocommerce-cart .wp-block-post-title::after,
    .woocommerce-cart h1.wp-block-post-title::after,
    .woocommerce-checkout .entry-title::after,
    .woocommerce-checkout .wp-block-post-title::after,
    .woocommerce-checkout h1.wp-block-post-title::after,
    .woocommerce-cart .et_pb_title_container h1::after,
    .woocommerce-checkout .et_pb_title_container h1::after {
        width: 60px !important;
        height: 3px !important;
        margin-top: 12px !important;
    }
}

@media (max-width: 480px) {
    .woocommerce-cart .entry-title,
    .woocommerce-cart .wp-block-post-title,
    .woocommerce-cart h1.wp-block-post-title,
    .woocommerce-cart .et_pb_title_container h1,
    .woocommerce-checkout .entry-title,
    .woocommerce-checkout .wp-block-post-title,
    .woocommerce-checkout h1.wp-block-post-title,
    .woocommerce-checkout .et_pb_title_container h1 {
        padding: 24px 12px 12px !important;
    }
}

/* Hide product description in cart */
.wc-block-components-product-metadata__description {
    display: none !important;
}

/* ============================================================================
 * THEME COLOR VARIABLES
 * ============================================================================ */

:root {
    --theme-primary: #ff8057;
    --theme-primary-hover: #ff6b3d;
    --theme-primary-light: #fff5f2;
    --theme-primary-dark: #e85a30;
}

/* ============================================================================
 * PRIMARY BUTTONS - Proceed to Checkout & Place Order
 * ============================================================================ */

/* Proceed to Checkout Button */
.wc-block-cart__submit-button,
.wp-block-woocommerce-proceed-to-checkout-block .wc-block-components-button,
.wc-block-components-checkout-place-order-button {
    background: var(--theme-primary) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 16px 32px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 16px rgba(255, 128, 87, 0.3) !important;
}

.wc-block-cart__submit-button:hover,
.wp-block-woocommerce-proceed-to-checkout-block .wc-block-components-button:hover,
.wc-block-components-checkout-place-order-button:hover {
    background: var(--theme-primary-hover) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 24px rgba(255, 128, 87, 0.4) !important;
}

.wc-block-cart__submit-button:active,
.wp-block-woocommerce-proceed-to-checkout-block .wc-block-components-button:active,
.wc-block-components-checkout-place-order-button:active {
    transform: translateY(0) !important;
}

/* Checkout Place Order Button - Responsive Width */
.wc-block-components-button.wp-element-button.wc-block-components-checkout-place-order-button.contained {
    width: 50% !important;
    max-width: 50% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    display: block !important;
}

/* Mobile: Full Width */
@media (max-width: 768px) {
    .wc-block-components-button.wp-element-button.wc-block-components-checkout-place-order-button.contained {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ============================================================================
 * SECONDARY BUTTONS - Apply Coupon, Update Cart
 * ============================================================================ */

.wc-block-components-totals-coupon__button,
.wc-block-components-button:not(.wc-block-cart__submit-button):not(.wc-block-components-checkout-place-order-button) {
    background: transparent !important;
    color: var(--theme-primary) !important;
    border: 2px solid var(--theme-primary) !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
}

.wc-block-components-totals-coupon__button:hover {
    background: var(--theme-primary) !important;
    color: #ffffff !important;
}

/* ============================================================================
 * LINKS - Theme Color
 * ============================================================================ */

.woocommerce-cart a:not(.amitraflex-account-dropdown__item),
.woocommerce-checkout a:not(.amitraflex-account-dropdown__item) {
    color: var(--theme-primary);
    transition: color 0.2s ease;
}

.woocommerce-cart a:not(.amitraflex-account-dropdown__item):hover,
.woocommerce-checkout a:not(.amitraflex-account-dropdown__item):hover {
    color: var(--theme-primary-hover);
}

/* Preserve account dropdown menu styling */
.woocommerce-cart .amitraflex-account-dropdown__item,
.woocommerce-checkout .amitraflex-account-dropdown__item,
.amitraflex-account-dropdown__item {
    color: rgba(255, 255, 255, 0.9) !important;
}

.woocommerce-cart .amitraflex-account-dropdown__item:hover,
.woocommerce-checkout .amitraflex-account-dropdown__item:hover,
.amitraflex-account-dropdown__item:hover {
    color: #ffffff !important;
}

/* Product Name Links */
.wc-block-cart-item__product-name,
.wc-block-components-product-name {
    color: #212121 !important;
    font-weight: 600 !important;
    text-decoration: none !important;
}

.wc-block-cart-item__product-name:hover,
.wc-block-components-product-name:hover {
    color: var(--theme-primary) !important;
}

/* ============================================================================
 * QUANTITY SELECTOR
 * ============================================================================ */

.wc-block-components-quantity-selector {
    border: 2px solid #e0e0e0 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
}

.wc-block-components-quantity-selector:focus-within {
    border-color: var(--theme-primary) !important;
    box-shadow: 0 0 0 3px rgba(255, 128, 87, 0.15) !important;
}

.wc-block-components-quantity-selector__button {
    background: transparent !important;
    color: #424242 !important;
    border: none !important;
    transition: all 0.2s ease !important;
}

.wc-block-components-quantity-selector__button:hover {
    background: var(--theme-primary) !important;
    color: #ffffff !important;
}

/* ============================================================================
 * FORM INPUTS - Focus State
 * ============================================================================ */

.wc-block-components-text-input input:focus,
.wc-block-components-textarea textarea:focus,
.wc-block-components-country-input select:focus,
.wc-block-components-state-input select:focus {
    border-color: var(--theme-primary) !important;
    box-shadow: 0 0 0 3px rgba(255, 128, 87, 0.15) !important;
    outline: none !important;
}

/* ============================================================================
 * CHECKBOX & RADIO - Theme Color
 * ============================================================================ */

.wc-block-components-checkbox__input:checked,
.wc-block-components-radio-control__input:checked {
    background-color: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
}

.wc-block-components-checkbox__input:focus,
.wc-block-components-radio-control__input:focus {
    box-shadow: 0 0 0 3px rgba(255, 128, 87, 0.2) !important;
}

/* Radio Control Selected Option */
.wc-block-components-radio-control__option-checked,
.wc-block-components-radio-control-accordion-option--checked {
    border-color: var(--theme-primary) !important;
    background: var(--theme-primary-light) !important;
}

/* ============================================================================
 * TOTALS & PRICING - Theme Accent
 * ============================================================================ */

.wc-block-components-totals-footer-item__value,
.wc-block-components-order-summary-item__total-price {
    color: var(--theme-primary) !important;
    font-weight: 700 !important;
}

/* Sale Badge - Green for Savings */
.wc-block-components-sale-badge,
.wc-block-components-product-badge.wc-block-components-sale-badge {
    background: linear-gradient(135deg, #00c853 0%, #00e676 100%) !important;
    color: #ffffff !important;
    border-radius: 6px !important;
    padding: 4px 10px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    box-shadow: 0 2px 8px rgba(0, 200, 83, 0.3) !important;
}

/* ============================================================================
 * COUPON TOGGLE LINK
 * ============================================================================ */

.wc-block-components-totals-coupon__button-text,
.wc-block-components-totals-coupon-link {
    color: var(--theme-primary) !important;
    font-weight: 600 !important;
}

.wc-block-components-totals-coupon__button-text:hover,
.wc-block-components-totals-coupon-link:hover {
    color: var(--theme-primary-hover) !important;
}

/* ============================================================================
 * REMOVE ITEM LINK
 * ============================================================================ */

.wc-block-cart-item__remove-link {
    color: #9e9e9e !important;
    font-size: 13px !important;
    transition: color 0.2s ease !important;
}

.wc-block-cart-item__remove-link:hover {
    color: #f44336 !important;
}

/* ============================================================================
 * EXPRESS CHECKOUT DIVIDER
 * ============================================================================ */

.wc-block-components-express-payment-continue-rule::before,
.wc-block-components-express-payment-continue-rule::after {
    background: #e0e0e0 !important;
}

/* ============================================================================
 * NOTICE BANNERS
 * ============================================================================ */

.wc-block-components-notice-banner.is-success {
    border-left-color: var(--theme-primary) !important;
    background: var(--theme-primary-light) !important;
}

/* ============================================================================
 * SHIPPING METHOD SELECTED
 * ============================================================================ */

.wc-block-components-shipping-rates-control__package__description--selected {
    color: var(--theme-primary) !important;
}

/* ============================================================================
 * LOADING SPINNER
 * ============================================================================ */

.wc-block-components-spinner {
    border-top-color: var(--theme-primary) !important;
}

/* ============================================================================
 * STICKY ORDER SUMMARY SIDEBAR
 * ============================================================================ */

/* Checkout Sidebar - Sticky */
.wc-block-checkout__sidebar,
.wp-block-woocommerce-checkout-order-summary-block {
    position: sticky !important;
    position: -webkit-sticky !important;
    top: 100px !important;
    align-self: flex-start !important;
    height: fit-content !important;
}

/* Cart Sidebar - Sticky */
.wc-block-cart__sidebar,
.wp-block-woocommerce-cart-totals-block {
    position: sticky !important;
    position: -webkit-sticky !important;
    top: 100px !important;
    align-self: flex-start !important;
    height: fit-content !important;
}

/* Ensure parent containers allow sticky to work */
.wc-block-checkout__main,
.wc-block-cart__main {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
}

/* Main content area */
.wc-block-checkout__main > .wc-block-checkout__fields,
.wc-block-cart__main > .wc-block-cart__items {
    flex: 1 1 60% !important;
    min-width: 0 !important;
}

/* Sidebar area */
.wc-block-checkout__main > .wc-block-checkout__sidebar,
.wc-block-cart__main > .wc-block-cart__sidebar {
    flex: 0 0 380px !important;
    max-width: 380px !important;
}

/* Fix for Divi page container overflow */
.woocommerce-checkout #page-container,
.woocommerce-cart #page-container {
    overflow-x: clip !important;
}

/* Responsive - Disable sticky on mobile */
@media (max-width: 991px) {
    .wc-block-checkout__sidebar,
    .wp-block-woocommerce-checkout-order-summary-block,
    .wc-block-cart__sidebar,
    .wp-block-woocommerce-cart-totals-block {
        position: relative !important;
        top: 0 !important;
    }
    
    .wc-block-checkout__main,
    .wc-block-cart__main {
        flex-direction: column !important;
    }
    
    .wc-block-checkout__main > .wc-block-checkout__sidebar,
    .wc-block-cart__main > .wc-block-cart__sidebar {
        flex: 1 1 100% !important;
        max-width: 100% !important;
    }
}

/* ============================================================================
 * PAGE BOTTOM SPACING
 * ============================================================================ */

/* Checkout Page Bottom Spacing */
.woocommerce-checkout .wc-block-checkout,
.woocommerce-checkout .wp-block-woocommerce-checkout {
    margin-bottom: 40px !important;
}

.woocommerce-checkout #main-content,
.woocommerce-checkout .entry-content {
    padding-bottom: 60px !important;
}

/* Cart Page Bottom Spacing */
.woocommerce-cart .wc-block-cart,
.woocommerce-cart .wp-block-woocommerce-cart {
    margin-bottom: 40px !important;
}


/* Responsive Bottom Spacing */
@media (max-width: 768px) {
    .woocommerce-checkout .wc-block-checkout,
    .woocommerce-checkout .wp-block-woocommerce-checkout,
    .woocommerce-cart .wc-block-cart,
    .woocommerce-cart .wp-block-woocommerce-cart {
        padding-bottom: 60px !important;
        margin-bottom: 30px !important;
    }
    
    .woocommerce-checkout #main-content,
    .woocommerce-checkout .entry-content,
    .woocommerce-cart #main-content,
    .woocommerce-cart .entry-content {
        padding-bottom: 40px !important;
    }
}

/* ==========================================================================
   CHECKOUT GOOGLE LOGIN STYLES
   ========================================================================== */

.amitraflex-checkout-social {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.amitraflex-checkout-social__divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin-bottom: 1rem;
    color: #666;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.amitraflex-checkout-social__divider::before,
.amitraflex-checkout-social__divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.1), transparent);
}

.amitraflex-checkout-social__divider span {
    padding: 0 1rem;
    white-space: nowrap;
}

.amitraflex-checkout-social__button {
    display: flex;
    justify-content: center;
    margin-bottom: 0.75rem;
}

/* Style the Nextend Social Login Google button */
.amitraflex-checkout-social__button .nsl-container {
    width: 100%;
    max-width: 100%;
}

.amitraflex-checkout-social__button .nsl-container-buttons {
    display: flex;
    justify-content: center;
}

.amitraflex-checkout-social__button .nsl-button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0.875rem 1.5rem !important;
    background: #ffffff !important;
    border: 1px solid #dadce0 !important;
    border-radius: 12px !important;
    font-family: inherit !important;
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    color: #1f1f22 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

.amitraflex-checkout-social__button .nsl-button:hover {
    background: #f8f9fa !important;
    border-color: #c6c9cc !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12) !important;
    transform: translateY(-1px);
}

.amitraflex-checkout-social__button .nsl-button-icon {
    width: 20px !important;
    height: 20px !important;
    margin-right: 0.75rem !important;
}

.amitraflex-checkout-social__button .nsl-button-label {
    font-size: 0.95rem !important;
    font-weight: 500 !important;
}

.amitraflex-checkout-social__button .nsl-button-label b,
.amitraflex-checkout-social__button .nsl-button-label strong {
    font-weight: 600 !important;
}

.amitraflex-checkout-social__hint {
    margin: 0;
    text-align: center;
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
}

/* Responsive styles */
@media (max-width: 768px) {
    .amitraflex-checkout-social {
        margin-top: 1.25rem;
        padding-top: 1.25rem;
    }
    
    .amitraflex-checkout-social__button .nsl-button {
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem !important;
    }
}

/* ==========================================================================
   CART ENHANCEMENTS - QUANTITY ANIMATIONS & SAVE FOR LATER
   ========================================================================== */

/* Quantity Update Animation */
.amitraflex-quantity-updating {
    animation: amitraflex-quantity-update 0.5s ease;
    background: rgba(255, 128, 87, 0.05) !important;
    transition: background 0.3s ease !important;
}

.amitraflex-quantity-pulse {
    animation: amitraflex-quantity-pulse 0.3s ease;
}

@keyframes amitraflex-quantity-update {
    0% {
        transform: scale(1);
        background: rgba(255, 128, 87, 0.1);
    }
    50% {
        transform: scale(1.02);
        background: rgba(255, 128, 87, 0.15);
    }
    100% {
        transform: scale(1);
        background: rgba(255, 128, 87, 0.05);
    }
}

@keyframes amitraflex-quantity-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.01);
    }
}

/* Save for Later Button */
.amitraflex-save-for-later {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    margin-left: 12px;
    color: #666;
    font-size: 13px;
    text-decoration: none;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: all 0.2s ease;
    background: #fff;
}

.amitraflex-save-for-later:hover {
    color: var(--theme-primary);
    border-color: var(--theme-primary);
    background: var(--theme-primary-light);
    transform: translateY(-1px);
}

.amitraflex-save-for-later svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
}

.amitraflex-save-for-later.amitraflex-saved {
    color: var(--theme-primary);
    border-color: var(--theme-primary);
    background: var(--theme-primary-light);
}

.amitraflex-save-for-later.amitraflex-saved svg {
    fill: currentColor;
    stroke: none;
}

/* Cart Message Notifications */
.amitraflex-cart-message {
    position: fixed;
    top: 100px;
    right: 20px;
    padding: 14px 20px;
    background: #fff;
    border-left: 4px solid var(--theme-primary);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    max-width: 350px;
    font-size: 14px;
    font-weight: 500;
    color: #212121;
}

.amitraflex-cart-message--show {
    opacity: 1;
    transform: translateX(0);
}

.amitraflex-cart-message--success {
    border-left-color: #4caf50;
}

.amitraflex-cart-message--error {
    border-left-color: #f44336;
}

@media (max-width: 768px) {
    .amitraflex-cart-message {
        right: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
        transform: translateY(-100px);
    }
    
    .amitraflex-cart-message--show {
        transform: translateY(0);
    }
}
