/* Global appearance mode, controlled by General Settings. */
:root,
html.tvd-theme-light,
body.tvd-theme-light {
  color-scheme: light;
}

html.tvd-theme-light,
body.tvd-theme-light {
  --tvdm-surface: rgba(255, 255, 255, 0.92);
  --tvdm-surface-strong: #fff;
  --tvdm-surface-soft: #f8fafc;
  --tvdm-text: #111827;
  --tvdm-text-muted: #64748b;
  --tvdm-border: rgba(15, 23, 42, 0.1);
  --tvdm-border-strong: rgba(15, 23, 42, 0.16);
}

html.tvd-theme-dark,
body.tvd-theme-dark {
  color-scheme: dark;
  --tvdm-surface: #111827;
  --tvdm-surface-strong: #172033;
  --tvdm-surface-soft: #1e293b;
  --tvdm-text: #f8fafc;
  --tvdm-text-muted: #aeb8c7;
  --tvdm-border: rgba(226, 232, 240, 0.16);
  --tvdm-border-strong: rgba(226, 232, 240, 0.28);
}

body.tvd-theme-dark {
  background: #0f172a;
  color: var(--tvdm-text);
}

body.tvd-theme-dark
  :is(
    #wrapper,
    #main,
    .page-wrapper,
    .page-wrap,
    .tvd-content-band,
    .section-content,
    .article-inner,
    .tvd-surface-copy,
    .widget,
    .widget-area,
    .off-canvas,
    .mfp-content
  ) {
  background-color: var(--tvdm-surface);
  color: var(--tvdm-text);
  border-color: var(--tvdm-border);
}

body.tvd-theme-dark
  :is(h1, h2, h3, h4, h5, h6, .heading-font, .entry-title, .widget-title) {
  color: var(--tvdm-text);
}

body.tvd-theme-dark :is(input, select, textarea) {
  background: var(--tvdm-surface-strong);
  border-color: var(--tvdm-border-strong);
  color: var(--tvdm-text);
}

/* Account dashboard: override its legacy OS-level colour-scheme media query. */
body.tvd-theme-light {
  --tvd-bg: #f5f6fb;
  --tvd-surface: #fff;
  --tvd-surface-2: #fbfbfe;
  --tvd-text: #1b1e28;
  --tvd-text-muted: #6b7280;
  --tvd-text-faint: #9aa1b1;
  --tvd-border: #e7e8f1;
  --tvd-border-strong: #d8dae8;
  --tvd-success-bg: #e9fbf4;
  --tvd-danger-bg: #fdecec;
  --tvd-warning-bg: #fef6e7;
  --tvd-info-bg: #eaf2fe;
}

body.tvd-theme-dark {
  --tvd-bg: #0e1015;
  --tvd-surface: #161922;
  --tvd-surface-2: #1c202b;
  --tvd-text: #e8e9f2;
  --tvd-text-muted: #9aa1b3;
  --tvd-text-faint: #6e7484;
  --tvd-border: #262b37;
  --tvd-border-strong: #323848;
  --tvd-success-bg: rgba(16, 185, 129, 0.12);
  --tvd-danger-bg: rgba(239, 68, 68, 0.12);
  --tvd-warning-bg: rgba(245, 158, 11, 0.12);
  --tvd-info-bg: rgba(59, 130, 246, 0.12);
}

body.tvd-theme-light .tvd-dashboard-welcome__avatar img {
  border-color: #fff;
}

body.tvd-theme-light .tvd-dashboard-card__arrow {
  background: #fbfbfe;
}

/* Checkout uses its own component tokens, so bind them to the global mode. */
body.tvd-theme-dark.woocommerce-checkout,
body.tvd-theme-dark.woocommerce-order-received {
  --tvd-checkout-bg: #0f172a;
  --tvd-checkout-card: #172033;
  --tvd-checkout-card-soft: #1e293b;
  --tvd-checkout-text: #f8fafc;
  --tvd-checkout-muted: #aeb8c7;
  --tvd-checkout-line: rgba(226, 232, 240, 0.16);
  --tvd-checkout-line-strong: rgba(226, 232, 240, 0.28);
  --tvd-checkout-primary: #2dd4bf;
  --tvd-checkout-primary-hover: #5eead4;
  --tvd-checkout-shadow: 0 20px 50px rgba(0, 0, 0, 0.32);
  --tvd-checkout-shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.24);
  background:
    radial-gradient(
      circle at 14% 4%,
      rgba(45, 212, 191, 0.12),
      transparent 28vw
    ),
    #0f172a;
}

body.tvd-theme-dark.woocommerce-checkout
  :is(.tvd-wc-checkout-card, .tvd-wc-checkout__summary, .tvd-wc-coupon-form),
body.tvd-theme-dark.woocommerce-order-received
  :is(
    .tvd-wc-order-received__details,
    .tvd-wc-order-received__summary,
    .tvd-wc-order-state
  ) {
  background: rgba(23, 32, 51, 0.96);
}

body.tvd-theme-dark.woocommerce-checkout
  :is(
    .checkout-breadcrumbs,
    .checkout-breadcrumbs a.current,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    input[type="url"],
    textarea,
    select,
    .select2-container .select2-selection--single,
    #payment div.payment_box
  ) {
  background: #1e293b;
  color: var(--tvd-checkout-text);
}

body.tvd-theme-dark.woocommerce-checkout
  :is(
    .woocommerce-checkout-review-order-table th,
    .woocommerce-checkout-review-order-table td,
    .woocommerce-checkout-review-order-table .product-name,
    #payment ul.payment_methods li label,
    .checkout-sidebar,
    .html-checkout-sidebar
  ) {
  color: var(--tvd-checkout-text);
}

body.tvd-theme-dark.woocommerce-checkout .checkout-breadcrumbs a.current {
  box-shadow:
    inset 0 0 0 1px var(--tvd-checkout-line),
    0 6px 18px rgba(0, 0, 0, 0.22);
}

/* WooCommerce Blocks checkout (Contact, Billing, Payment and Order summary). */
body.tvd-theme-dark.woocommerce-checkout
  :is(
    .wc-block-components-checkout-step,
    .wc-block-checkout__sidebar,
    .wc-block-components-sidebar
  ) {
  background: rgba(23, 32, 51, 0.96);
  border-color: var(--tvd-checkout-line);
  color: var(--tvd-checkout-text);
}

body.tvd-theme-dark.woocommerce-checkout
  :is(
    .wc-block-components-text-input input,
    .wc-block-components-combobox
      .wc-block-components-combobox-control
      input.components-combobox-control__input,
    .wc-block-components-form .wc-block-components-textarea,
    .wc-block-components-address-card,
    .wc-block-checkout__payment-method,
    .wc-block-components-quantity-selector
  ) {
  background: #1e293b;
  border-color: var(--tvd-checkout-line-strong);
  color: var(--tvd-checkout-text);
}

body.tvd-theme-dark.woocommerce-checkout
  :is(
    .wc-block-components-checkout-step__title,
    .wc-block-components-title,
    .wc-block-components-order-summary-item__description,
    .wc-block-components-order-summary-item__description a,
    .wc-block-components-totals-item,
    .wc-block-components-totals-footer-item,
    .wc-block-components-panel__button
  ) {
  color: var(--tvd-checkout-text);
}

body.tvd-theme-dark.woocommerce-checkout
  :is(
    .wc-block-components-checkout-step__description,
    .wc-block-components-checkout-step__heading-content,
    .wc-block-components-product-metadata,
    .wc-block-components-totals-item__label,
    .wc-block-components-checkbox .wc-block-components-checkbox__label,
    .wc-block-checkout__add-note
  ) {
  color: var(--tvd-checkout-muted);
}

body.tvd-theme-dark.woocommerce-checkout
  .wc-block-components-notice-banner.is-error {
  background: rgba(127, 29, 29, 0.28);
  border-color: rgba(252, 165, 165, 0.42);
  color: #fecaca;
}

/* TVDTHEME screens inside WordPress admin. */
body.wp-admin.tvd-theme-dark {
  background: #0f172a;
  color: #e5e7eb;
}

body.wp-admin.tvd-theme-dark #wpcontent,
body.wp-admin.tvd-theme-dark #wpbody,
body.wp-admin.tvd-theme-dark .wrap,
body.wp-admin.tvd-theme-dark #of_container {
  background: #0f172a;
  color: #e5e7eb;
}

body.wp-admin.tvd-theme-dark
  :is(
    .postbox,
    .card,
    .notice,
    .tvd-card,
    #of_container .tvd-content-band,
    #of_container .controls
  ) {
  background: #172033;
  border-color: rgba(226, 232, 240, 0.16);
  color: #e5e7eb;
}



