/* Commerce panels and native fields. */
body.gg-midnight :is(
    .woocommerce, .variations_form, .affwp-form, #affwp-affiliate-dashboard,
    #cfw, #cfw-side-cart, .widget_shopping_cart
) :is(
    .input-text, input[type="text"], input[type="email"], input[type="password"],
    input[type="tel"], input[type="url"], input[type="number"], input[type="search"],
    select, textarea, .select2-selection--single
) {
    color: var(--ggm-text);
    background-color: var(--ggm-bg);
    border-color: var(--ggm-field-border);
    font-family: var(--ggm-font);
    color-scheme: dark;
}

/* The child theme forces its original variation and checkout field colors. */
body.gg-midnight .variations select,
body.gg-midnight .variations select option,
body.gg-midnight.woocommerce-checkout :is(.input-text, select, textarea, .select2-container--default .select2-selection--single) {
    color: var(--ggm-text) !important;
    background-color: var(--ggm-bg) !important;
    border-color: var(--ggm-field-border) !important;
}
body.gg-midnight.woocommerce-checkout :is(.input-text, textarea)::placeholder {
    color: var(--ggm-muted) !important;
}
body.gg-midnight :is(.woocommerce, .affwp-form, #cfw, .dgwt-wcas-search-wrapp) ::placeholder {
    color: var(--ggm-muted);
    opacity: 1;
}
body.gg-midnight :is(.woocommerce, .affwp-form, #cfw) :is(input[type="checkbox"], input[type="radio"]) {
    accent-color: var(--ggm-accent);
}
body.gg-midnight :is(.woocommerce, .affwp-form, #cfw, .dgwt-wcas-search-wrapp) :is(
    .input-text, input:not([type="hidden"]), select, textarea, button, .button, .select2-selection
):focus-visible {
    outline: 2px solid var(--ggm-accent);
    outline-offset: 2px;
}
body.gg-midnight :is(.select2-dropdown, .select2-container--default .select2-search--dropdown .select2-search__field) {
    color: var(--ggm-text);
    background-color: var(--ggm-bg);
    border-color: var(--ggm-field-border);
}
body.gg-midnight .select2-container--default :is(.select2-selection__rendered, .select2-results__option) {
    color: var(--ggm-text);
}
body.gg-midnight .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-top-color: var(--ggm-muted);
}
body.gg-midnight .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-bottom-color: var(--ggm-muted);
}
body.gg-midnight .select2-container--default .select2-results__option[aria-selected="true"] {
    color: var(--ggm-text);
    background-color: var(--ggm-surface);
}
body.gg-midnight .select2-container--default .select2-results__option--highlighted[aria-selected] {
    color: var(--ggm-ink);
    background-color: var(--ggm-accent);
}

body.gg-midnight :is(
    .cart_totals, .woocommerce-MyAccount-navigation, .woocommerce-order-details,
    .woocommerce-customer-details .woocommerce-column address,
    form.woocommerce-form-login, form.woocommerce-form-register, .checkout_coupon,
    .site-header-cart .widget_shopping_cart, .site-header-cart-side, .razox-canvas-filter,
    #payment, #payment .payment_box, .quick-shop-wrapper
) {
    color: var(--ggm-text);
    background-color: var(--ggm-surface);
    border-color: var(--ggm-border);
}
body.gg-midnight :is(.shop_table, .woocommerce-MyAccount-navigation) :is(th, td, li) {
    border-color: var(--ggm-border);
}
body.gg-midnight :is(.shop_table, .woocommerce-MyAccount-navigation) :is(thead th, .is-active > a) {
    color: var(--ggm-text);
    background-color: var(--ggm-surface);
}
body.gg-midnight :is(.woocommerce-MyAccount-navigation, .woocommerce-order-details, #affwp-affiliate-dashboard) a:not(.button) {
    color: var(--ggm-accent);
}
body.gg-midnight :is(
    .single-product div.product table.variations label, .woocommerce-variation-description,
    .woocommerce-MyAccount-content .woocommerce-Addresses .woocommerce-Address address,
    .site-header-cart-side .cart-side-title,
    .site-header-cart-side .widget_shopping_cart .mini_cart_item a
) {
    color: var(--ggm-text);
}
body.gg-midnight .site-header-cart-side .widget_shopping_cart .mini_cart_item:hover {
    background-color: var(--ggm-bg);
}
body.gg-midnight .site-header-cart-side .widget_shopping_cart :is(.mini_cart_item .quantity, .woocommerce-mini-cart__total strong) {
    color: var(--ggm-text);
}
body.gg-midnight .woocommerce-cart-form .quantity_wrap .quantity.buttons_added {
    display: inline-flex;
    inline-size: auto;
    margin: 0;
    padding: 0;
    overflow: visible;
    background: var(--ggm-surface);
    border: 1px solid var(--ggm-field-border);
    border-radius: 6px;
}
body.gg-midnight .woocommerce-cart-form .quantity.buttons_added :is(.minus, .plus) {
    position: static;
    align-items: center;
    inline-size: 44px;
    block-size: 44px;
    border-radius: 5px;
    color: var(--ggm-text);
    font-size: 20px;
}
body.gg-midnight .woocommerce-cart-form .quantity.buttons_added :is(.minus, .plus):is(:hover, :focus-visible) {
    color: var(--ggm-accent-hover);
    background: var(--ggm-bg);
}
body.gg-midnight .woocommerce-cart-form .quantity.buttons_added .qty {
    flex: none;
    inline-size: 3rem;
    block-size: 44px;
    padding: 0;
    background: transparent;
    border-radius: 0;
    border-inline: 1px solid var(--ggm-field-border);
    color: var(--ggm-text);
    font-variant-numeric: tabular-nums;
}
body.gg-midnight .site-header-cart-side .close-cart-side::before,
body.gg-midnight .site-header-cart-side .close-cart-side::after {
    background-color: var(--ggm-text);
}
body.gg-midnight :is(.widget_shopping_cart, .cart_totals, .woocommerce-MyAccount-content) a.button {
    color: var(--ggm-ink);
    background-color: var(--ggm-accent);
    border-color: var(--ggm-accent);
}
body.gg-midnight :is(.widget_shopping_cart, .cart_totals, .woocommerce-MyAccount-content) a.button:hover {
    color: var(--ggm-ink);
    background-color: var(--ggm-accent-hover);
    border-color: var(--ggm-accent-hover);
}

/* Semantic states keep their distinct hues on the dark surfaces. */
body.gg-midnight :is(.woocommerce-message, .woocommerce-info, .woocommerce-error, .woocommerce-noreviews, .cfw-alert-success, .cfw-alert-error, .cfw-alert-info) {
    --ggm-notice-color: var(--ggm-accent-hover);
    --ggm-notice-bg: #172d4a;
    color: var(--ggm-notice-color);
    background-color: var(--ggm-notice-bg);
    border-color: var(--ggm-notice-color);
}
body.gg-midnight :is(.woocommerce-message, .cfw-alert-success) {
    --ggm-notice-color: #86efac;
    --ggm-notice-bg: #143523;
}
body.gg-midnight :is(.woocommerce-error, .cfw-alert-error) {
    --ggm-notice-color: #fecaca;
    --ggm-notice-bg: #451f2b;
}
body.gg-midnight :is(.woocommerce-message, .woocommerce-info, .woocommerce-error) :is(a, strong, .button) {
    color: inherit;
}
body.gg-midnight :is(.woocommerce-message, .woocommerce-info, .woocommerce-error) .button {
    color: var(--ggm-ink);
    background-color: var(--ggm-notice-color);
}
body.gg-midnight.woocommerce-checkout .woocommerce-invalid :is(.input-text, select, .select2-container--default .select2-selection--single) {
    border-color: #fca5a5 !important;
}

/* Search suggestions and mobile overlay are inserted separately from the header form. */
body.gg-midnight :is(.dgwt-wcas-suggestions-wrapp, .dgwt-wcas-details-wrapp, .dgwt-wcas-overlay-mobile, .dgwt-wcas-om-bar) {
    color: var(--ggm-text);
    background-color: var(--ggm-surface);
    border-color: var(--ggm-border);
    font-family: var(--ggm-font);
}
body.gg-midnight .dgwt-wcas-suggestions-wrapp :is(.dgwt-wcas-suggestion, .dgwt-wcas-st, .dgwt-wcas-suggestion-headline) {
    color: var(--ggm-text);
    border-color: var(--ggm-border);
}
body.gg-midnight .dgwt-wcas-suggestions-wrapp :is(.dgwt-wcas-sd, .dgwt-wcas-sp, .dgwt-wcas-sp del) {
    color: var(--ggm-muted);
    opacity: 1;
}
body.gg-midnight .dgwt-wcas-suggestions-wrapp :is(.dgwt-wcas-suggestion-selected, .dgwt-wcas-suggestion:hover) {
    background-color: var(--ggm-bg);
}
body.gg-midnight .dgwt-wcas-suggestions-wrapp :is(.dgwt-wcas-st strong, .dgwt-wcas-suggestion-more) {
    color: var(--ggm-accent-hover);
}
body.gg-midnight .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp,
body.gg-midnight .dgwt-wcas-om-bar button.dgwt-wcas-om-return {
    background-color: var(--ggm-surface);
}
body.gg-midnight .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input {
    color: var(--ggm-ink) !important;
    background-color: #f1f5f9 !important;
    border-color: var(--ggm-field-border);
    font-family: var(--ggm-font);
    color-scheme: light;
}
body.gg-midnight .dgwt-wcas-search-wrapp input.dgwt-wcas-search-input::placeholder {
    color: #475569 !important;
    opacity: 1;
}
body.gg-midnight .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit {
    --ggm-search-button: var(--ggm-accent);
    color: var(--ggm-ink);
    background-color: var(--ggm-search-button);
}
body.gg-midnight .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:is(:hover, :focus-visible) {
    --ggm-search-button: var(--ggm-accent-hover);
    opacity: 1;
}
body.gg-midnight .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit::before {
    border-right-color: var(--ggm-search-button);
}
body.gg-midnight.rtl .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit::before {
    border-left-color: var(--ggm-search-button);
}
body.gg-midnight .dgwt-wcas-overlay-mobile .dgwt-wcas-om-return svg {
    fill: var(--ggm-muted);
}
body.gg-midnight .dgwt-wcas-search-wrapp :is(.dgwt-wcas-sf-wrapp .dgwt-wcas-ico-magnifier, .dgwt-wcas-search-submit svg path) {
    fill: var(--ggm-ink);
}

/* WPC product tools retain their existing layout and controls. */
body.gg-midnight :is(
    .woosw-popup.woosw-show .woosw-popup-inner .woosw-popup-content :is(.woosw-popup-content-mid, .woosw-popup-content-bot),
    .woosc-area .woosc-inner .woosc-table .woosc-table-inner,
    .woosc-area .woosc-inner .woosc-table .woosc-table-inner .woosc-table-items table :is(th, td),
    .woosq-popup .woosq-product
) {
    color: var(--ggm-text);
    background-color: var(--ggm-surface);
    border-color: var(--ggm-border);
}
body.gg-midnight .woosw-popup.woosw-show .woosw-popup-inner .woosw-popup-content :is(.woosw-items, .woosw-item--name a, .woosw-popup-content-bot-inner a) {
    color: var(--ggm-text);
}

/* CheckoutWC also paints the root using its generated custom property. */
html:has(> body.gg-midnight) {
    --cfw-body-background-color: #111827;
}

/* CheckoutWC templates read these properties for their own page and side cart. */
body.gg-midnight :is(#place_order, .cfw-primary-btn, .cfw-secondary-btn) .cfw-button-text {
    color: inherit !important;
}
body.gg-midnight {
    --cfw-body-background-color: var(--ggm-bg);
    --cfw-body-text-color: var(--ggm-text);
    --cfw-body-link-color: var(--ggm-accent);
    --cfw-body-font-family: var(--ggm-font);
    --cfw-heading-font-family: var(--ggm-font);
    --cfw-header-background-color: var(--ggm-surface);
    --cfw-header-text-color: var(--ggm-text);
    --cfw-footer-background-color: var(--ggm-bg);
    --cfw-footer-text-color: var(--ggm-muted);
    --cfw-cart-summary-background-color: var(--ggm-surface);
    --cfw-cart-summary-mobile-background-color: var(--ggm-surface);
    --cfw-cart-summary-text-color: var(--ggm-text);
    --cfw-cart-summary-link-color: var(--ggm-accent);
    --cfw-cart-summary-order-total-text-color: var(--ggm-text);
    --cfw-cart-summary-item-quantity-background-color: var(--ggm-accent);
    --cfw-cart-summary-item-quantity-text-color: var(--ggm-ink);
    --cfw-horizontal-divider-color: var(--ggm-border);
    --cfw-buttons-primary-background-color: var(--ggm-accent);
    --cfw-buttons-primary-text-color: var(--ggm-ink);
    --cfw-buttons-primary-hover-background-color: var(--ggm-accent-hover);
    --cfw-buttons-primary-hover-text-color: var(--ggm-ink);
    --cfw-buttons-primary-disabled-background-color: var(--ggm-field-border);
    --cfw-buttons-secondary-background-color: var(--ggm-bg);
    --cfw-buttons-secondary-text-color: var(--ggm-text);
    --cfw-buttons-secondary-hover-background-color: var(--ggm-border);
    --cfw-buttons-secondary-hover-text-color: var(--ggm-text);
    --cfw-breadcrumb-completed-accent-color: var(--ggm-accent);
    --cfw-breadcrumb-completed-text-color: var(--ggm-accent);
    --cfw-breadcrumb-current-accent-color: var(--ggm-text);
    --cfw-breadcrumb-current-text-color: var(--ggm-text);
    --cfw-breadcrumb-next-accent-color: var(--ggm-muted);
    --cfw-breadcrumb-next-text-color: var(--ggm-muted);
}

body.gg-midnight :is(#cfw, #cfw-side-cart) :is(
    .cfw-module, .cfw-radio-reveal-group, .cfw-radio-reveal-content, .cfw-radio-reveal-title-wrap,
    .cfw-side-cart-contents, .cfw-side-cart-free-shipping-progress-wrap
) {
    color: var(--ggm-text);
    background-color: var(--ggm-surface);
    border-color: var(--ggm-border);
}

/* CheckoutWC sets important field borders and renders its own check marks. */
body.gg-midnight :is(#cfw, #cfw-cart-summary) label.cfw-floatable-label {
    color: var(--ggm-muted);
}
body.gg-midnight :is(#cfw, #cfw-cart-summary) .woocommerce-invalid label.cfw-floatable-label {
    color: #fca5a5;
}
body.gg-midnight .cfw-quantity-stepper,
body.gg-midnight .cfw-quantity-stepper :is(.cfw-quantity-stepper-btn-minus, .cfw-quantity-stepper-btn-plus) {
    border-color: var(--ggm-field-border);
}
body.gg-midnight .cfw-quantity-stepper :is(.cfw-quantity-stepper-btn-minus, .cfw-quantity-stepper-btn-plus) svg {
    fill: var(--ggm-text);
}
body.gg-midnight .cfw-quantity-stepper :is(.cfw-quantity-stepper-btn-minus, .cfw-quantity-stepper-btn-plus):not(.cfw-disabled):hover {
    background: var(--ggm-border);
}
body.gg-midnight .cfw-quantity-stepper .cfw-disabled:hover {
    background: transparent;
}
body.gg-midnight .cfw-quantity-stepper .cfw-disabled svg {
    fill: var(--ggm-muted);
}
body.gg-midnight #cfw :where(.form-row, #cfw-cart-summary) :is(
    input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
    input[type="number"], select, textarea
) {
    border-color: var(--ggm-field-border) !important;
}
body.gg-midnight #cfw :where(.form-row, #cfw-cart-summary) :is(
    input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
    input[type="number"], select, textarea
)::placeholder {
    color: var(--ggm-muted);
}
body.gg-midnight #cfw .woocommerce-invalid :is(input:not([type="hidden"]), select, textarea) {
    border-color: #fca5a5 !important;
}
body.gg-midnight #cfw :is(input[type="checkbox"], input[type="radio"]) {
    background-color: var(--ggm-bg);
    border-color: var(--ggm-field-border);
}
body.gg-midnight #cfw input[type="radio"]::after {
    background-color: transparent;
}
body.gg-midnight #cfw :is(input[type="checkbox"], input[type="radio"]):checked {
    box-shadow: inset 0 0 0 10px var(--ggm-accent);
}
body.gg-midnight #cfw input[type="radio"]:checked::after {
    background-color: var(--ggm-ink);
}
body.gg-midnight #cfw input[type="checkbox"]:checked::after {
    filter: brightness(0);
}

/* Product metadata, benefits, and recommendations. */
body.gg-midnight :is(
    .gg-game-info, .razox-sticky-add-to-cart, .razox-product-pagination .product-item,
    .gag-promotion-card
) {
    background-color: var(--ggm-surface);
    color: var(--ggm-text);
    border-color: var(--ggm-border);
}
body.gg-midnight .gg-game-info .gg-game-info__row {
    border-color: var(--ggm-border);
    background: var(--ggm-surface);
}
body.gg-midnight .gg-game-info .gg-game-info__row:nth-child(even) {
    background: var(--ggm-bg);
}
body.gg-midnight .gg-game-info__label {
    color: var(--ggm-accent);
}
body.gg-midnight :is(
    .gg-game-info__value, .razox-product-pagination__title,
    .gag-promotion-card .gag-promotion-copy strong
) {
    color: var(--ggm-text);
}
/* The active theme's product trust cards force their original red styling. */
body.gg-midnight .entry-summary .razox-single-product-extra-description ul li {
    background-color: var(--ggm-surface) !important;
    border-color: var(--ggm-border) !important;
    color: var(--ggm-text) !important;
}
body.gg-midnight .entry-summary .razox-single-product-extra-description ul li:hover {
    border-color: var(--ggm-accent) !important;
}
body.gg-midnight .entry-summary .razox-single-product-extra-description ul li .gg-trust-icon {
    background: #1e3a5f !important;
}
body.gg-midnight .entry-summary .razox-single-product-extra-description .gg-feature-copy > span {
    color: var(--ggm-muted);
}
body.gg-midnight .entry-summary .razox-single-product-extra-description ul li .gg-trust-icon,
body.gg-midnight .entry-summary .razox-single-product-extra-description ul li .gg-trust-icon i {
    color: var(--ggm-accent) !important;
}
body.gg-midnight .gag-promotion-card .gag-promotion-saving {
    color: #86efac;
}
body.gg-midnight :is(.razox-sticky-add-to-cart__content-button, .gag-promotion-add, .woosw-content-item--add p > a) {
    color: var(--ggm-ink);
    background-color: var(--ggm-accent);
    border-color: var(--ggm-accent);
}
body.gg-midnight :is(.razox-sticky-add-to-cart__content-button, .gag-promotion-add, .woosw-content-item--add p > a):hover {
    color: var(--ggm-ink);
    background-color: var(--ggm-accent-hover);
    border-color: var(--ggm-accent-hover);
}
body.gg-midnight :is(.label-wrapper > span, .wc-block-grid__product-onsale, .product-label, .onsale, .stock-label) {
    color: var(--ggm-ink);
    background-color: var(--ggm-accent);
}
body.gg-midnight :is(.stock.in-stock, .woocommerce-order .woocommerce-thankyou-order-received) {
    color: #86efac;
}
body.gg-midnight .inventory_status {
    color: var(--ggm-ink);
}
body.gg-midnight .inventory_status.out-stock {
    color: var(--ggm-muted);
    background-color: transparent;
}
body.gg-midnight .stock.out-of-stock {
    color: #fca5a5;
}
body.gg-midnight :is(
    .woocommerce-cart button[name="apply_coupon"], .woocommerce-cart button[name="update_cart"],
    .woocommerce-form-login button[type="submit"], .woocommerce-form-register button[type="submit"],
    .woocommerce-EditAccountForm button[type="submit"], .woocommerce-ResetPassword button[type="submit"],
    .affwp-form input[type="submit"], .affwp-form button[type="submit"]
) {
    color: var(--ggm-ink);
    background-color: var(--ggm-accent);
    border-color: var(--ggm-accent);
}
body.gg-midnight :is(
    .woocommerce-cart button[name="apply_coupon"], .woocommerce-cart button[name="update_cart"],
    .woocommerce-form-login button[type="submit"], .woocommerce-form-register button[type="submit"],
    .woocommerce-EditAccountForm button[type="submit"], .woocommerce-ResetPassword button[type="submit"],
    .affwp-form input[type="submit"], .affwp-form button[type="submit"]
):hover {
    color: var(--ggm-ink);
    background-color: var(--ggm-accent-hover);
    border-color: var(--ggm-accent-hover);
}
