/* =====================================================
   BICIFIX ULTIMATE CHECKOUT EXPERIENCE - OPTIMIZED
   ===================================================== */

/* CSS Custom Properties for consistent theming */
:root {
    --bicifix-primary: #0073aa;
    --bicifix-primary-hover: #005a87;
    --bicifix-secondary: #28a745;
    --bicifix-light-bg: #f8f9fa;
    --bicifix-border: #e1e1e1;
    --bicifix-border-focus: #0073aa;
    --bicifix-text: #333;
    --bicifix-text-light: #666;
    --bicifix-white: #fff;
    --bicifix-warning: #fff3cd;
    --bicifix-warning-border: #ffeaa7;
    --bicifix-warning-text: #856404;
    --bicifix-error: #dc3545;
    --bicifix-success: #28a745;
    --bicifix-shadow: 0 2px 4px rgba(0,0,0,0.1);
    --bicifix-shadow-focus: 0 0 0 3px rgba(0, 115, 170, 0.1);
    --bicifix-border-radius: 8px;
    --bicifix-border-radius-sm: 4px;
    --bicifix-spacing: 20px;
    --bicifix-spacing-lg: 30px;
    --bicifix-transition: all 0.3s ease;
}

/* =====================================================
   FOUNDATION & CONTAINER STYLES
   ===================================================== */

/* Force full-width layout and override theme constraints */
body.woocommerce-checkout [class*='ct-container'],
body.woocommerce-checkout .site-main,
body.woocommerce-checkout article,
body.woocommerce-checkout .ct-woocommerce-checkout,
body.woocommerce-checkout .bicifix-checkout-container,
body.woocommerce-checkout .woocommerce-checkout,
body.woocommerce-checkout .is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)),
body.woocommerce-checkout .is-width-constrained {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding-left: var(--bicifix-spacing) !important;
    padding-right: var(--bicifix-spacing) !important;
}

/* Override Blocksy's WooCommerce checkout grid layout */
body.woocommerce-checkout .ct-woocommerce-checkout {
    display: block !important;
    grid-template-columns: none !important;
    gap: var(--bicifix-spacing-lg) !important;
    padding: 0 !important;
}

/* Additional Blocksy overrides */
body.woocommerce-checkout .woocommerce {
    width: 100% !important;
    max-width: none !important;
}

body.woocommerce-checkout .woocommerce-notices-wrapper {
    width: 100% !important;
    max-width: none !important;
}

/* Prevent layout breaking */
body.woocommerce-checkout .woocommerce-checkout > *,
body.woocommerce-checkout #order_review {
    width: 100% !important;
    max-width: none !important;
}

/* =====================================================
   CHECKOUT HEADER & TRUST ELEMENTS
   ===================================================== */

.bicifix-checkout-header {
    background: linear-gradient(135deg, var(--bicifix-light-bg) 0%, var(--bicifix-white) 100%);
    padding: var(--bicifix-spacing-lg) var(--bicifix-spacing);
    border-bottom: 1px solid var(--bicifix-border);
    margin-bottom: var(--bicifix-spacing-lg);
    text-align: center;
}

.security-badges {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--bicifix-spacing-lg);
    margin-bottom: var(--bicifix-spacing);
    flex-wrap: wrap;
}

.security-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bicifix-white);
    border: 1px solid var(--bicifix-border);
    border-radius: var(--bicifix-border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--bicifix-text);
    box-shadow: var(--bicifix-shadow);
    transition: var(--bicifix-transition);
    min-width: 140px;
    justify-content: center;
}

.security-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.security-badge i {
    font-size: 18px;
    color: var(--bicifix-secondary);
}

/* Progress Indicator */
.checkout-progress {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--bicifix-spacing);
    position: relative;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
}

.progress-step:not(:last-child):after {
    content: '';
    position: absolute;
    top: 15px;
    left: 100%;
    width: var(--bicifix-spacing);
    height: 2px;
    background: var(--bicifix-border);
    z-index: 1;
}

.progress-step.completed:not(:last-child):after,
.progress-step.active:not(:last-child):after {
    background: var(--bicifix-primary);
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bicifix-light-bg);
    border: 2px solid var(--bicifix-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    transition: var(--bicifix-transition);
}

.progress-step.completed .step-number {
    background: var(--bicifix-success);
    border-color: var(--bicifix-success);
    color: var(--bicifix-white);
}

.progress-step.active .step-number {
    background: var(--bicifix-primary);
    border-color: var(--bicifix-primary);
    color: var(--bicifix-white);
    animation: pulse 2s infinite;
}

.step-label {
    font-size: 12px;
    color: var(--bicifix-text-light);
    font-weight: 500;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* =====================================================
   MAIN LAYOUT STRUCTURE
   ===================================================== */

.bicifix-checkout-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--bicifix-spacing);
}

.checkout-main-content {
    display: grid !important;
    grid-template-columns: 1fr 400px !important;
    gap: var(--bicifix-spacing-lg) !important;
    align-items: start !important;
    width: 100% !important;
    max-width: none !important;
}

.customer-details-section {
    background: var(--bicifix-white);
    border: 1px solid var(--bicifix-border);
    border-radius: var(--bicifix-border-radius);
    padding: var(--bicifix-spacing-lg);
    box-shadow: var(--bicifix-shadow);
    width: 100% !important;
    box-sizing: border-box;
}

.order-review-section {
    background: var(--bicifix-white);
    border: 1px solid var(--bicifix-border);
    border-radius: var(--bicifix-border-radius);
    padding: var(--bicifix-spacing-lg);
    box-shadow: var(--bicifix-shadow);
    position: sticky;
    top: var(--bicifix-spacing);
    width: 100% !important;
    box-sizing: border-box;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 600;
    color: var(--bicifix-text);
    margin-bottom: var(--bicifix-spacing);
    padding-bottom: 15px;
    border-bottom: 2px solid var(--bicifix-light-bg);
}

.section-title i {
    color: var(--bicifix-primary);
    font-size: 18px;
}

/* =====================================================
   CUSTOMER DETAILS & FORM STYLING
   ===================================================== */

#customer_details {
    display: flex !important;
    flex-direction: column !important;
    gap: var(--bicifix-spacing-lg) !important;
    width: 100% !important;
}

#customer_details .col-1,
#customer_details .col-2 {
    background: var(--bicifix-light-bg);
    padding: var(--bicifix-spacing);
    border-radius: var(--bicifix-border-radius-sm);
    border: 1px solid var(--bicifix-border);
    width: 100% !important;
    box-sizing: border-box;
}

/* Move shipping address to customer details section */
#ship-to-different-address,
.order-review-section .shipping_address {
    display: block !important;
}

.customer-details-section h3 {
    color: var(--bicifix-text);
    font-size: 18px;
    margin-bottom: 15px;
    font-weight: 600;
}

/* Form Fields */
.woocommerce-checkout .form-row {
    margin-bottom: 20px;
}

.woocommerce-checkout .form-row label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--bicifix-text);
    font-size: 14px;
}

.woocommerce-checkout .form-row input,
.woocommerce-checkout .form-row select,
.woocommerce-checkout .form-row textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--bicifix-border);
    border-radius: var(--bicifix-border-radius-sm);
    font-size: 14px;
    background: var(--bicifix-white);
    transition: var(--bicifix-transition);
    box-sizing: border-box;
}

.woocommerce-checkout .form-row input:focus,
.woocommerce-checkout .form-row select:focus,
.woocommerce-checkout .form-row textarea:focus {
    outline: none;
    border-color: var(--bicifix-border-focus);
    box-shadow: var(--bicifix-shadow-focus);
}

.woocommerce-checkout input.error {
    border-color: var(--bicifix-error) !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

/* =====================================================
   ORDER REVIEW & CHECKOUT TABLE
   ===================================================== */

#order_review {
    background: var(--bicifix-white);
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
}

.woocommerce-checkout-review-order-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--bicifix-spacing);
    font-size: 14px;
}

.woocommerce-checkout-review-order-table th,
.woocommerce-checkout-review-order-table td {
    padding: 15px 0;
    text-align: left;
    border-bottom: 1px solid var(--bicifix-light-bg);
}

.woocommerce-checkout-review-order-table th {
    font-weight: 600;
    color: var(--bicifix-text);
    background: none;
}

.woocommerce-checkout-review-order-table .cart_item td {
    vertical-align: top;
}

.woocommerce-checkout-review-order-table .order-total {
    font-weight: 600;
    font-size: 16px;
    border-top: 2px solid var(--bicifix-primary);
}

.woocommerce-checkout-review-order-table .cart_item .product-name {
    font-weight: 600;
    color: var(--bicifix-text);
}

.woocommerce-checkout-review-order-table .cart_item .product-total {
    font-weight: 600;
    text-align: right;
}

/* =====================================================
   PAYMENT METHODS
   ===================================================== */

.wc_payment_methods {
    list-style: none;
    padding: 0;
    margin: var(--bicifix-spacing) 0;
}

.wc_payment_method {
    margin-bottom: 10px;
    border: 1px solid var(--bicifix-border);
    border-radius: var(--bicifix-border-radius-sm);
    overflow: hidden;
    transition: var(--bicifix-transition);
}

.wc_payment_method:last-child {
    margin-bottom: 0;
}

.wc_payment_method label {
    display: block;
    padding: 15px;
    background: var(--bicifix-light-bg);
    cursor: pointer;
    margin: 0;
    font-weight: 500;
    transition: var(--bicifix-transition);
}

.wc_payment_method label:hover {
    background: #f0f7ff;
}

.wc_payment_method input[type="radio"]:checked + label {
    background: var(--bicifix-primary);
    color: var(--bicifix-white);
}

/* Custom Radio & Checkbox Styling */
.woocommerce-checkout input[type="checkbox"],
.woocommerce-checkout input[type="radio"],
.wc_payment_method input[type="radio"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--bicifix-border);
    border-radius: 50%;
    margin-right: 10px;
    position: relative;
    background: var(--bicifix-white);
    cursor: pointer;
    transition: var(--bicifix-transition);
}

.woocommerce-checkout input[type="checkbox"] {
    border-radius: 3px;
}

.woocommerce-checkout input[type="checkbox"]:checked,
.woocommerce-checkout input[type="radio"]:checked,
.wc_payment_method input[type="radio"]:checked {
    border-color: var(--bicifix-primary);
    background: var(--bicifix-primary);
}

.woocommerce-checkout input[type="checkbox"]:checked::before,
.woocommerce-checkout input[type="radio"]:checked::before,
.wc_payment_method input[type="radio"]:checked::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: var(--bicifix-white);
    border-radius: 50%;
}

.woocommerce-checkout input[type="checkbox"]:checked::before {
    content: '✓';
    font-size: 12px;
    font-weight: bold;
    width: auto;
    height: auto;
}

.woocommerce-terms-and-conditions-wrapper input[type="checkbox"] {
    margin-right: 8px;
    vertical-align: top;
    margin-top: 2px;
}

/* Focus states for accessibility */
.woocommerce-checkout input[type="checkbox"]:focus,
.woocommerce-checkout input[type="radio"]:focus,
.wc_payment_method input[type="radio"]:focus {
    outline: none;
    box-shadow: var(--bicifix-shadow-focus);
}

/* =====================================================
   PLACE ORDER BUTTON & PAYMENT SECURITY
   ===================================================== */

#place_order {
    width: 100%;
    background: linear-gradient(135deg, var(--bicifix-primary) 0%, var(--bicifix-primary-hover) 100%);
    color: var(--bicifix-white);
    border: none;
    padding: 18px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--bicifix-border-radius-sm);
    cursor: pointer;
    margin-top: var(--bicifix-spacing);
    transition: var(--bicifix-transition);
    box-shadow: var(--bicifix-shadow);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#place_order:hover {
    background: linear-gradient(135deg, var(--bicifix-primary-hover) 0%, var(--bicifix-primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#place_order:active {
    transform: translateY(0);
    box-shadow: var(--bicifix-shadow);
}

.payment-security-footer {
    margin-top: var(--bicifix-spacing);
    padding-top: var(--bicifix-spacing);
    border-top: 1px solid var(--bicifix-light-bg);
    text-align: center;
}

.security-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    color: var(--bicifix-text-light);
    margin-bottom: 10px;
}

.security-info i {
    color: var(--bicifix-secondary);
}

.accepted-payments {
    font-size: 11px;
    color: var(--bicifix-text-light);
    margin-bottom: 10px;
}

.payment-icons {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.payment-icons i {
    font-size: 24px;
    color: var(--bicifix-text-light);
    transition: var(--bicifix-transition);
}

.payment-icons i:hover {
    color: var(--bicifix-primary);
    transform: scale(1.1);
}

/* =====================================================
   LOGIN NOTICE & FORMS
   ===================================================== */

.checkout-login-notice {
    background: var(--bicifix-warning);
    border: 1px solid var(--bicifix-warning-border);
    color: var(--bicifix-warning-text);
    padding: 15px;
    border-radius: var(--bicifix-border-radius-sm);
    margin-bottom: var(--bicifix-spacing);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.woocommerce-form-login,
.checkout-login {
    background: var(--bicifix-white);
    border: 1px solid var(--bicifix-border);
    border-radius: var(--bicifix-border-radius);
    padding: var(--bicifix-spacing);
    margin-bottom: var(--bicifix-spacing);
}

.woocommerce-form-login h2,
.checkout-login h2 {
    margin-bottom: 15px;
    color: var(--bicifix-text);
    font-size: 18px;
}

.woocommerce-form-login .button,
.checkout-login .button,
.woocommerce-form-login input[type="submit"],
.checkout-login input[type="submit"] {
    background: var(--bicifix-primary);
    color: var(--bicifix-white);
    border: none;
    padding: 12px 24px;
    border-radius: var(--bicifix-border-radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: var(--bicifix-transition);
}

.woocommerce-form-login .button:hover,
.checkout-login .button:hover,
.woocommerce-form-login input[type="submit"]:hover,
.checkout-login input[type="submit"]:hover {
    background: var(--bicifix-primary-hover);
}

.woocommerce-form-login input[type="text"],
.woocommerce-form-login input[type="email"],
.woocommerce-form-login input[type="password"],
.checkout-login input[type="text"],
.checkout-login input[type="email"],
.checkout-login input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--bicifix-border);
    border-radius: var(--bicifix-border-radius-sm);
    margin-bottom: 15px;
    font-size: 14px;
    transition: var(--bicifix-transition);
}

/* =====================================================
   RESPONSIVE DESIGN
   ===================================================== */

@media (max-width: 1024px) {
    .checkout-main-content {
        grid-template-columns: 1fr !important;
        gap: var(--bicifix-spacing) !important;
    }
    
    .order-review-section {
        position: static;
        order: -1;
    }
}

@media (max-width: 768px) {
    :root {
        --bicifix-spacing: 15px;
        --bicifix-spacing-lg: 20px;
    }
    
    .bicifix-checkout-header {
        padding: var(--bicifix-spacing);
    }
    
    .security-badges {
        flex-direction: column;
        gap: 10px;
    }
    
    .security-badge {
        min-width: auto;
        width: 100%;
        max-width: 250px;
        margin: 0 auto;
    }
    
    .checkout-progress {
        gap: 15px;
    }
    
    .step-number {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .checkout-main-content {
        gap: var(--bicifix-spacing) !important;
    }
    
    .customer-details-section,
    .order-review-section {
        padding: var(--bicifix-spacing);
    }
    
    .section-title {
        font-size: 18px;
    }
    
    #customer_details {
        gap: var(--bicifix-spacing) !important;
    }
    
    #customer_details .col-1,
    #customer_details .col-2 {
        padding: 15px;
    }
    
    .woocommerce-checkout .form-row input,
    .woocommerce-checkout .form-row select,
    .woocommerce-checkout .form-row textarea {
        padding: 10px 12px;
    }
    
    #place_order {
        padding: 15px 20px;
        font-size: 15px;
    }
    
    .accepted-payments {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .bicifix-checkout-container {
        padding: 0 10px;
    }
    
    .security-badges {
        gap: 8px;
    }
    
    .checkout-progress {
        gap: 10px;
    }
    
    .step-label {
        display: none;
    }
}

/* =====================================================
   LOADING & SUCCESS STATES
   ===================================================== */

.processing .checkout-main-content {
    opacity: 0.7;
    pointer-events: none;
}

.processing #place_order {
    background: var(--bicifix-text-light);
    cursor: not-allowed;
}

@keyframes checkmark {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.order-success .progress-step.completed .step-number {
    animation: checkmark 0.6s ease-in-out;
}

/* =====================================================
   ADDITIONAL FIXES FOR SIDE-BY-SIDE LAYOUT
   ===================================================== */

/* Force layout even if theme tries to override */
body.woocommerce-checkout .woocommerce-checkout .checkout-main-content,
body.woocommerce-checkout .checkout-main-content,
.woocommerce-checkout .checkout-main-content {
    display: grid !important;
    grid-template-columns: 1fr 400px !important;
    grid-template-areas: "customer-details order-review" !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.woocommerce-checkout .customer-details-section {
    grid-area: customer-details !important;
}

body.woocommerce-checkout .order-review-section {
    grid-area: order-review !important;
}

/* Ensure no flex interference */
body.woocommerce-checkout .checkout-main-content,
body.woocommerce-checkout .checkout-main-content * {
    flex: none !important;
}

/* Override any theme flex styles */
body.woocommerce-checkout .checkout-main-content {
    align-items: start !important;
    justify-content: start !important;
}

@media (max-width: 1024px) {
    body.woocommerce-checkout .woocommerce-checkout .checkout-main-content {
        grid-template-columns: 1fr !important;
        grid-template-areas: "order-review" "customer-details" !important;
    }
} 