/* Custom Styling for the Instant Quote Checkout Flow */

/* Focused Checkout: Hide Global Theme Elements */
.woocommerce-checkout .site-header,
.woocommerce-checkout .moondog-sticky-top-bar,
.woocommerce-checkout .genesis-footer-widgets,
.woocommerce-checkout #order_review_heading {
    display: none !important;
}

/* Specific targeting for the checkout container to avoid body-level conflicts */
div.woocommerce-checkout:not(body) {
    max-width: 1000px;
    margin: 2rem auto;
    background: var(--quote-bg);
    padding: 30px;
    border: 1px solid var(--quote-border);
    border-radius: var(--quote-radius);
    box-shadow: var(--quote-shadow);
    /* Reset compression if applied by body styles */
    width: 100%;
    box-sizing: border-box;
}

/* Ensure H3 is visible on white background by default */
.woocommerce-checkout h3 {
    color: var(--quote-blue) !important;
    border-bottom: 2px solid var(--quote-border-light);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

/* Deposit Note under Main Button */
.moondog-checkout-button-note {
    text-align: center;
    margin-top: 10px;
    color: var(--quote-text-muted);
}

.moondog-checkout-button-note small {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Header for Phase 3 Payment Area */
.moondog-checkout-payment-header {
    margin-bottom: 20px;
    text-align: left;
}

.moondog-checkout-payment-header .phase-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--quote-pink);
    font-weight: 800;
    margin-bottom: 5px;
}

.moondog-checkout-payment-header .payment-title {
    font-size: 1.1rem !important;
    color: var(--quote-blue) !important;
    margin: 0 0 5px 0 !important;
    border: none !important;
    padding: 0 !important;
}

/* Thank You / Confirmation Page Specifics */
.woocommerce-order-received .woocommerce-thankyou-order-received,
.woocommerce-order-received .woocommerce-order-overview,
.woocommerce-order-received .woocommerce-order-details,
.woocommerce-order-received .woocommerce-customer-details {
    display: none !important;
}

.thankyou-progress {
    margin: 40px auto 0 !important;
    border-top: 1px solid var(--quote-border-light);
    padding-top: 30px;
}

/* Specifically handle the 'loader' card for anticipation flow */
.moondog-onboarding-card.loader-card {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.moondog-onboarding-card {
    background: #fff;
    border: 1px solid var(--quote-border);
    border-radius: var(--quote-radius);
    padding: 50px 40px;
    margin: 30px 0 40px;
    text-align: center;
    box-shadow: var(--quote-shadow);
}

.onboarding-header h2 {
    color: var(--quote-blue);
    margin: 15px 0 10px;
    font-size: 2rem;
    border-bottom: none !important;
}

.onboarding-header .intro-text {
    font-size: 1.1rem;
    color: var(--quote-text-muted);
}

.onboarding-metadata-grid {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 30px 0;
    padding: 20px;
    background: var(--quote-bg-alt);
    border-radius: 8px;
}

.onboarding-metadata-grid .status-item .label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--quote-text-light);
    margin-bottom: 4px;
}

.onboarding-metadata-grid .status-item .val {
    font-weight: 800;
    color: var(--quote-blue);
    font-size: 1.1rem;
}

.onboarding-cta-box {
    background: var(--quote-blue);
    color: #fff;
    padding: 40px;
    border-radius: 16px;
    margin-top: 40px;
    box-shadow: var(--quote-blue-shadow);
}

/* Phase 4 High-Priority CTA */
.onboarding-phase-cta {
    background-color: var(--quote-pink) !important;
    border: 2px solid var(--quote-white) !important;
    font-size: 1.2rem !important;
    padding: 20px 40px !important;
    box-shadow: 0 8px 25px rgba(255, 0, 203, 0.4) !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.onboarding-phase-cta:hover {
    background-color: var(--quote-white) !important;
    color: var(--quote-pink) !important;
    transform: translateY(-3px) scale(1.02);
}

.onboarding-cta-box h3 {
    color: var(--quote-white) !important;
    margin-bottom: 10px;
    border: none !important;
    font-size: 1.5rem;
}

.onboarding-cta-box p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    margin-bottom: 25px;
}

.onboarding-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--quote-border-light);
    font-size: 0.9rem;
    color: var(--quote-text-muted);
    line-height: 1.5;
}

/* Progress Indicator Styles */
.moondog-checkout-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 600px;
    margin: 4rem auto 1rem;
    /* Push to footer */
    position: relative;
}

.moondog-checkout-progress::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--quote-border);
    z-index: 1;
}

.progress-step {
    position: relative;
    z-index: 2;
    text-align: center;
    background: var(--quote-bg);
    flex: 1;
}

.progress-step .step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--quote-bg);
    border: 2px solid var(--quote-border);
    font-size: 12px;
    color: var(--quote-text-light);
}

.progress-step .step-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--quote-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.progress-step.is-complete .step-num {
    background: var(--quote-bg-alt);
    border-color: var(--quote-blue);
    color: var(--quote-blue);
}

.progress-step.is-complete .step-num .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.progress-step.is-active .step-num {
    background: var(--quote-blue);
    border-color: var(--quote-blue);
    color: var(--quote-white);
    box-shadow: 0 0 0 4px var(--quote-blue-alpha-40);
}

.progress-step.is-active .step-label {
    color: var(--quote-blue);
}

/* Processing Overlay Styles */
.moondog-processing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    backdrop-filter: blur(5px);
}

.overlay-content {
    max-width: 400px;
    padding: 40px;
}

.moondog-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--quote-bg-alt);
    border-top: 4px solid var(--quote-pink);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.overlay-content h3 {
    color: var(--quote-blue);
    margin-bottom: 10px;
}

.overlay-content p {
    color: var(--quote-text-muted);
    font-size: 15px;
    line-height: 1.5;
}

/* Minified Coupon Styles */
.moondog-minified-coupon-wrap {
    margin-top: 10px;
    font-size: 0.85rem;
}

.show-coupon-trigger {
    color: var(--quote-blue);
    text-decoration: underline;
    cursor: pointer;
}

.moondog-coupon-field-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    max-width: 300px;
}

.moondog-coupon-field-row input {
    flex: 1;
    padding: 8px 12px !important;
    border-radius: 8px;
    border: 1px solid var(--quote-border);
}

.moondog-coupon-field-row .button {
    padding: 8px 15px !important;
    font-size: 13px !important;
}

/* Project Summary Toggle Styles */
.moondog-summary-toggle {
    background: none;
    border: none;
    color: var(--quote-blue);
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
    padding: 10px 0;
    width: 100%;
    text-align: left;
}

.moondog-summary-toggle .hide-txt {
    display: none;
}

.woocommerce-checkout.details-expanded .moondog-summary-toggle .show-txt {
    display: none;
}

.woocommerce-checkout.details-expanded .moondog-summary-toggle .hide-txt {
    display: inline;
}

/* Fix: Reveal project details when expanded */
.woocommerce-checkout.details-expanded .woocommerce-checkout-review-order-table tbody .product-name {
    font-size: 1rem !important;
    color: var(--quote-text-dark) !important;
}

/* Collapse variation details by default */
.woocommerce-checkout .shop_table dl.variation {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    margin: 0;
    opacity: 0;
}

.woocommerce-checkout.details-expanded .shop_table dl.variation {
    max-height: 500px;
    opacity: 1;
    margin: 10px 0;
}

/* Mobile Sticky Checkout Optimizations */
@media (max-width: 959px) {
    .woocommerce-checkout #payment {
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        background: var(--quote-bg) !important;
        box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.1);
        margin: 20px 0 0 0 !important;
        border-radius: 20px 20px 0 0 !important;
        padding: 20px 30px !important;
    }

    .moondog-minified-coupon-wrap {
        margin-top: 15px;
    }

    .moondog-secure-payment-seal {
        margin-bottom: 15px;
        text-align: center;
    }

    /* Overwrite core WooCommerce float for the checkout button */
    .woocommerce #payment #place_order,
    .woocommerce-page #payment #place_order {
        float: none !important;
        margin-top: 10px;
    }

    .moondog-mobile-sticky-total {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 15px;
        font-weight: 800;
        font-size: 1.2rem;
        color: var(--quote-blue);
    }

    .woocommerce-checkout #place_order {
        width: 100%;
        padding: 18px !important;
        font-size: 1.1rem !important;
    }

    .woocommerce-checkout #place_order.loading::after {
        left: 50%;
        margin-left: -10px;
    }
}

/* Account Status Styles */
.moondog-checkout-account-status {
    margin: 0 0 15px 0;
    padding: 0 0 10px 0;
    border-bottom: 1px solid var(--quote-border-light);
}

.moondog-checkout-account-status .status-msg {
    font-size: 1rem;
    margin: 0;
    color: var(--quote-blue);
}

.moondog-checkout-account-status .status-subtext {
    margin: 5px 0 0;
    font-size: 0.85rem;
    color: var(--quote-text-muted);
}

/* Force col-1 to full width and hide empty col-2 */
.woocommerce-checkout .col2-set .col-1 {
    width: 100% !important;
    float: none !important;
}

.woocommerce-checkout .col2-set .col-2 {
    display: none !important;
}

.moondog-checkout-account-status .logout-link {
    font-size: 0.8rem;
    color: var(--quote-red);
    text-decoration: underline;
}

/* Checkout Button Loading State */
.woocommerce-checkout #place_order.loading {
    color: rgba(255, 255, 255, 0.8) !important;
    pointer-events: none;
    position: relative;
    padding-left: 45px !important;
    /* Make room for the lock */
}

.woocommerce-checkout #place_order.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 25px;
    /* Move spinner to the side of the lock/text */
    width: 20px;
    height: 20px;
    margin: -10px 0 0 0;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Minified Coupon Styles */
.moondog-minified-coupon-wrap {
    font-size: 0.85rem;
    padding: 0 10px;
}

.show-coupon-trigger {
    color: var(--quote-blue);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 700;
}

.moondog-coupon-field-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    max-width: 300px;
}

.moondog-coupon-field-row input {
    flex: 1;
    padding: 8px 12px !important;
    border-radius: 8px;
    border: 1px solid var(--quote-border);
    font-size: 14px;
}

.moondog-coupon-field-row .button {
    padding: 8px 15px !important;
    font-size: 13px !important;
    background: var(--quote-blue) !important;
    color: white !important;
    border-radius: 8px !important;
    height: auto !important;
}

/* Desktop Side-by-Side Layout */
@media (min-width: 960px) {

    .woocommerce-checkout .moondog-checkout-flex-layout {
        display: flex;
        flex-direction: row;
        /* Force side-by-side */
        gap: 30px;
        align-items: flex-start;
        width: 100%;
    }

    .woocommerce-checkout .moondog-checkout-main {
        flex: 1 1 55%;
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .woocommerce-checkout .woocommerce-checkout-review-order {
        width: 100%;
    }

    .woocommerce-checkout .moondog-checkout-sidebar {
        flex: 1 1 45%;
        display: flex;
        flex-direction: column;
        gap: 20px;
        position: sticky;
        top: 100px;
    }
}

/* Secure Payment Seal Styles */
.moondog-secure-payment-seal {
    background: var(--quote-bg-alt);
    border: 1px solid var(--quote-border-light);
    border-radius: 8px;
    padding: 12px;
    display: none;
}

.seal-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--quote-green-accent);
    font-weight: 700;
    font-size: 0.85rem;
}

.secure-guarantee {
    font-size: 0.75rem;
    color: var(--quote-text-muted);
    margin-top: 4px;
    line-height: 1.2;
}

/* Global Footer Trust Badge Position */
.woocommerce-checkout .checkout-trust-badge {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid var(--quote-border-light);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Hide the empty h3 for Account Info since title handles it */
.woocommerce-checkout #customer_details h3 {
    display: none !important;
}

.woocommerce-checkout h3 {
    color: var(--quote-blue) !important;
    font-weight: 700;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--quote-border-light);
    padding-bottom: 10px;
}

.woocommerce-checkout .col2-set {
    margin-bottom: 30px;
}

/* Move coupon toggle styling to look better in order review */
.woocommerce-checkout .woocommerce-form-coupon-toggle {
    margin-bottom: 20px;
}

.woocommerce-checkout .woocommerce-info {
    border-top: 3px solid var(--quote-blue);
    background-color: var(--quote-bg-alt);
}

/* Hide Redundant Totals & Quantity */
.woocommerce-checkout .product-quantity,
.woocommerce-checkout .order-total {
    display: none !important;
}

.woocommerce-checkout .cart-subtotal th {
    font-size: 1.2rem;
    color: var(--quote-blue);
}

/* Refined Shop Table Styles */
.woocommerce table.shop_table {
    border: 1px solid var(--quote-border-light) !important;
    border-radius: var(--quote-radius) !important;
    border-collapse: separate !important;
    border-spacing: 0;
    overflow: hidden;
}

.woocommerce table.shop_table th {
    font-weight: 700;
    padding: 12px !important;
    line-height: 1.5em;
    font-size: 0.85rem;
    /* Reduced header font size */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--quote-text-muted);
    background: var(--quote-bg);
    /* Uniform background */
}

.woocommerce table.shop_table thead th,
.woocommerce table.shop_table thead td {
    background: var(--quote-bg-alt);
}

.woocommerce table.shop_table tfoot td,
.woocommerce table.shop_table tfoot th {
    border-top: 0px solid color-mix(in srgb, currentColor 20%, transparent);
    background: var(--quote-bg-alt);
}

.woocommerce table.shop_table td {
    border-top: 0 !important;
    padding: 15px 12px !important;
    vertical-align: middle;
    line-height: 1.5em;
    background: var(--quote-bg);
    /* Uniform background */
}

.woocommerce table.shop_table tr {
    border-top: 0;
}


/* Final Action Area Polish */
.woocommerce-checkout #payment {
    border: 2px solid var(--quote-blue) !important;
    /* Make the final path border stand out */
}

.moondog-mobile-sticky-total {
    background: var(--quote-blue);
    color: #fff;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 20px !important;
}

.moondog-mobile-sticky-total .label {
    color: rgba(255, 255, 255, 0.7);
}

.moondog-mobile-sticky-total .val strong {
    color: #fff;
}

/* Hide TBODY redundancy (The specific 'Deposit' row price and label) */
.woocommerce-checkout-review-order-table tbody .product-total {
    display: none !important;
}

.woocommerce-checkout-review-order-table tbody .product-name {
    font-size: 0 !important;
    color: transparent !important;
}

.woocommerce-checkout-review-order-table tbody .product-name dl.variation {
    font-size: 14px !important;
    color: var(--quote-text-dark) !important;
}

.woocommerce-checkout .shop_table {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--quote-border-light);
}

.woocommerce-checkout #payment {
    background: var(--quote-bg-alt);
    border-radius: var(--quote-radius, 12px) !important;
    padding: 20px !important;
    border: 1px solid var(--quote-border-light, #eeeeee);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.02);
    margin-top: 0;
}

.woocommerce #payment #place_order,
.woocommerce-page #payment #place_order {
    float: none !important;
    width: 100%;
    margin-top: 15px;
}

/* Clean Payment Box: Hide method selection as PayPal is the only option */
.woocommerce-checkout #payment ul.payment_methods {
    display: none !important;
}

.woocommerce-checkout #payment div.payment_box {
    display: none !important;
}

/* Compact Trust Badge for Sidebar */
.moondog-checkout-sidebar .checkout-trust-badge {
    padding: 10px 5px;
    border-top: 1px solid var(--quote-border-light);
}

/* Onboarding Badge Styles */
.moondog-onboarding-badge {
    background: var(--quote-white);
    border: 1px solid var(--quote-blue);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.onboarding-badge-inner {
    display: flex;
    gap: 12px;
    align-items: center;
}

.onboarding-badge-inner .dashicons {
    color: var(--quote-blue);
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.onboarding-text strong {
    display: block;
    color: var(--quote-blue);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.onboarding-text p {
    margin: 2px 0 0;
    font-size: 0.8rem;
    line-height: 1.3;
    color: var(--quote-text-muted);
}

.payment-instruction p {
    font-size: 0.8rem;
}


.checkout-discussion-cta {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--quote-border-light);
    text-align: center;
}

.checkout-discussion-cta .meeting-link {
    color: var(--quote-blue);
    font-weight: 700;
    text-decoration: underline;
    font-size: 1rem;
}

.checkout-discussion-cta .cta-note {
    font-size: 0.8rem;
    color: var(--quote-text-muted);
    margin-top: 8px;
}
