/**
 * FabCrush Checkout Optimization Styles
 * 
 * Modern, clean styling for the integrated cart-checkout experience
 * Following FabCrush design system with purple gradient theme
 * 
 * @package FabCrush
 * @version 1.0.0
 */

/* ========================================================================
   Hero Section with Progress Indicator - Sticky Header
   ======================================================================== */

/* ⚔️ SAMURAI UX: Sticky hero matching AI marketplace gallery approach */
.fabcrush-checkout-hero {
    position: sticky !important;
    top: var(--sticky-offset, 0px) !important; /* Dynamic offset based on header height */
    z-index: 999 !important; /* Below header (1000) but above content */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    padding: 24px 0 !important;
    margin: 0 0 32px 0 !important;
    border-radius: 0 !important;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3) !important;
    transition: top 0.2s ease, box-shadow 0.3s ease, padding 0.3s ease !important;
    
    /* Full-width from edge to edge */
    width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
}

/* Enhanced shadow when scrolled */
.fabcrush-checkout-hero.is-scrolled {
    padding: 16px 0 !important;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4) !important;
}

.fabcrush-checkout-hero.is-scrolled .fabcrush-checkout-hero-content {
    padding: 0 32px; /* Maintain inner padding when compact */
}

.fabcrush-checkout-hero-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 32px; /* Match hero padding for proper alignment */
}

/* Ensure bonus info takes appropriate space */
.fabcrush-checkout-hero-content .fabcrush-bonus-info {
    min-width: 0; /* Allow shrinking */
    flex: 1 1 auto;
}

/* Ensure progress indicator doesn't shrink too much */
.fabcrush-checkout-hero-content .fabcrush-checkout-progress {
    flex: 0 0 auto;
}

.fabcrush-bonus-info {
    flex: 1;
    text-align: left;
}

.fabcrush-bonus-title-main {
    color: white !important;
    margin: 0 !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
}

.fabcrush-bonus-title-main strong {
    font-weight: 700;
    text-decoration: underline;
    margin: 0 4px;
    white-space: nowrap; /* Keep the number from breaking to new line */
}

/* Progress Indicator */
.fabcrush-checkout-progress {
    display: flex;
    align-items: center;
    gap: 16px; /* Space between steps */
    padding: 0;
    justify-content: center;
}

.fabcrush-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
    flex: 1 1 0; /* Equal width for all steps */
    min-width: 0; /* Allow text to wrap if needed */
    max-width: 120px; /* Limit maximum width */
}

.fabcrush-progress-step:hover {
    transform: translateY(-2px);
}

.fabcrush-progress-circle {
    position: relative;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fabcrush-progress-number {
    font-size: 18px;
    font-weight: 700;
    color: white;
    transition: opacity 0.3s ease;
}

.fabcrush-progress-check {
    position: absolute;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fabcrush-progress-step.completed .fabcrush-progress-circle {
    background: rgba(76, 175, 80, 0.9);
    border-color: #4caf50;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.fabcrush-progress-step.completed .fabcrush-progress-number {
    opacity: 0;
}

.fabcrush-progress-step.completed .fabcrush-progress-check {
    opacity: 1;
}

.fabcrush-progress-step.active .fabcrush-progress-circle {
    background: white;
    border-color: white;
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.4);
}

.fabcrush-progress-step.active .fabcrush-progress-number {
    color: #667eea;
}

.fabcrush-progress-label {
    font-size: 13px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    text-align: center;
    width: 100%;
}

.fabcrush-progress-connector {
    display: none; /* Hidden - no dividers between steps */
}

/* Tablet adjustments */
@media (max-width: 1024px) {
    .fabcrush-checkout-hero-content {
        gap: 24px;
    }
    
    .fabcrush-checkout-progress {
        gap: 12px;
    }
    
    .fabcrush-progress-step {
        max-width: 100px;
    }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .fabcrush-checkout-hero {
        padding: 20px 0 !important;
    }
    
    .fabcrush-checkout-hero.is-scrolled {
        padding: 12px 0 !important;
    }
    
    .fabcrush-checkout-hero-content {
        flex-direction: column;
        gap: 20px;
        padding: 0 20px !important;
    }
    
    .fabcrush-checkout-hero.is-scrolled .fabcrush-checkout-hero-content {
        padding: 0 20px !important;
    }
    
    .fabcrush-bonus-info {
        text-align: center;
        width: 100%;
    }
    
    .fabcrush-bonus-title-main {
        justify-content: center !important;
        font-size: 16px !important;
    }
    
    .fabcrush-checkout-progress {
        width: 100%;
        justify-content: space-between;
        gap: 12px;
    }
    
    .fabcrush-progress-step {
        max-width: 90px;
    }
    
    .fabcrush-progress-circle {
        width: 44px;
        height: 44px;
    }
    
    .fabcrush-progress-number {
        font-size: 16px;
    }
    
    .fabcrush-progress-label {
        font-size: 11px;
        white-space: normal; /* Allow wrapping on mobile if needed */
        line-height: 1.2;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .fabcrush-checkout-hero-content {
        padding: 0 16px !important;
    }
    
    .fabcrush-bonus-title-main {
        font-size: 14px !important;
    }
    
    .fabcrush-bonus-title-main svg {
        width: 20px !important;
        height: 20px !important;
        margin-right: 6px !important;
    }
    
    .fabcrush-progress-circle {
        width: 38px;
        height: 38px;
    }
    
    .fabcrush-progress-number {
        font-size: 14px;
    }
    
    .fabcrush-progress-step {
        max-width: 70px;
    }
    
    .fabcrush-progress-label {
        font-size: 10px;
        line-height: 1.1;
    }
    
    .fabcrush-checkout-progress {
        gap: 8px;
    }
}

/* Scroll section spacing - adjusted dynamically by JS */
.fabcrush-checkout-scroll-section {
    scroll-margin-top: 140px;
    padding-top: 20px;
}

/* ========================================================================
   Hide Update Cart Button - Not Needed
   ======================================================================== */

/* Hide update cart button on cart page */
.woocommerce-cart .actions button[name="update_cart"],
.woocommerce-cart-form button[name="update_cart"],
button[name="update_cart"] {
    display: none !important;
}

/* Also hide the entire actions row if only update cart button exists */
.woocommerce-cart .actions:not(:has(.coupon)) {
    display: none !important;
}

/* ========================================================================
   Cart Summary Rows - Delivery & Total After Cart Table
   ======================================================================== */

/* ⚔️ SAMURAI UX: Seamless cart summary extension */
.fabcrush-cart-summary-rows {
    margin-top: 0 !important;
    background: #ffffff;
}

.fabcrush-summary-box {
    width: 100% !important;
    border: 1px solid #e1e5e9 !important;
    border-top: 1px solid #e1e5e9 !important;
    background: #ffffff !important;
    margin-top: -1px !important; /* Merge with cart table border */
}

.fabcrush-summary-row {
    display: grid;
    grid-template-columns: 1fr auto; /* label left, value right */
    align-items: center;
    gap: 16px;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e1e5e9;
}

.fabcrush-summary-row:last-child {
    border-bottom: none;
}

/* ⚔️ SAMURAI UX: Clean inline coupon row matching other summary rows */
.fabcrush-summary-coupon {
    background: #f8f9fa;
    align-items: center; /* Vertically center all content */
    min-height: 0 !important; /* Remove any minimum height */
}

.fabcrush-summary-coupon .fabcrush-summary-value {
    line-height: 1 !important; /* Remove extra line spacing */
}

.fabcrush-coupon-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-end; /* Align to the right like other values */
    line-height: 1 !important; /* No extra line height */
    margin: 0 !important;
    padding: 0 !important;
}

.fabcrush-coupon-input {
    flex: 0 1 auto; /* Don't grow, shrink if needed */
    max-width: 200px; /* Reasonable width for coupon code */
    padding: 0 0.75rem !important; /* Only horizontal padding */
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    font-size: 0.95rem !important;
    background: white !important;
    transition: border-color 0.2s ease !important;
    height: 28px !important; /* Exact height to match text lines */
    line-height: 28px !important; /* Match height for perfect centering */
    margin: 0 !important;
    box-sizing: border-box !important; /* Include border in height calculation */
    vertical-align: middle !important;
}

.fabcrush-coupon-input:focus {
    outline: none !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

.fabcrush-coupon-apply-btn {
    background: transparent !important;
    border: none !important;
    color: #667eea !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    cursor: pointer !important;
    padding: 0 0.5rem !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
    text-transform: none !important;
    height: 28px !important; /* Match input height exactly */
    line-height: 28px !important; /* Center text vertically */
    margin: 0 !important;
    vertical-align: middle !important;
}

.fabcrush-coupon-apply-btn:hover {
    color: #5a6fd8 !important;
    text-decoration: underline !important;
}

.fabcrush-summary-label {
    font-weight: 600 !important;
    color: #2c3e50 !important;
    font-size: 1rem !important;
}

.fabcrush-summary-value {
    text-align: right !important;
    color: #5a6c7d !important;
    font-size: 1rem !important;
}

/* Shipping row styling */
.fabcrush-summary-shipping .fabcrush-summary-value { text-align: right !important; }

.fabcrush-shipping-method {
    color: #2c3e50 !important;
    font-weight: 500 !important;
}

.fabcrush-shipping-cost {
    color: #667eea !important;
    font-weight: 600 !important;
}

.fabcrush-shipping-placeholder {
    color: #888 !important;
    font-style: italic !important;
    text-align: right !important;
}

.fabcrush-shipping-free {
    color: #4caf50 !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    text-align: right !important;
}

/* Total row - prominent styling */
.fabcrush-summary-total {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.03) 0%, rgba(118, 75, 162, 0.03) 100%) !important;
    border-top: 1px solid #e1e5e9 !important;
}

.fabcrush-summary-total .fabcrush-summary-label {
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    color: #2c3e50 !important;
}

.fabcrush-summary-total .fabcrush-summary-value { font-size: 1.25rem !important; }

.fabcrush-total-price {
    color: #667eea !important;
    font-weight: 700 !important;
    font-size: 1.25rem !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .fabcrush-summary-row {
        grid-template-columns: 1fr auto;
        padding: 0.875rem 1rem !important;
    }
    .fabcrush-summary-label { font-size: 0.95rem !important; }
    .fabcrush-summary-total .fabcrush-summary-label { font-size: 1rem !important; }
    .fabcrush-summary-total .fabcrush-summary-value,
    .fabcrush-total-price { font-size: 1.1rem !important; }
}

@media (max-width: 480px) {
    .fabcrush-summary-row { padding: 0.75rem 0.75rem !important; }
    .fabcrush-summary-label,
    .fabcrush-summary-value { font-size: 0.9rem !important; }
    .fabcrush-shipping-method { font-size: 0.85rem !important; }
    .fabcrush-shipping-cost { font-size: 0.9rem !important; }
}

/* ========================================================================
   Hide Original Coupon (we show a proxied copy above checkout)
   ======================================================================== */
/* Hide coupon row inside cart table/actions, but keep our proxied clone visible */
.woocommerce-cart-form .shop_table .actions .coupon,
.woocommerce table.cart .actions .coupon,
.woocommerce-cart-form .coupon {
    display: none !important;
}

#fabcrush-coupon-proxy .coupon {
    display: block !important; /* ensure the cloned one remains visible */
}

/* ========================================================================
   Align Order Review Totals with Product Column
   ======================================================================== */
/* Checkout (integrated) - add consistent left/right padding to totals rows */
#fabcrush-order-review table.shop_table tfoot th {
    padding-left: 24px !important;
}

#fabcrush-order-review table.shop_table tfoot td {
    padding-right: 24px !important;
}

/* Cart page totals box - match same padding so labels aren't glued to border */
.woocommerce-cart .cart_totals table.shop_table th,
.woocommerce-cart .cart_totals table.shop_table td {
    padding-left: 24px !important;
    padding-right: 24px !important;
}

/* ========================================================================
   Separate Checkout Container - Seamless Integration
   ======================================================================== */

#fabcrush-separate-checkout-container {
    width: 100%;
    padding: 3rem 0;
    margin-top: 3rem;
    border-top: 1px solid #e1e5e9;
}

.fabcrush-separate-checkout-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.fabcrush-checkout-header {
    text-align: center;
    margin-bottom: 3rem;
}

.fabcrush-checkout-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: #2c3e50; /* Fallback for non-supporting browsers */
}

.fabcrush-checkout-description {
    font-size: 1.1rem !important;
    color: #5a6c7d !important;
    max-width: 600px !important;
    margin: 0 auto !important;
    line-height: 1.6 !important;
    text-align: center !important;
    display: block !important;
    width: 100% !important;
}

/* ========================================================================
   Cart Table Header Alignment Fix
   ======================================================================== */

.woocommerce-cart .shop_table th,
.woocommerce-cart .shop_table td {
    vertical-align: middle !important;
    padding: 1rem 0.5rem !important;
}

.woocommerce-cart .shop_table thead th {
    font-weight: 600 !important;
    color: #2c3e50 !important;
    border-bottom: 2px solid #e1e5e9 !important;
    text-align: left !important;
}

.woocommerce-cart .shop_table thead th.product-subtotal {
    text-align: center !important;
}

/* Ensure proper table layout */
.woocommerce-cart .shop_table {
    table-layout: fixed !important;
    width: 100% !important;
    margin-bottom: 0 !important;
}

.woocommerce-cart .shop_table .product-name {
    width: 50% !important;
}

.woocommerce-cart .shop_table .product-price,
.woocommerce-cart .shop_table .product-quantity,
.woocommerce-cart .shop_table .product-subtotal {
    width: 16.66% !important;
    text-align: right !important;
}

/* ========================================================================
   Checkout Integration Container
   ======================================================================== */

#fabcrush-cart-checkout-integration {
    margin: 0;
    padding: 2rem;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e5e9;
    width: 100%;
}

.fabcrush-checkout-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f0f2f5;
}

.fabcrush-checkout-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* ⚔️ SAMURAI PRECISION: Hide the duplicated order review section */
.fabcrush-checkout-section-hidden {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}

.fabcrush-checkout-section h3 {
    color: #2c3e50;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fabcrush-checkout-section h3:before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

/* ========================================================================
   Saved Addresses Section
   ======================================================================== */

.fabcrush-saved-addresses-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.fabcrush-saved-addresses-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.fabcrush-saved-address-btn {
    background: #ffffff;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.fabcrush-saved-address-btn:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.fabcrush-saved-address-btn.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.fabcrush-saved-address-btn.is-default {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.fabcrush-saved-address-btn .econt-badge {
    margin-left: 0.5rem;
    font-size: 0.8rem;
}

/* ========================================================================
   Form Fields
   ======================================================================== */

#fabcrush-billing-fields,
#fabcrush-shipping-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.woocommerce-form-row {
    margin-bottom: 0 !important;
}

.woocommerce-form-row label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.woocommerce-form-row input[type="text"],
.woocommerce-form-row input[type="email"],
.woocommerce-form-row input[type="tel"],
.woocommerce-form-row select,
.woocommerce-form-row textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #ffffff;
}

.woocommerce-form-row input:focus,
.woocommerce-form-row select:focus,
.woocommerce-form-row textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.woocommerce-form-row input.fabcrush-field-error,
.woocommerce-form-row select.fabcrush-field-error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.fabcrush-error-message {
    display: block;
    color: #e74c3c;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

/* ========================================================================
   Payment Methods - WooCommerce Compatible
   ======================================================================== */

#payment.woocommerce-checkout-payment {
    margin-top: 1rem;
}

.wc_payment_methods.payment_methods.methods {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.wc_payment_method {
    background: #ffffff;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
    position: relative;
}

.wc_payment_method:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.wc_payment_method input[type="radio"].input-radio {
    margin-right: 0.75rem;
    transform: scale(1.2);
    position: relative;
    top: 2px;
}

.wc_payment_method label {
    cursor: pointer;
    font-weight: 500;
    color: #2c3e50;
    display: flex;
    align-items: center;
    margin: 0;
}

.wc_payment_method input[type="radio"]:checked + label {
    color: #667eea;
    font-weight: 600;
}

.wc_payment_method:has(input[type="radio"]:checked) {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.payment_box {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    font-size: 0.9rem;
    color: #5a6c7d;
}

.payment_box p {
    margin: 0 0 1rem 0;
}

.payment_box p:last-child {
    margin-bottom: 0;
}

/* Payment method icons */
.wc_payment_method img {
    max-height: 24px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Payment fields styling */
.payment_box .form-row {
    margin-bottom: 1rem;
}

.payment_box .form-row:last-child {
    margin-bottom: 0;
}

.payment_box input[type="text"],
.payment_box input[type="email"],
.payment_box input[type="tel"],
.payment_box select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.payment_box label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.9rem;
}

/* ========================================================================
   Action Buttons
   ======================================================================== */

.fabcrush-checkout-actions {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #f0f2f5;
    text-align: center;
}

.fabcrush-place-order-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 1rem 3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    min-width: 200px;
}

.fabcrush-place-order-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.fabcrush-place-order-btn:disabled,
.fabcrush-place-order-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.fabcrush-place-order-btn.loading {
    position: relative;
}

.fabcrush-place-order-btn.loading:after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: fabcrush-spin 1s linear infinite;
}

@keyframes fabcrush-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================================================
   Messages
   ======================================================================== */

.fabcrush-checkout-message {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fabcrush-message-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.fabcrush-message-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.fabcrush-message-success:before {
    content: '✓';
    font-weight: bold;
    font-size: 1.2rem;
}

.fabcrush-message-error:before {
    content: '⚠';
    font-weight: bold;
    font-size: 1.2rem;
}

/* ========================================================================
   Shipping Toggle
   ======================================================================== */

.woocommerce-form__label-for-checkbox {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.woocommerce-form__label-for-checkbox:hover {
    background: #e9ecef;
}

.woocommerce-form__input-checkbox {
    transform: scale(1.2);
    margin: 0 !important;
}

/* ========================================================================
   Responsive Design
   ======================================================================== */

@media (max-width: 768px) {
    #fabcrush-cart-checkout-integration {
        margin-top: 1rem;
        padding: 1.5rem;
        border-radius: 8px;
    }
    
    #fabcrush-billing-fields,
    #fabcrush-shipping-fields {
        grid-template-columns: 1fr;
    }
    
    .fabcrush-saved-addresses-list {
        flex-direction: column;
    }
    
    .fabcrush-saved-address-btn {
        width: 100%;
        text-align: center;
    }
    
    .fabcrush-place-order-btn {
        width: 100%;
        padding: 1rem;
    }
    
    .fabcrush-checkout-section {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }
}

@media (max-width: 480px) {
    #fabcrush-cart-checkout-integration {
        padding: 1rem;
    }
    
    .fabcrush-checkout-section h3 {
        font-size: 1.1rem;
    }
    
    .fabcrush-saved-addresses-section {
        padding: 1rem;
    }
}

/* ⚔️ SAMURAI PRECISION: Simplified Payment Method Styling */
.fabcrush-simplified-payment {
    border: none !important;
    background: transparent !important;
}

.fabcrush-payment-method {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    background: #fff;
}

.fabcrush-payment-title {
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

/* Hide original WooCommerce place order buttons */
.woocommerce-checkout-payment .place-order,
.woocommerce-checkout-payment #place_order,
.payment_box .place-order,
.payment_box button[type="submit"] {
    display: none !important;
}

/* Style our custom checkout actions */
.fabcrush-checkout-actions {
    margin-top: 30px;
    padding: 20px 0;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    width: 100%;
}

.fabcrush-privacy-notice {
    margin-bottom: 20px;
    width: 100%;
    padding: 0 20px;
}

/* ⚔️ SAMURAI UX: Terms and Conditions Checkbox */
.fabcrush-terms-wrapper {
    margin: 0 auto 24px auto;
    max-width: 500px;
    width: 100%;
}

.fabcrush-terms-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    padding: 16px;
    background: #f8f9fa;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin: 0;
}

.fabcrush-terms-label:hover {
    background: #f0f2f5;
    border-color: #667eea;
}

.fabcrush-terms-checkbox {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin: 2px 0 0 0 !important;
    cursor: pointer;
    accent-color: #667eea;
}

.fabcrush-terms-text {
    flex: 1;
    font-size: 0.95rem;
    color: #2c3e50;
    line-height: 1.5;
    text-align: left;
}

.fabcrush-terms-link {
    color: #667eea;
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.2s ease;
}

.fabcrush-terms-link:hover {
    color: #764ba2;
}

.fabcrush-terms-label.error {
    border-color: #e74c3c;
    background: #fee;
    animation: shake 0.4s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .fabcrush-terms-wrapper {
        max-width: 100%;
    }
    
    .fabcrush-terms-label {
        padding: 14px;
    }
    
    .fabcrush-terms-text {
        font-size: 0.9rem;
    }
}

.fabcrush-privacy-notice p {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.6;
    width: 100%;
    margin: 0;
    text-align: center;
    white-space: normal;
}

/* ⚔️ SAMURAI PRECISION: Match exact Add to Cart button styling from FPD */
.fabcrush-place-order-btn {
    background: linear-gradient(135deg, #2b6bc7 0%, #cf3a74 50%, #e53143 75%, #ff6b35 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 12px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 4px 20px rgba(43, 107, 199, 0.3) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    padding: 15px 40px !important;
    min-width: 200px;
    position: relative;
    overflow: hidden;
}

.fabcrush-place-order-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 30px rgba(43, 107, 199, 0.4) !important;
}

.fabcrush-place-order-btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 15px rgba(43, 107, 199, 0.4) !important;
}

/* ⚔️ SAMURAI UX: Disabled state for Place Order button */
.fabcrush-place-order-btn:disabled,
.fabcrush-place-order-btn.disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    filter: grayscale(0.3);
}

.fabcrush-place-order-btn:disabled:hover,
.fabcrush-place-order-btn.disabled:hover {
    transform: none !important;
    box-shadow: 0 4px 20px rgba(43, 107, 199, 0.3) !important;
}

/* ⚔️ SAMURAI UX: Confirm Payment Details button (same styling as Place Order) */
.fabcrush-confirm-payment-wrapper {
    margin-top: 1.5rem;
    padding: 1rem 0;
    text-align: center;
}

.fabcrush-confirm-payment-btn {
    background: linear-gradient(135deg, #2b6bc7 0%, #cf3a74 50%, #e53143 75%, #ff6b35 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 12px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 4px 20px rgba(43, 107, 199, 0.3) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    padding: 15px 40px !important;
    min-width: 200px;
    position: relative;
    overflow: hidden;
}

.fabcrush-confirm-payment-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 30px rgba(43, 107, 199, 0.4) !important;
}

.fabcrush-confirm-payment-btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 15px rgba(43, 107, 199, 0.4) !important;
}

.fabcrush-confirm-payment-btn.confirmed {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
    pointer-events: none; /* Disable further clicks after confirmation */
}

.fabcrush-confirm-payment-btn .fas {
    margin-right: 8px;
}

/* ⚔️ SAMURAI LOADING SCREEN: Marketplace-style loading overlay for checkout */
.fabcrush-checkout-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
}

.fabcrush-checkout-loading-overlay.active {
    display: flex;
}

.fabcrush-checkout-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.1);
    max-width: 400px;
    width: 90%;
}

.fabcrush-checkout-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e1e4e8;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: fabcrush-spin 1s linear infinite;
    margin-bottom: 24px;
}

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

.fabcrush-checkout-loading-content h3 {
    color: #333;
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.fabcrush-checkout-loading-content p {
    color: #667eea;
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 16px 0;
    line-height: 1.4;
}

.fabcrush-checkout-loading-content small {
    color: #888;
    font-size: 14px;
    font-weight: 400;
    margin: 0;
    opacity: 0.8;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .fabcrush-checkout-loading-content {
        padding: 40px 30px;
        max-width: 320px;
    }
    
    .fabcrush-checkout-loading-spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
        margin-bottom: 20px;
    }
    
    .fabcrush-checkout-loading-content h3 {
        font-size: 18px;
    }
    
    .fabcrush-checkout-loading-content p {
        font-size: 15px;
    }
    
    .fabcrush-checkout-loading-content small {
        font-size: 13px;
    }
}

/* Prevent body scroll when loading overlay is active */
body.fabcrush-checkout-loading-active {
    overflow: hidden;
}
