/*
 * Dark adapter for customized storefront pages.
 * All colors come from the project's built-in Material dark tokens.
 */
:root[data-theme="dark"] body,
:root[data-theme="dark"] body.sf-body,
:root[data-theme="dark"] .sf-layout,
:root[data-theme="dark"] .sf-workspace,
:root[data-theme="dark"] .auth-wrapper {
    color: var(--md-on-surface);
    background: var(--md-bg);
}

:root[data-theme="dark"] .sf-sidebar,
:root[data-theme="dark"] .sf-brand-row,
:root[data-theme="dark"] .sf-account,
:root[data-theme="dark"] .sf-topbar {
    background: var(--md-surface);
    border-color: var(--md-divider);
    box-shadow: var(--md-e2);
}

:root[data-theme="dark"] .sf-brand,
:root[data-theme="dark"] .sf-brand__name,
:root[data-theme="dark"] .sf-page-title strong,
:root[data-theme="dark"] .sf-account__user,
:root[data-theme="dark"] .sf-topbar__account {
    color: var(--md-on-surface);
}

:root[data-theme="dark"] .sf-page-title small,
:root[data-theme="dark"] .sf-nav__label,
:root[data-theme="dark"] .sf-account__meta small,
:root[data-theme="dark"] .sf-smm-platform__toggle small,
:root[data-theme="dark"] .sf-smm-type small {
    color: var(--md-on-surface-dis);
}

:root[data-theme="dark"] .sf-nav__link,
:root[data-theme="dark"] .sf-nav__parent,
:root[data-theme="dark"] .sf-nav__child,
:root[data-theme="dark"] .sf-nav__product-toggle,
:root[data-theme="dark"] .sf-nav__action,
:root[data-theme="dark"] .sf-smm-type,
:root[data-theme="dark"] .sf-icon-button {
    color: var(--md-nav-fg);
}

:root[data-theme="dark"] .sf-nav__link:hover,
:root[data-theme="dark"] .sf-nav__parent:hover,
:root[data-theme="dark"] .sf-nav__child:hover,
:root[data-theme="dark"] .sf-nav__product-toggle:hover,
:root[data-theme="dark"] .sf-nav__action:hover,
:root[data-theme="dark"] .sf-smm-type:hover,
:root[data-theme="dark"] .sf-icon-button:hover,
:root[data-theme="dark"] .sf-account__user:hover {
    color: var(--md-on-surface);
    background: var(--md-hover-overlay);
}

:root[data-theme="dark"] .sf-nav__link.active,
:root[data-theme="dark"] .sf-nav__group.active > .sf-nav__parent,
:root[data-theme="dark"] .sf-nav__child.active,
:root[data-theme="dark"] .sf-nav__product.active > .sf-nav__product-toggle,
:root[data-theme="dark"] .sf-nav__action.active,
:root[data-theme="dark"] .sf-smm-type.active {
    color: var(--md-primary);
    background: var(--md-selected-overlay);
}

:root[data-theme="dark"] .sf-nav__children,
:root[data-theme="dark"] .sf-nav__actions {
    border-color: var(--md-divider);
}

:root[data-theme="dark"] .sf-account__actions a {
    color: var(--md-on-surface-med);
    background: var(--md-surface-2);
    border-color: var(--md-divider);
}

:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .acg-card,
:root[data-theme="dark"] .proxy-purchase__summary,
:root[data-theme="dark"] .proxy-purchase__product,
:root[data-theme="dark"] .upstream-panel,
:root[data-theme="dark"] .upstream-list,
:root[data-theme="dark"] .upstream-item,
:root[data-theme="dark"] .upstream-checkout,
:root[data-theme="dark"] .sms-order-lines,
:root[data-theme="dark"] .sms-detail-order,
:root[data-theme="dark"] .sms-detail-item,
:root[data-theme="dark"] .sms-detail-codes > div,
:root[data-theme="dark"] .smm-catalog,
:root[data-theme="dark"] .smm-platforms,
:root[data-theme="dark"] .smm-types,
:root[data-theme="dark"] .smm-service-list,
:root[data-theme="dark"] .smm-service,
:root[data-theme="dark"] .smm-order-summary,
:root[data-theme="dark"] .long-rental-list,
:root[data-theme="dark"] .long-rental-product,
:root[data-theme="dark"] .long-rental-checkout,
:root[data-theme="dark"] .geonode-products,
:root[data-theme="dark"] .geonode-product,
:root[data-theme="dark"] .geonode-checkout,
:root[data-theme="dark"] .sms-record-detail,
:root[data-theme="dark"] .sms-record-detail__messages > div,
:root[data-theme="dark"] .auth-card {
    color: var(--md-on-surface);
    background: var(--md-surface);
    border-color: var(--md-divider);
    box-shadow: var(--md-e1);
}

:root[data-theme="dark"] .panel-header,
:root[data-theme="dark"] .table > thead > tr > *,
:root[data-theme="dark"] .bootstrap-table .table > thead > tr > th {
    color: var(--md-on-surface);
    background: var(--md-surface-2);
    border-color: var(--md-divider);
}

:root[data-theme="dark"] .panel-body,
:root[data-theme="dark"] .table,
:root[data-theme="dark"] .table > :not(caption) > * > * {
    color: var(--md-on-surface);
    background-color: transparent;
    border-color: var(--md-divider);
}

:root[data-theme="dark"] .form-control,
:root[data-theme="dark"] .form-select,
:root[data-theme="dark"] .layui-input,
:root[data-theme="dark"] .layui-select,
:root[data-theme="dark"] .layui-textarea,
:root[data-theme="dark"] .select2-container--default .select2-selection--single,
:root[data-theme="dark"] .select2-container--default .select2-selection--multiple,
:root[data-theme="dark"] .form-floating > .form-control,
:root[data-theme="dark"] .form-floating > .form-control-plaintext {
    color: var(--md-on-surface);
    background: var(--md-surface-2);
    border-color: var(--md-outline);
}

:root[data-theme="dark"] .form-control::placeholder,
:root[data-theme="dark"] .layui-input::placeholder,
:root[data-theme="dark"] .layui-textarea::placeholder {
    color: #aeb8c6;
    opacity: 1;
}

/* Restore an explicit dropdown affordance after the dark background override. */
:root[data-theme="dark"] .form-select {
    padding-right: 2.35rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='12' viewBox='0 0 16 12'%3e%3cpath fill='none' stroke='%23e8edf4' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m3 4 5 5 5-5'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    background-size: 16px 12px;
}

:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] .btn-primary:hover,
:root[data-theme="dark"] .btn-primary:focus,
:root[data-theme="dark"] .btn-primary:active,
:root[data-theme="dark"] .sf-account__actions .btn-primary {
    color: #ffffff !important;
}

:root[data-theme="dark"] .btn-primary:disabled,
:root[data-theme="dark"] .btn-primary.disabled {
    color: #ffffff !important;
    opacity: .66;
}

:root[data-theme="dark"] .text-muted,
:root[data-theme="dark"] .proxy-purchase__note,
:root[data-theme="dark"] .upstream-item__text small,
:root[data-theme="dark"] .smm-service small,
:root[data-theme="dark"] .long-rental-product small,
:root[data-theme="dark"] .geonode-product small,
:root[data-theme="dark"] .sms-record-country small,
:root[data-theme="dark"] .sms-record-service small,
:root[data-theme="dark"] .auth-subtitle,
:root[data-theme="dark"] .form-check,
:root[data-theme="dark"] .divider,
:root[data-theme="dark"] .form-floating > label {
    color: var(--md-on-surface-med) !important;
}

:root[data-theme="dark"] .auth-title {
    color: var(--md-on-surface);
}

:root[data-theme="dark"] .proxy-purchase__product:hover,
:root[data-theme="dark"] .upstream-item:hover,
:root[data-theme="dark"] .smm-service:hover,
:root[data-theme="dark"] .long-rental-product:hover,
:root[data-theme="dark"] .geonode-product:hover {
    background: var(--md-surface-2);
}

:root[data-theme="dark"] .proxy-purchase__product.active,
:root[data-theme="dark"] .upstream-item.active,
:root[data-theme="dark"] .smm-service.active,
:root[data-theme="dark"] .long-rental-product.active,
:root[data-theme="dark"] .geonode-product.active {
    background: var(--md-selected-overlay);
    box-shadow: inset 3px 0 var(--md-primary);
}

/* Short-term SMS pages: dark shell with white product columns. */
:root[data-theme="dark"] .panel-header .panel-title,
:root[data-theme="dark"] .upstream-catalog__toolbar,
:root[data-theme="dark"] .upstream-catalog__status {
    color: #ffffff;
}

:root[data-theme="dark"] .upstream-column,
:root[data-theme="dark"] .upstream-list,
:root[data-theme="dark"] .upstream-item {
    color: #111827;
    background: #ffffff;
    border-color: #e4e7ec;
    box-shadow: none;
}

:root[data-theme="dark"] .upstream-column__header,
:root[data-theme="dark"] .upstream-checkout {
    color: #111827;
    background: #f8fafc;
    border-color: #e4e7ec;
    box-shadow: none;
}

:root[data-theme="dark"] .upstream-column__header h6,
:root[data-theme="dark"] .upstream-item__text strong,
:root[data-theme="dark"] .upstream-item__text small,
:root[data-theme="dark"] .upstream-item__detail,
:root[data-theme="dark"] .upstream-list__empty,
:root[data-theme="dark"] .upstream-checkout__selection small,
:root[data-theme="dark"] .upstream-checkout__selection strong,
:root[data-theme="dark"] .upstream-checkout__selection span,
:root[data-theme="dark"] .upstream-checkout__quantity > small,
:root[data-theme="dark"] .upstream-checkout__total small,
:root[data-theme="dark"] .upstream-checkout__total strong {
    color: #111827;
}

:root[data-theme="dark"] .upstream-search,
:root[data-theme="dark"] .upstream-operator,
:root[data-theme="dark"] .upstream-sort,
:root[data-theme="dark"] .upstream-stepper,
:root[data-theme="dark"] .upstream-stepper input {
    color: #111827;
    background: #ffffff;
    border-color: #d0d5dd;
}

:root[data-theme="dark"] .upstream-search input,
:root[data-theme="dark"] .upstream-search i,
:root[data-theme="dark"] .upstream-stepper button {
    color: #111827;
}

:root[data-theme="dark"] .upstream-search input::placeholder {
    color: #667085;
}

:root[data-theme="dark"] .upstream-operator,
:root[data-theme="dark"] .upstream-sort,
:root[data-theme="dark"] .smm-catalog__filters .form-select {
    padding-right: 2.15rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='12' viewBox='0 0 16 12'%3e%3cpath fill='none' stroke='%23111827' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m3 4 5 5 5-5'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right .65rem center;
    background-size: 14px 10px;
}

:root[data-theme="dark"] .upstream-item:hover,
:root[data-theme="dark"] .upstream-item.active {
    color: #111827;
    background: #eef6ff;
}

:root[data-theme="dark"] .upstream-item.active {
    box-shadow: inset 3px 0 #1677ff;
}

/* Home service entries: restrained glass edges over the native dark canvas. */
:root[data-theme="dark"] .sf-home .acg-card {
    position: relative;
    color: var(--md-on-surface);
    background: rgba(35, 40, 48, .66);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 8px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .10),
        0 10px 28px rgba(0, 0, 0, .30);
    -webkit-backdrop-filter: blur(18px) saturate(135%);
    backdrop-filter: blur(18px) saturate(135%);
    transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

:root[data-theme="dark"] .sf-home .acg-card strong {
    color: var(--md-on-surface);
}

:root[data-theme="dark"] .sf-home .acg-card .text-muted {
    color: var(--md-on-surface-med) !important;
}

:root[data-theme="dark"] .sf-home .acg-card:hover {
    background: rgba(43, 49, 58, .76);
    border-color: rgba(var(--md-primary-rgb), .48);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .14),
        0 14px 34px rgba(0, 0, 0, .38),
        0 0 0 1px rgba(var(--md-primary-rgb), .08);
}

/* SMM pages: white catalog columns inside the native dark page shell. */
:root[data-theme="dark"] .smm-catalog__toolbar,
:root[data-theme="dark"] .smm-catalog__status {
    color: #ffffff;
}

:root[data-theme="dark"] .smm-category-list,
:root[data-theme="dark"] .smm-service-area,
:root[data-theme="dark"] .smm-service-list,
:root[data-theme="dark"] .smm-service {
    color: #111827;
    background: #ffffff;
    border-color: #e4e7ec;
    box-shadow: none;
}

:root[data-theme="dark"] .smm-category-list,
:root[data-theme="dark"] .smm-service-area__header {
    color: #111827;
    background: #f8fafc;
    border-color: #e4e7ec;
}

:root[data-theme="dark"] .smm-category,
:root[data-theme="dark"] .smm-category span,
:root[data-theme="dark"] .smm-category small,
:root[data-theme="dark"] .smm-service-area__header h6,
:root[data-theme="dark"] .smm-service-area__header .text-muted,
:root[data-theme="dark"] .smm-service__identity > strong,
:root[data-theme="dark"] .smm-service__limits small,
:root[data-theme="dark"] .smm-service__limits strong,
:root[data-theme="dark"] .smm-service__price small,
:root[data-theme="dark"] .smm-service__price strong,
:root[data-theme="dark"] .smm-service-list__empty,
:root[data-theme="dark"] .smm-tag,
:root[data-theme="dark"] .smm-tag.is-positive,
:root[data-theme="dark"] .smm-tag.is-warning {
    color: #111827 !important;
}

:root[data-theme="dark"] .smm-category small,
:root[data-theme="dark"] .smm-tag {
    background: #eef0f3;
}

:root[data-theme="dark"] .smm-category:hover,
:root[data-theme="dark"] .smm-category.active,
:root[data-theme="dark"] .smm-service:hover {
    color: #111827;
    background: #eef6ff;
}

:root[data-theme="dark"] .smm-catalog__filters .form-select {
    color: #111827;
    background-color: #ffffff;
    border-color: #d0d5dd;
}

/* Residential proxy: all copy rendered on native dark surfaces stays white. */
:root[data-theme="dark"] .geonode-store__toolbar,
:root[data-theme="dark"] .geonode-store__toolbar strong,
:root[data-theme="dark"] .geonode-store__toolbar small,
:root[data-theme="dark"] .geonode-products,
:root[data-theme="dark"] .geonode-product,
:root[data-theme="dark"] .geonode-product__main strong,
:root[data-theme="dark"] .geonode-product small,
:root[data-theme="dark"] .geonode-product b,
:root[data-theme="dark"] .geonode-empty,
:root[data-theme="dark"] .geonode-checkout,
:root[data-theme="dark"] .geonode-checkout h6,
:root[data-theme="dark"] .geonode-checkout dt,
:root[data-theme="dark"] .geonode-checkout dd,
:root[data-theme="dark"] .geonode-checkout span,
:root[data-theme="dark"] .geonode-checkout strong,
:root[data-theme="dark"] .geonode-checkout > small {
    color: #ffffff;
}

/* Self-operated products: white copy on the native dark product cards. */
:root[data-theme="dark"] .self-product-page .item-message,
:root[data-theme="dark"] .self-product-page .acg-card,
:root[data-theme="dark"] .self-product-page .goods-title,
:root[data-theme="dark"] .self-product-page .price,
:root[data-theme="dark"] .self-product-page .price .unit,
:root[data-theme="dark"] .self-product-page .meta,
:root[data-theme="dark"] .self-product-page .stat-row,
:root[data-theme="dark"] .self-product-page .stat-bottom,
:root[data-theme="dark"] .self-item-page h4,
:root[data-theme="dark"] .self-item-page .form-label,
:root[data-theme="dark"] .self-item-page .sku,
:root[data-theme="dark"] .self-item-page .price,
:root[data-theme="dark"] .self-item-page .price .unit {
    color: #ffffff;
}

:root[data-theme="dark"] .self-product-page .item-list .acg-card {
    position: relative;
    background: rgba(35, 40, 48, .68);
    border: 1px solid rgba(255, 255, 255, .17);
    border-radius: 8px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .11),
        0 10px 28px rgba(0, 0, 0, .32);
    -webkit-backdrop-filter: blur(18px) saturate(135%);
    backdrop-filter: blur(18px) saturate(135%);
    transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

:root[data-theme="dark"] .self-product-page .item-list .acg-card:hover {
    background: rgba(43, 49, 58, .78);
    border-color: rgba(var(--md-primary-rgb), .52);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .15),
        0 14px 36px rgba(0, 0, 0, .40),
        0 0 0 1px rgba(var(--md-primary-rgb), .09);
}

:root[data-theme="dark"] .self-product-page .item-list .acg-card.soldout {
    border-color: rgba(255, 255, 255, .10);
    background: rgba(31, 35, 42, .56);
    filter: none;
}

:root[data-theme="dark"] .self-product-page .badge-soft-success,
:root[data-theme="dark"] .self-item-page .badge-soft-success {
    color: #9be9b7;
    background: rgba(34, 197, 94, .15);
    border-color: rgba(134, 239, 172, .38);
}

:root[data-theme="dark"] .self-item-page .badge-soft-primary {
    color: #c7d2fe;
    background: rgba(99, 102, 241, .18);
    border-color: rgba(199, 210, 254, .38);
}

:root[data-theme="dark"] .self-item-page .badge-soft-info {
    color: #d8c7ff;
    background: rgba(168, 85, 247, .17);
    border-color: rgba(216, 199, 255, .38);
}

:root[data-theme="dark"] .self-product-page .soldout-ribbon {
    color: #ffffff;
    background: #d84a5f;
    box-shadow: 0 6px 16px rgba(216, 74, 95, .32);
}

/* Self-operated checkout: keep balance payment legible against the dark page. */
:root[data-theme="dark"] .self-item-page .cash-pay {
    color: #111827;
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(255, 255, 255, .72);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .92),
        0 12px 30px rgba(0, 0, 0, .32);
}

:root[data-theme="dark"] .self-item-page .cash-pay .form-label {
    color: #111827;
}

:root[data-theme="dark"] .self-item-page .cash-pay .pay-list {
    border-top-color: #d7dce3;
}

:root[data-theme="dark"] .self-item-page .cash-pay .pay-list .pay {
    color: #111827;
    background: #ffffff;
    border: 1px solid #d0d5dd;
    box-shadow: 0 5px 14px rgba(17, 24, 39, .12);
}

:root[data-theme="dark"] .self-item-page .cash-pay .pay-list .pay span {
    color: #111827;
}

:root[data-theme="dark"] .self-item-page .cash-pay .pay-list .pay:hover {
    border-color: rgba(var(--md-primary-rgb), .55);
    background: #f6f8fb;
}

:root[data-theme="dark"] .self-item-page .cash-pay .pay-list .pay.is-primary,
:root[data-theme="dark"] .self-item-page .cash-pay .pay-list .pay.active,
:root[data-theme="dark"] .self-item-page .cash-pay .pay-list .pay.selected {
    color: #ffffff;
    background: var(--md-primary);
    border-color: var(--md-primary);
}

:root[data-theme="dark"] .self-item-page .cash-pay .pay-list .pay.is-primary span,
:root[data-theme="dark"] .self-item-page .cash-pay .pay-list .pay.active span,
:root[data-theme="dark"] .self-item-page .cash-pay .pay-list .pay.selected span {
    color: #ffffff;
}
