/* ============================================================
   TunerDB Checkout — Clean Enterprise (Dark + Light Mode)
   Stripe-inspired minimal with micro-interactions
   ============================================================ */

:root {
    /* Dark mode (default) */
    --co-bg: #0B0B0F;
    --co-surface: rgba(255, 255, 255, 0.02);
    --co-surface-hover: rgba(255, 255, 255, 0.04);
    --co-surface-solid: #15151D;
    --co-border: rgba(255, 255, 255, 0.08);
    --co-border-strong: rgba(255, 255, 255, 0.14);
    --co-border-focus: #FF6B00;
    --co-text: #F8FAFC;
    --co-text-muted: #94A3B8;
    --co-text-dim: #64748B;
    --co-accent: #FF6B00;
    --co-accent-hover: #FF8533;
    --co-accent-glow: rgba(255, 107, 0, 0.18);
    --co-success: #10B981;
    --co-error: #EF4444;
    --co-input-bg: rgba(255, 255, 255, 0.035);
    --co-input-bg-focus: rgba(255, 255, 255, 0.055);
    --co-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --co-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --co-shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.25);
    --co-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --co-ease-snap: cubic-bezier(0.3, 0, 0, 1);
}

body.light-mode {
    --co-bg: #F8FAFC;
    --co-surface: #FFFFFF;
    --co-surface-hover: #F1F5F9;
    --co-surface-solid: #FFFFFF;
    --co-border: #E2E8F0;
    --co-border-strong: #CBD5E1;
    --co-text: #0F172A;
    --co-text-muted: #475569;
    --co-text-dim: #94A3B8;
    --co-accent-glow: rgba(255, 107, 0, 0.12);
    --co-input-bg: #FFFFFF;
    --co-input-bg-focus: #FFFFFF;
    --co-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --co-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --co-shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.08);
}

/* ========== KILL BROKEN WC NATIVE ICONS ========== */
body .woocommerce-info::before,
body .woocommerce-info::after,
body .woocommerce-message::before,
body .woocommerce-error::before,
body .wc-block-components-notice-banner::before {
    content: "" !important;
    display: none !important;
    visibility: hidden !important;
    font-size: 0 !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: none !important;
    opacity: 0 !important;
    position: static !important;
}

body .woocommerce-info {
    padding-left: 0 !important;
}

/* ========== KILL ALL WRAPPER CARDS ========== */
body .woocommerce-checkout #customer_details,
body .woocommerce-checkout .woocommerce-billing-fields,
body .woocommerce-checkout #order_review,
body .woocommerce-checkout .woocommerce-checkout-payment,
body .woocommerce-checkout .woocommerce-terms-and-conditions-wrapper {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* ========== GRID LAYOUT: Express (full-width) → Billing | Order ========== */
form.checkout.woocommerce-checkout {
    display: grid !important;
    grid-template-columns: 1fr 400px !important;
    grid-template-rows: auto auto auto !important;
    gap: 1.5rem 3rem !important;
    align-items: start !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
}

/* Express Checkout: spans full width, row 1 */
form.checkout #wc-stripe-express-checkout-element,
form.checkout .wc-stripe-express-checkout-element {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    position: relative !important;
    padding: 1.25rem 1.5rem !important;
    background: var(--co-surface) !important;
    border: 1px solid var(--co-border) !important;
    border-radius: 14px !important;
    margin: 0 !important;
    animation: co-fade-in 400ms var(--co-ease) both !important;
}

/* Express Checkout label above buttons */
form.checkout #wc-stripe-express-checkout-element::before {
    content: "" !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: static !important;
    font-size: 0.688rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.15em !important;
    color: var(--co-text-muted) !important;
    text-transform: uppercase !important;
    margin-bottom: 0 !important;
    font-family: inherit !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    background: none !important;
}

/* OR Divider between express & billing */
.wc-stripe-express-checkout-divider {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    display: none !important;
}

/* Billing: col 1, row 2-3 (spans to match order column height) */
form.checkout #customer_details {
    grid-column: 1 !important;
    grid-row: 2 / 4 !important;
}

/* Order heading: col 2, row 2 */
form.checkout h3#order_review_heading {
    grid-column: 2 !important;
    grid-row: 2 !important;
    margin: 0 !important;
}

/* Order review: col 2, row 3, sticky */
form.checkout #order_review {
    grid-column: 2 !important;
    grid-row: 3 !important;
    position: sticky !important;
    top: 1rem !important;
}

/* Mobile: single column */
@media (max-width: 960px) {
    form.checkout.woocommerce-checkout {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }
    form.checkout #customer_details,
    form.checkout h3#order_review_heading,
    form.checkout #order_review,
    form.checkout #wc-stripe-express-checkout-element {
        grid-column: 1 !important;
        grid-row: auto !important;
        position: relative !important;
        top: 0 !important;
    }
}

/* ========== TOP BAR: Returning customer + Coupon ========== */
.woocommerce-form-login-toggle,
.woocommerce-form-coupon-toggle {
    display: inline-block !important;
    margin: 0 1.5rem 0.5rem 0 !important;
}

.woocommerce-form-login-toggle .woocommerce-info,
.woocommerce-form-coupon-toggle .woocommerce-info {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    color: var(--co-text-muted) !important;
    font-size: 0.875rem !important;
    display: inline !important;
    box-shadow: none !important;
}

.woocommerce-info a.showlogin,
.woocommerce-info a.showcoupon {
    color: var(--co-accent) !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    border-bottom: 1px dashed transparent !important;
    transition: border-color 200ms var(--co-ease) !important;
}

.woocommerce-info a.showlogin:hover,
.woocommerce-info a.showcoupon:hover {
    border-bottom-color: var(--co-accent) !important;
}

/* ========== HIDE DEFAULT H1 "Secure Checkout" ========== */
body.woocommerce-checkout h1.entry-title,
body.woocommerce-checkout > .entry-header h1,
body.woocommerce-checkout .page-title {
    display: none !important;
}

/* ========== SECTION HEADINGS ========== */
.woocommerce-billing-fields > h3,
.woocommerce-billing-fields h3,
.woocommerce-additional-fields > h3,
h3#order_review_heading {
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    color: var(--co-text-muted) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.12em !important;
    margin: 0 0 1rem 0 !important;
    padding: 0 0 0.75rem 0 !important;
    border-bottom: 1px solid var(--co-border) !important;
}

/* ========== BILLING 2-COL GRID ========== */
.woocommerce-billing-fields__field-wrapper {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem 1rem !important;
}

#billing_email_field,
#billing_country_field,
#billing_address_1_field {
    grid-column: 1 / -1 !important;
}

@media (max-width: 640px) {
    .woocommerce-billing-fields__field-wrapper {
        grid-template-columns: 1fr !important;
    }
}

.woocommerce-checkout .form-row {
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    width: auto !important;
}

.woocommerce-checkout .form-row-first,
.woocommerce-checkout .form-row-last,
.woocommerce-checkout .form-row-wide {
    width: auto !important;
    float: none !important;
    margin: 0 !important;
}

/* ========== LABELS ========== */
.woocommerce-checkout label {
    color: var(--co-text) !important;
    font-weight: 600 !important;
    font-size: 0.813rem !important;
    margin: 0 0 0.375rem 0 !important;
    display: block !important;
    line-height: 1.4 !important;
}

.woocommerce-checkout .required {
    color: var(--co-accent) !important;
    font-weight: 700 !important;
    text-decoration: none !important;
}

.woocommerce-checkout .optional {
    color: var(--co-text-dim) !important;
    font-weight: 400 !important;
    font-size: 0.688rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    margin-left: 0.375rem !important;
}

/* ========== INPUTS ========== */
.woocommerce-checkout input[type="text"],
.woocommerce-checkout input[type="email"],
.woocommerce-checkout input[type="tel"],
.woocommerce-checkout input[type="password"],
.woocommerce-checkout input[type="number"],
.woocommerce-checkout select,
.woocommerce-checkout textarea,
.select2-container--default .select2-selection--single {
    background: var(--co-input-bg) !important;
    border: 1px solid var(--co-border) !important;
    border-radius: 10px !important;
    color: var(--co-text) !important;
    padding: 0.625rem 0.875rem !important;
    font-size: 0.938rem !important;
    line-height: 1.5 !important;
    min-height: 44px !important;
    width: 100% !important;
    box-shadow: none !important;
    transition: border-color 200ms var(--co-ease), box-shadow 200ms var(--co-ease), background 200ms var(--co-ease), transform 200ms var(--co-ease) !important;
}

.woocommerce-checkout input:hover:not(:focus),
.woocommerce-checkout select:hover:not(:focus),
.woocommerce-checkout textarea:hover:not(:focus) {
    border-color: var(--co-border-strong) !important;
}

.woocommerce-checkout input:focus,
.woocommerce-checkout select:focus,
.woocommerce-checkout textarea:focus,
.select2-container--default.select2-container--focus .select2-selection--single {
    outline: none !important;
    border-color: var(--co-border-focus) !important;
    box-shadow: 0 0 0 3px var(--co-accent-glow) !important;
    background: var(--co-input-bg-focus) !important;
    transform: translateY(-1px) !important;
}

.woocommerce-checkout input::placeholder,
.woocommerce-checkout textarea::placeholder {
    color: var(--co-text-dim) !important;
    opacity: 1 !important;
}

/* Select2 styling */
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--co-text) !important;
    line-height: 44px !important;
    padding-left: 0 !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 44px !important;
    right: 10px !important;
}

.select2-container--open .select2-dropdown {
    background: var(--co-surface-solid) !important;
    border: 1px solid var(--co-border) !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    box-shadow: var(--co-shadow-lg) !important;
}

.select2-search--dropdown .select2-search__field {
    background: var(--co-input-bg) !important;
    border: 1px solid var(--co-border) !important;
    color: var(--co-text) !important;
    border-radius: 8px !important;
}

.select2-results__option {
    background: transparent !important;
    color: var(--co-text) !important;
    padding: 0.625rem 0.875rem !important;
}

.select2-results__option--highlighted {
    background: var(--co-accent) !important;
    color: #FFFFFF !important;
}

/* ========== ORDER TABLE ========== */
.shop_table {
    background: transparent !important;
    border: none !important;
    width: 100% !important;
    border-collapse: collapse !important;
}

.shop_table th,
.shop_table td {
    background: transparent !important;
    border-color: var(--co-border) !important;
    border-width: 0 0 1px 0 !important;
    color: var(--co-text) !important;
    padding: 0.75rem 0 !important;
    font-size: 0.875rem !important;
}

.shop_table thead th {
    font-size: 0.688rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.12em !important;
    color: var(--co-text-muted) !important;
    font-weight: 700 !important;
    padding-bottom: 0.625rem !important;
}

.shop_table .cart_item td {
    padding: 0.875rem 0 !important;
}

.shop_table .cart-subtotal th,
.shop_table .cart-subtotal td {
    color: var(--co-text-muted) !important;
    font-size: 0.875rem !important;
    padding: 0.625rem 0 !important;
}

.shop_table .order-total th,
.shop_table .order-total td {
    border: none !important;
    padding-top: 1rem !important;
}

.shop_table .order-total th {
    font-size: 0.938rem !important;
    font-weight: 700 !important;
    color: var(--co-text) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

.shop_table .order-total .amount {
    color: var(--co-accent) !important;
    font-size: 1.5rem !important;
    font-weight: 800 !important;
}

.shop_table .product-name {
    color: var(--co-text) !important;
    font-weight: 500 !important;
}

.shop_table .product-total .amount {
    color: var(--co-text) !important;
    font-weight: 600 !important;
}

/* ========== PAYMENT METHODS ========== */
.wc_payment_methods {
    list-style: none !important;
    padding: 0 !important;
    margin: 1.25rem 0 1rem 0 !important;
}

.wc_payment_method {
    background: transparent !important;
    border: 1px solid var(--co-border) !important;
    border-radius: 12px !important;
    padding: 0.875rem 1rem !important;
    margin-bottom: 0.625rem !important;
    transition: border-color 200ms var(--co-ease), background 200ms var(--co-ease) !important;
    cursor: pointer !important;
}

.wc_payment_method:hover {
    border-color: var(--co-border-strong) !important;
    background: var(--co-surface-hover) !important;
}

.wc_payment_method:has(input[type="radio"]:checked),
.wc_payment_method input[type="radio"]:checked ~ label {
    border-color: var(--co-accent) !important;
}

.payment_box {
    background: transparent !important;
    border: none !important;
    padding: 0.875rem 0 0 0 !important;
    margin: 0 !important;
    color: var(--co-text-muted) !important;
    font-size: 0.875rem !important;
}

/* ========== PLACE ORDER BUTTON ========== */
#place_order {
    background: linear-gradient(135deg, #FF6B00 0%, #FF8533 100%) !important;
    border: none !important;
    border-radius: 12px !important;
    color: #0B0B0F !important;
    font-weight: 800 !important;
    font-size: 1rem !important;
    padding: 0.875rem 2rem !important;
    min-height: 52px !important;
    width: 100% !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    cursor: pointer !important;
    transition: transform 200ms var(--co-ease), box-shadow 200ms var(--co-ease) !important;
    box-shadow: 0 4px 14px rgba(255, 107, 0, 0.25) !important;
    margin-top: 1rem !important;
    position: relative !important;
    overflow: hidden !important;
    isolation: isolate !important;
}

#place_order::after {
    content: "" !important;
    position: absolute !important;
    top: 0 !important;
    left: -100% !important;
    width: 100% !important;
    height: 100% !important;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent) !important;
    transition: left 700ms var(--co-ease-snap) !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: -1 !important;
    font-size: 0 !important;
}

#place_order:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 8px 24px rgba(255, 107, 0, 0.35) !important;
}

#place_order:hover::after {
    left: 100% !important;
}

#place_order:active {
    transform: translateY(0) !important;
    transition-duration: 80ms !important;
}

#place_order:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* ========== TERMS CHECKBOX ========== */
.woocommerce-terms-and-conditions-wrapper {
    margin: 1rem 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
}

.woocommerce-terms-and-conditions-wrapper label,
.form-row label.woocommerce-form__label-for-checkbox {
    display: flex !important;
    align-items: flex-start !important;
    gap: 0.625rem !important;
    cursor: pointer !important;
    color: var(--co-text-muted) !important;
    font-size: 0.813rem !important;
    font-weight: 400 !important;
    margin: 0 !important;
    line-height: 1.5 !important;
}

input[type="checkbox"] {
    width: 16px !important;
    height: 16px !important;
    margin-top: 2px !important;
    accent-color: var(--co-accent) !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    border-radius: 4px !important;
}

.woocommerce-privacy-policy-text {
    font-size: 0.75rem !important;
    color: var(--co-text-dim) !important;
    margin: 0.75rem 0 !important;
    line-height: 1.6 !important;
}

.woocommerce-privacy-policy-text a,
.woocommerce-terms-and-conditions-wrapper a {
    color: var(--co-accent) !important;
    text-decoration: none !important;
    border-bottom: 1px dashed transparent !important;
    transition: border-color 200ms var(--co-ease) !important;
}

.woocommerce-privacy-policy-text a:hover,
.woocommerce-terms-and-conditions-wrapper a:hover {
    border-bottom-color: var(--co-accent) !important;
}

/* ========== VALIDATION STATES ========== */
.woocommerce-checkout .form-row.woocommerce-invalid input,
.woocommerce-checkout .form-row.woocommerce-invalid select {
    border-color: var(--co-error) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.woocommerce-checkout .form-row.woocommerce-validated input,
.woocommerce-checkout .form-row.woocommerce-validated select {
    border-color: var(--co-success) !important;
}

/* ========== ANIMATIONS ========== */
@keyframes co-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

form.checkout #customer_details,
form.checkout #order_review {
    animation: co-fade-in 400ms var(--co-ease) both !important;
}

form.checkout #customer_details { animation-delay: 80ms !important; }
form.checkout h3#order_review_heading { animation: co-fade-in 400ms var(--co-ease) 100ms both !important; }
form.checkout #order_review { animation-delay: 140ms !important; }

@media (prefers-reduced-motion: reduce) {
    form.checkout *,
    form.checkout *::before,
    form.checkout *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
    #place_order:hover { transform: none !important; }
}

/* ========== MOBILE REFINEMENTS ========== */
@media (max-width: 768px) {
    .woocommerce-form-login-toggle,
    .woocommerce-form-coupon-toggle {
        display: block !important;
        margin: 0 0 0.5rem 0 !important;
    }
    #place_order { font-size: 0.938rem !important; }
}


/* ========== TRUST STRIP (between express & billing, full-width) ========== */
.co-trust-strip {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    padding: 1rem 1.25rem !important;
    background: transparent !important;
    border-top: 1px solid var(--co-border) !important;
    border-bottom: 1px solid var(--co-border) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.625rem !important;
    align-items: center !important;
    text-align: center !important;
    animation: co-fade-in 400ms var(--co-ease) 100ms both !important;
}

.co-trust-payments {
    display: flex !important;
    gap: 0.5rem !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
}

.co-pay {
    display: inline-flex !important;
    align-items: center !important;
    opacity: 0.85 !important;
    transition: opacity 200ms var(--co-ease), transform 200ms var(--co-ease) !important;
    cursor: default !important;
    border-radius: 4px !important;
    line-height: 0 !important;
}

.co-pay:hover {
    opacity: 1 !important;
    transform: translateY(-1px) !important;
}

.co-pay svg {
    display: block !important;
    border-radius: 4px !important;
}

.co-trust-badges {
    display: flex !important;
    gap: 1.25rem !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
}

.co-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.375rem !important;
    color: var(--co-text-muted) !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em !important;
}

.co-badge svg {
    color: var(--co-accent) !important;
    flex-shrink: 0 !important;
}

.co-trust-note {
    color: var(--co-text-dim) !important;
    font-size: 0.688rem !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    max-width: 520px !important;
    font-style: italic !important;
    opacity: 0.8 !important;
}

/* Shift billing rows down (was 2/4, now 3/5) */
form.checkout #customer_details {
    grid-row: 3 / 5 !important;
}
form.checkout h3#order_review_heading {
    grid-row: 3 !important;
}
form.checkout #order_review {
    grid-row: 4 !important;
}

/* Mobile: reset rows */
@media (max-width: 960px) {
    form.checkout .co-trust-strip {
        grid-column: 1 !important;
        grid-row: auto !important;
        padding: 0.875rem 0 !important;
    }
    .co-trust-badges {
        gap: 0.875rem !important;
    }
    .co-badge {
        font-size: 0.688rem !important;
    }
}

@media (max-width: 480px) {
    .co-pay svg {
        width: 36px !important;
        height: 23px !important;
    }
}


/* ========== KILL Stripe Express Checkout OR separator (we have trust strip) ========== */
body form.checkout #wc-stripe-express-checkout-button-separator,
body form.checkout .wc-stripe-express-checkout-divider,
body p#wc-stripe-express-checkout-button-separator {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 0 !important;
    opacity: 0 !important;
}
