/* Apex WooCommerce Checkout Theme - Refined Dark Mode */

/* 1. Global Reset */
/* 1. Global Reset for Checkout */
.woocommerce-checkout,
.woocommerce-checkout *,
.woocommerce-checkout *:before,
.woocommerce-checkout *:after {
    box-sizing: border-box;
}

.woocommerce-checkout {
    background-color: #0a0a0a;
    /* Deep Black */
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.apex-checkout-layout {
    display: flex;
    flex-wrap: nowrap;
    /* Force columns to stay side-by-side on desktop */
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100vh;
}

/* 2. Left Column (Info) */
.apex-checkout-left {
    flex: 1 1 58%;
    padding: 40px;
    background: #0a0a0a;
    border-right: 1px solid #222;
    min-width: 0;
    /* Allow shrinking below content size (fixes iframe overflow) */
}

/* ... (skipped lines) ... */

/* 3. Right Column (Summary) */
.apex-checkout-right {
    flex: 1 1 30%;
    background: #111;
    /* Slightly lighter */
    padding: 40px;
    position: relative;
    border-left: 1px solid #1a1a1a;
    min-width: 0;
    /* Allow shrinking below content size */
    overflow-x: hidden;
    /* Prevent iframe from pushing width out */
}

/* Fix for Internal Columns (Billing vs Additional Info) */
/* Force them to stack so inputs are full width */
.woocommerce-checkout .col2-set {
    width: 100%;
    float: none;
}

.woocommerce-checkout .col2-set .col-1,
.woocommerce-checkout .col2-set .col-2 {
    float: none;
    width: 100%;
    margin-bottom: 20px;
}

.apex-order-summary-card {
    position: sticky;
    top: 40px;
}

.apex-order-summary-card h3 {
    margin-top: 0;
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 20px;
    border-bottom: 1px solid #222;
    padding-bottom: 15px;
}

/* 4. Form Inputs & Labels */
.woocommerce form .form-row {
    padding: 0;
    margin-bottom: 18px;
}

.woocommerce form .form-row label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: #aaa;
    font-weight: 500;
}

.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea {
    background-color: #1a1a1a !important;
    border: 1px solid #333 !important;
    color: #fff !important;
    border-radius: 6px;
    padding: 12px 15px;
    height: 52px;
    font-size: 15px;
    box-shadow: none;
    transition: all 0.2s ease;
}

.select2-container--default .select2-selection--single {
    background-color: #1a1a1a !important;
    border: 1px solid #333 !important;
    color: #fff !important;
    border-radius: 6px;
    padding: 0 15px;
    /* REMOVED VERTICAL PADDING to fix alignment */
    height: 52px;
    font-size: 15px;
    box-shadow: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

/* Active State */
.woocommerce form .form-row input.input-text:focus,
.woocommerce form .form-row textarea:focus,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: #ffd700 !important;
    background-color: #222 !important;
    outline: none;
    box-shadow: 0 0 0 1px #ffd700;
}

/* Select2 Fixes (Crucial for Dark Mode) */
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #fff !important;
    line-height: 50px;
    /* Match height - borders */
    padding-left: 0;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 50px;
}

.select2-dropdown {
    background-color: #1a1a1a;
    border: 1px solid #333;
}

.select2-search__field {
    background-color: #222 !important;
    color: #fff !important;
    border: 1px solid #333 !important;
}

.select2-results__option {
    color: #ccc;
    background-color: #1a1a1a;
}

.select2-results__option--highlighted[aria-selected] {
    background-color: #ffd700;
    color: #000;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #333;
}

/* 5. Messages / Notices (Coupon) */
html body .woocommerce-info,
html body .woocommerce-error,
html body .woocommerce-message {
    background-color: #1a1a1a !important;
    color: #fff !important;
    border-top: 3px solid #ffd700 !important;
    margin-bottom: 30px !important;
}

html body .woocommerce-info::before,
html body .woocommerce-error::before,
html body .woocommerce-message::before {
    color: #ffd700 !important;
}

.woocommerce-info a {
    color: #ffd700;
    text-decoration: underline;
}

.woocommerce-form-coupon {
    border: 1px solid #222;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    background: #111;
}

/* 6. Order Review Tables */
#order_review table.shop_table {
    border: none;
    margin-bottom: 30px;
}

#order_review table.shop_table th,
#order_review table.shop_table td {
    background: transparent;
    border-top: 1px solid #222;
    padding: 15px 0;
}

#order_review table.shop_table tr.cart_item td.product-name {
    color: #fff;
    font-weight: 500;
}

#order_review table.shop_table tr.cart_item .product-quantity {
    color: #888;
}

#order_review table.shop_table tr.order-total th {
    font-weight: 700;
    color: #fff;
}

#order_review table.shop_table tr.order-total td {
    color: #ffd700;
    font-size: 1.5rem;
    font-weight: 800;
}

/* ... (skipped lines) ... */

/* 7. Payment Methods */
#payment {
    background: transparent !important;
}

#payment ul.payment_methods {
    border-bottom: 1px solid #222;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

#payment li.payment_method_stripe label {
    color: #fff;
    font-weight: 500;
}

#payment div.payment_box {
    background-color: #222 !important;
    color: #ccc !important;
    padding: 15px;
    border-radius: 4px;
    margin-top: 10px;
    border: 1px solid #333;
    max-width: 100%;
    /* Ensure box doesn't overflow */
    box-sizing: border-box;
    overflow: hidden;
    /* Clip any overflowing iframes */
}

#payment div.payment_box iframe {
    max-width: 100% !important;
    width: 100% !important;
}

#payment div.payment_box::before {
    border-bottom-color: #222 !important;
}

/* 8. Place Order Button */
#place_order {
    background-color: #ffd700 !important;
    color: #000 !important;
    font-weight: 800;
    font-size: 1rem;
    padding: 20px;
    border-radius: 6px;
    width: 100%;
    margin-top: 10px;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    transition: transform 0.1s;
}

#place_order:hover {
    background-color: #e6c200 !important;
    transform: scale(1.02);
}

/* Mobile */
@media (max-width: 900px) {
    .apex-checkout-layout {
        flex-direction: column;
    }

    .apex-checkout-left,
    .apex-checkout-right {
        flex: 1 1 100%;
        border: none;
        padding: 40px 20px;
    }

    .apex-checkout-right {
        order: -1;
        /* Show Summary first on Mobile? Usually better to show summary collapsed, but sticking to standard flow for now */
        order: 1;
        background: #111;
        border-top: 1px solid #222;
    }

    /* If user wants summary on top on mobile, uncomment: order: -1; */
}

/* =========================================
   9. Thank You Page (Order Received)
   ========================================= */

/* Force full width on the primary container for these pages */
.woocommerce-order-received #primary.container,
.woocommerce-checkout #primary.container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block;
}

/* Hide default page title on these pages */
.woocommerce-order-received .entry-header,
.woocommerce-checkout .entry-header {
    display: none !important;
}

/* Center the Checkout Container */
.apex-checkout-container {
    display: flex;
    flex-wrap: wrap;
    min-height: 100vh;
    width: 100%;
    max-width: 1500px;
    /* Prevent it from being too wide on huge screens */
    margin: 0 auto;
    /* Center it */
    background: #0a0a0a;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    /* Optional: nice shadow if screen is wider than max-width */
}

/* Ensure the wrapper takes full width and centers the card */
.apex-thankyou-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    /* Vertical alignment */
    padding: 60px 20px;
    background: #0a0a0a;
    min-height: 80vh;
    width: 100vw;
    /* Force viewport width */
    margin-left: calc(-50vw + 50%);
    /* Break out of any parent container */
    margin-right: calc(-50vw + 50%);
    box-sizing: border-box;
}

.apex-thankyou-card {
    max-width: 800px;
    width: 100%;
    background: #111;
    padding: 60px;
    border-radius: 8px;
    border: 1px solid #222;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    margin: 0 auto;
    /* Explicit auto margins */
}

.apex-thankyou-success-header {
    margin-bottom: 40px;
    border-bottom: 1px solid #222;
    padding-bottom: 40px;
}

.success-icon-circle {
    width: 80px;
    height: 80px;
    background: #ffd700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: #000;
    font-size: 30px;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.apex-thankyou-card h1 {
    font-size: 2rem;
    color: #fff;
    text-transform: uppercase;
    font-weight: 800;
    margin-bottom: 10px;
}

.email-confirmation-text {
    color: #888;
    font-size: 1rem;
}

/* Order Overview List (Number, Date, Total) */
ul.woocommerce-order-overview {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 0 50px !important;
    width: 100%;
}

ul.woocommerce-order-overview li {
    background: #181818;
    border: 1px solid #282828 !important;
    border-radius: 6px;
    padding: 20px 15px !important;
    margin: 0 !important;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    /* Space between Label and Value */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
    flex: 1 1 200px;
    /* Grow to fill, base 200px */
    max-width: 250px;
    /* Prevent them from looking like wide stripes */
}

ul.woocommerce-order-overview li:hover {
    transform: translateY(-2px);
    border-color: #444 !important;
}

ul.woocommerce-order-overview li:last-child {
    border: 1px solid #282828 !important;
    /* Reset border right override */
}

/* Label Refinement */
ul.woocommerce-order-overview li {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
}

/* Value Refinement */
ul.woocommerce-order-overview li strong {
    display: block;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Order Details Table */
.apex-thankyou-content h2 {
    font-size: 1.5rem;
    color: #fff;
    text-transform: uppercase;
    margin-bottom: 20px;
    text-align: left;
}

.apex-thankyou-content table.shop_table {
    border: none;
    margin-bottom: 40px;
    background: transparent;
    width: 100%;
}

.apex-thankyou-content table.shop_table th,
.apex-thankyou-content table.shop_table td {
    padding: 15px 0;
    border-bottom: 1px solid #222;
    text-align: left;
    color: #ccc;
}

.apex-thankyou-content table.shop_table th {
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.apex-thankyou-content table.shop_table td.product-name a {
    color: #fff;
    font-weight: 500;
}

.apex-thankyou-content table.shop_table tfoot th {
    text-align: right;
    padding-right: 20px;
}

.apex-thankyou-content table.shop_table tfoot td {
    text-align: right;
    color: #fff;
}

.apex-thankyou-content table.shop_table tfoot tr:last-child td {
    color: #ffd700;
    font-size: 1.2rem;
    font-weight: 800;
}

/* Customer Details */
.apex-thankyou-content .woocommerce-customer-details {
    text-align: left;
    background: #151515;
    padding: 30px;
    border-radius: 6px;
}

.apex-thankyou-content .woocommerce-customer-details h2 {
    font-size: 1.2rem;
    margin-top: 0;
    border-bottom: 1px solid #222;
    padding-bottom: 10px;
}

.apex-thankyou-content .woocommerce-customer-details address {
    font-style: normal;
    color: #aaa;
    line-height: 1.6;
    border: none;
    padding: 0;
}

@media (max-width: 768px) {
    .apex-thankyou-card {
        padding: 30px 20px;
    }

    ul.woocommerce-order-overview {
        flex-direction: column;
    }

    ul.woocommerce-order-overview li {
        border-right: none;
        border-bottom: 1px solid #333;
        padding-bottom: 10px;
    }

    ul.woocommerce-order-overview li:last-child {
        border-bottom: none;
    }
}