/**
 * YOOAdmin Dark Engine v2 — WooCommerce vendor layer.
 *
 * WooCommerce admin (wc-admin React app, settings, status, reports) ships large
 * amounts of light CSS built on Gutenberg @wordpress/components (.components-*)
 * plus its own .woocommerce-* surfaces. Rather than bloating compat/generic.css
 * for everyone, these rules live in a dedicated file loaded ONLY when Woo is
 * active on a wc-* screen (conditional vendor split).
 *
 * Token-based, scoped to body.yp-dark-v2-plugin. !important is used because Woo
 * components ship high-specificity light styles (and some emotion inline color);
 * the narrow adaptive JS remains the backstop for any !important-inline leftovers.
 */

/* ---- Surfaces (Gutenberg components + Woo cards/tables). ---- */
html[data-yooadmin-studio-color-mode-effective='dark']
  body.yp-dark-v2-plugin
  #wpbody-content
  :is(
    .components-card, .components-card__header, .components-card__body,
    .components-card__footer, .components-surface, .components-panel,
    .components-panel__body, .components-modal__frame,
    .woocommerce-card, .woocommerce-card__header, .woocommerce-card__body,
    .woocommerce-table, .woocommerce-table__header, .woocommerce-summary__item,
    .woocommerce-leaderboard, .woocommerce-empty-content,
    .woocommerce-profiler-choice-container, .woocommerce-profile-wizard__body,
    .woocommerce-marketplace__product-card, .woocommerce-marketplace__content,
    .woocommerce-marketplace__header-container
  ) {
  background-color: var(--yp-dark-surface) !important;
  border-color: var(--yp-dark-border) !important;
  color: var(--yp-dark-text) !important;
  box-shadow: none !important;
}

/* ---- Chrome strips that should blend into the page (not boxed). ---- */
html[data-yooadmin-studio-color-mode-effective='dark']
  body.yp-dark-v2-plugin
  #wpbody-content
  :is(
    .woocommerce-layout__header, .woocommerce-layout__header-heading,
    .woocommerce-layout__activity-panel, .woocommerce-layout__activity-panel-tabs,
    .woocommerce-marketplace__header
  ) {
  background: transparent !important;
  box-shadow: none !important;
  border-color: var(--yp-dark-border-soft) !important;
}

/* ---- Table cells / rows. ---- */
html[data-yooadmin-studio-color-mode-effective='dark']
  body.yp-dark-v2-plugin
  #wpbody-content
  :is(
    .woocommerce-table__item, .woocommerce-table__row, .woocommerce-table__cell,
    .woocommerce-table__empty-item, .components-table__row
  ) {
  background-color: transparent !important;
  border-color: var(--yp-dark-border-soft) !important;
  color: var(--yp-dark-text) !important;
}

/* ---- Text. ---- */
html[data-yooadmin-studio-color-mode-effective='dark']
  body.yp-dark-v2-plugin
  #wpbody-content
  :is(
    .components-text, .components-truncate, .components-card__header *,
    .woocommerce-summary__item-value, .woocommerce-section-header__title,
    [class*='woocommerce-'][class*='__title'],
    [class*='woocommerce-'][class*='__heading'],
    .woocommerce-marketplace__header-title, .woocommerce-profiler-heading__title
  ) {
  color: var(--yp-dark-text) !important;
  -webkit-text-fill-color: var(--yp-dark-text) !important;
}

html[data-yooadmin-studio-color-mode-effective='dark']
  body.yp-dark-v2-plugin
  #wpbody-content
  :is(
    .woocommerce-summary__item-label, .woocommerce-summary__item-prev-label,
    .woocommerce-empty-content__message, .woocommerce-table__empty-item,
    [class*='woocommerce-'][class*='__subtitle'],
    [class*='woocommerce-'][class*='__description'],
    .woocommerce-profiler-heading__subtitle
  ) {
  color: var(--yp-dark-text-muted) !important;
  -webkit-text-fill-color: var(--yp-dark-text-muted) !important;
}

/* ---- Form controls (Gutenberg input/select wrappers). ---- */
html[data-yooadmin-studio-color-mode-effective='dark']
  body.yp-dark-v2-plugin
  #wpbody-content
  :is(.components-input-control__container, .components-flex.components-input-control__container) {
  background-color: var(--yp-dark-field) !important;
  border-color: var(--yp-dark-field-border) !important;
  box-shadow: none !important;
}

html[data-yooadmin-studio-color-mode-effective='dark']
  body.yp-dark-v2-plugin
  #wpbody-content
  :is(
    .components-input-control__input, .components-text-control__input,
    .components-select-control__input, .components-textarea-control__input
  ) {
  background-color: transparent !important;
  color: var(--yp-dark-text) !important;
  -webkit-text-fill-color: var(--yp-dark-text) !important;
}

html[data-yooadmin-studio-color-mode-effective='dark']
  body.yp-dark-v2-plugin
  #wpbody-content
  :is(.components-input-control__input, .components-text-control__input)::placeholder {
  color: var(--yp-dark-text-faint) !important;
  opacity: 1 !important;
}

/* ---- Active tab / accent. ---- */
html[data-yooadmin-studio-color-mode-effective='dark']
  body.yp-dark-v2-plugin
  #wpbody-content
  :is(
    .woocommerce-marketplace__tab-button.is-active,
    .woocommerce-layout__activity-panel-tab.is-active,
    .components-tab-panel__tabs-item.is-active
  ) {
  color: var(--yp-dark-accent) !important;
  -webkit-text-fill-color: var(--yp-dark-accent) !important;
}

/* ---- Pills / chips. ---- */
html[data-yooadmin-studio-color-mode-effective='dark']
  body.yp-dark-v2-plugin
  #wpbody-content
  :is(.woocommerce-tag, .woocommerce-pill, .components-form-token-field__token) {
  background-color: var(--yp-dark-surface-raised) !important;
  color: var(--yp-dark-text) !important;
  border-color: var(--yp-dark-border) !important;
}
