/* Admin Powerups — styles injected into WooCommerce/WordPress screens by individual modules. */

/* Order address sync */
.apwc-address-sync { clear: both; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 8px; }

.apwc-address-sync__status { font-size: 12px; color: #646970; }

.apwc-address-sync__status[data-state="success"] { color: #007017; }

.apwc-address-sync__status[data-state="error"] { color: #b32d2e; }

.apwc-address-sync__status[data-state="warning"] { color: #996800; }

/* Phones: the billing and shipping columns are narrower than the button's label, so let it wrap. */
@media screen and (max-width: 782px) {

	.wp-core-ui .apwc-address-sync .apwc-address-sync__button { max-width: 100%; height: auto; min-height: 40px; padding-top: 8px; padding-bottom: 8px; line-height: 1.4; white-space: normal; text-align: left; }
}

/* Order meta inspector (native wp-admin layer: WordPress greys, admin color scheme accent) */
.apwc-inspector { --apwc-accent: var(--wp-admin-theme-color, #2271b1); margin: 0 -12px -12px; }

.apwc-inspector .apwc-icon { width: 14px; height: 14px; flex: none; }

.apwc-inspector__bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; padding: 0 12px; border-bottom: 1px solid #dcdcde; }

.apwc-inspector__tabs { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: -1px; }

.apwc-inspector__tab { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 10px 10px 9px; border: 0; border-bottom: 2px solid transparent; background: none; color: #50575e; font-size: 13px; line-height: 1.4; cursor: pointer; }

.apwc-inspector__tab:hover { color: var(--apwc-accent); }

.apwc-inspector__tab[aria-selected="true"] { border-bottom-color: var(--apwc-accent); color: #1d2327; font-weight: 600; }

.apwc-inspector__tab:focus { box-shadow: none; outline: none; }

.apwc-inspector__tab:focus-visible { outline: 2px solid var(--apwc-accent); outline-offset: -2px; border-radius: 2px; }

.apwc-inspector__count { min-width: 18px; padding: 0 6px; border-radius: 9px; background: #f0f0f1; color: #50575e; font-size: 11px; font-weight: 500; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }

.apwc-inspector__count.is-match { background: var(--apwc-accent); color: #fff; }

.apwc-inspector__tools { display: flex; align-items: center; gap: 8px; padding: 6px 0; }

.apwc-inspector__search { position: relative; display: inline-flex; align-items: center; }

.apwc-inspector__search .apwc-icon { position: absolute; left: 10px; color: #646970; pointer-events: none; }

.apwc-inspector__search input[type="search"] { width: 240px; min-height: 40px; height: 40px; padding-left: 30px; }

.apwc-inspector__tools .button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; height: 40px; }

.apwc-inspector__panel { padding: 4px 12px 12px; }

.apwc-inspector__panel:focus { outline: none; }

.apwc-inspector__panel:focus-visible { outline: 2px solid var(--apwc-accent); outline-offset: -2px; }

.apwc-inspector__group + .apwc-inspector__group { margin-top: 8px; }

.apwc-inspector__group-title { display: flex; align-items: baseline; gap: 8px; margin: 14px 0 4px; color: #1d2327; font-size: 13px; font-weight: 600; }

.apwc-inspector__group-title span { color: #646970; font-size: 12px; font-weight: 400; }

.apwc-inspector__table { width: 100%; border-collapse: collapse; table-layout: fixed; }

.apwc-inspector__table tr { border-top: 1px solid #f0f0f1; }

.apwc-inspector__table tr:hover { background: #f6f7f7; }

.apwc-inspector__table tbody tr:first-child { border-top: 0; }

.apwc-inspector__table th, .apwc-inspector__table td { padding: 8px 6px; vertical-align: top; text-align: left; }

.apwc-inspector__key { width: 34%; font-weight: 400; word-break: break-all; }

.apwc-inspector__key code { padding: 0; background: none; color: #1d2327; font-size: 12px; }

.apwc-inspector__badge { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 2px; background: #f0f0f1; color: #50575e; font-size: 11px; line-height: 18px; vertical-align: 1px; }

.apwc-inspector__badge--secret { background: #fcf9e8; color: #996800; box-shadow: inset 0 0 0 1px #f0d383; }

.apwc-inspector__value { color: #1d2327; font-size: 13px; overflow-wrap: anywhere; }

.apwc-inspector__value summary { color: #50575e; cursor: pointer; }

.apwc-inspector__value pre, pre.apwc-inspector__text { max-height: 280px; margin: 6px 0 0; padding: 8px 10px; overflow: auto; border: 1px solid #f0f0f1; border-radius: 2px; background: #f6f7f7; font-size: 12px; white-space: pre-wrap; }

.apwc-inspector__masked { color: #646970; letter-spacing: 1px; }

.apwc-inspector__reveal { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; color: var(--apwc-accent); font-size: 12px; text-decoration: none; }

.apwc-inspector__blank { color: #646970; font-style: italic; }

.apwc-inspector__actions { width: 96px; white-space: nowrap; text-align: right !important; }

.apwc-inspector__action { display: inline-grid; place-items: center; width: 28px; height: 28px; margin: -4px 0; padding: 0; border: 0; border-radius: 3px; background: none; color: #646970; cursor: pointer; transition: background-color 120ms, color 120ms; }

.apwc-inspector__action:hover { background: #f0f0f1; color: var(--apwc-accent); }

.apwc-inspector__action:focus { box-shadow: none; outline: none; }

.apwc-inspector__action:focus-visible { outline: 2px solid var(--apwc-accent); outline-offset: 0; }

.apwc-inspector__action.is-copied, .apwc-inspector .button.is-copied { color: #007017; }

/* Row icons: drawn from the Lucide files by CSS masks, so a big order's rows carry no inline SVG. */
.apwc-inspector__glyph { display: inline-block; width: 14px; height: 14px; flex: none; background-color: currentcolor; -webkit-mask: var(--apwc-glyph) center / contain no-repeat; mask: var(--apwc-glyph) center / contain no-repeat; }

.apwc-inspector__glyph--key { --apwc-glyph: url(../icons/key-round.svg); }

.apwc-inspector__glyph--copy { --apwc-glyph: url(../icons/copy.svg); }

.apwc-inspector__glyph--braces { --apwc-glyph: url(../icons/braces.svg); }

.apwc-inspector__glyph--eye { --apwc-glyph: url(../icons/eye.svg); }

.apwc-inspector__action.is-copied .apwc-inspector__glyph { --apwc-glyph: url(../icons/check.svg); }

.apwc-inspector .button.is-copied { border-color: #007017; }

.apwc-inspector__empty { margin: 12px 0 4px; color: #646970; }

.apwc-inspector__foot { display: flex; align-items: center; gap: 6px; margin: 0; padding: 8px 12px; border-top: 1px solid #f0f0f1; color: #646970; font-size: 12px; }

/* Meta | JSON switch: two joined native-looking buttons; the pressed one takes the admin colour. */
.apwc-inspector__views { display: inline-flex; border: 1px solid #8c8f94; border-radius: 3px; overflow: hidden; }

.apwc-inspector__view { min-height: 38px; margin: 0; padding: 0 12px; border: 0; background: #fff; color: #2c3338; font-size: 13px; line-height: 1; cursor: pointer; }

.apwc-inspector__view + .apwc-inspector__view { border-left: 1px solid #8c8f94; }

.apwc-inspector__view:hover { background: #f6f7f7; color: var(--apwc-accent); }

.apwc-inspector__view[aria-pressed="true"] { background: var(--apwc-accent); color: #fff; }

.apwc-inspector__view:focus { box-shadow: none; outline: none; }

.apwc-inspector__view:focus-visible { outline: 2px solid var(--apwc-accent); outline-offset: -4px; box-shadow: inset 0 0 0 3px #fff; }

.apwc-inspector.is-json [data-apwc-meta-only] { display: none !important; }

.apwc-inspector.is-json .apwc-inspector__bar { justify-content: flex-end; }

/* JSON view (drawn by assets/js/dev-tools.js; its panel styles live in admin.css, so the order screen gets its own). */
.apwc-inspector__json { padding: 8px 12px 12px; }

.apwc-inspector__json-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 8px; }

.apwc-inspector__json-bar .button { display: inline-flex; align-items: center; gap: 6px; }

.apwc-inspector__json-note { margin: 0; color: #646970; font-size: 12px; }

.apwc-inspector__json-error { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; color: #b32d2e; }

.apwc-inspector .apwc-json { display: grid; gap: 8px; }

/* The inspector's own "Copy all" copies the order exactly as the REST API shapes it. */
.apwc-inspector .apwc-json__bar { display: none; }

.apwc-inspector .apwc-json__section { border: 1px solid #dcdcde; border-radius: 2px; overflow: clip; }

.apwc-inspector .apwc-json__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 4px 10px; border-bottom: 1px solid #dcdcde; background: #f6f7f7; }

.apwc-inspector .apwc-json__key { color: #1d2327; font-family: Consolas, Monaco, monospace; font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }

.apwc-inspector .apwc-json__pre { max-height: 420px; margin: 0; padding: 8px 10px; overflow: auto; background: #fff; color: #1d2327; font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2; }

.apwc-inspector .apwc-json__pre:focus { outline: none; }

.apwc-inspector .apwc-btn { min-height: 28px; margin: 0; padding: 0 8px; border: 0; border-radius: 3px; background: none; color: var(--apwc-accent); font-size: 12px; line-height: 28px; cursor: pointer; }

.apwc-inspector .apwc-btn:hover { background: #f0f0f1; }

.apwc-inspector .apwc-btn:focus { box-shadow: none; outline: none; }

.apwc-inspector .apwc-btn:focus-visible { outline: 2px solid var(--apwc-accent); outline-offset: 0; }

.apwc-inspector .apwc-json__more { margin: 0 10px 8px; }

@media screen and (max-width: 782px) {

	.apwc-inspector__tools { flex-wrap: wrap; width: 100%; }

	.apwc-inspector__search { flex: 1 1 100%; }

	.apwc-inspector__search input[type="search"] { width: 100%; }

	.apwc-inspector__table, .apwc-inspector__table tbody, .apwc-inspector__table tr, .apwc-inspector__table th, .apwc-inspector__table td { display: block; width: auto; }

	.apwc-inspector__table tr { padding: 6px 0; }

	.apwc-inspector__table th, .apwc-inspector__table td { padding: 2px 6px; }

	.apwc-inspector__actions { text-align: left !important; }

	/* 40px touch targets; the cell is pulled left so the first icon lines up with the value above. */
	.apwc-inspector__table td.apwc-inspector__actions { margin-left: -7px; padding: 0; }

	.apwc-inspector__action { width: 40px; height: 40px; margin: 0; }

	.apwc-inspector .apwc-btn { min-height: 40px; line-height: 40px; }

	/* "Show" grows its hit area without moving the row. */
	.apwc-inspector__reveal { margin-top: -11px; margin-bottom: -11px; padding: 11px 8px; }
}

@media (prefers-reduced-motion: reduce) {

 .apwc-inspector__action { transition: none; } }

/* Users list. Column classes come from WordPress ("column-" + our column key, which uses underscores). */
/* stylelint-disable-next-line selector-class-pattern */
.users .column-apwc_billing, .users .column-apwc_shipping { width: 18%; }

/* Short numbers: keep them narrow so Username keeps its room. */
/* stylelint-disable-next-line selector-class-pattern */
.users .column-apwc_orders { width: 7%; font-variant-numeric: tabular-nums; }

/* stylelint-disable-next-line selector-class-pattern */
.users .column-apwc_spent, .users .column-apwc_average { width: 10%; font-variant-numeric: tabular-nums; }

.apwc-user-address { display: block; line-height: 1.5; }

.apwc-user-sub { display: block; color: #646970; font-size: 12px; line-height: 1.5; }

/* Switch-user banner (front end) */
.apwc-switch-banner { position: fixed; inset: auto 16px 16px auto; z-index: 99999; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px); padding: 10px 14px; border-radius: 6px; background: #1d2327; color: #f0f0f1; font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; box-shadow: 0 4px 16px rgba(0,0,0,.2); }

.apwc-switch-banner a { color: #72aee6; font-weight: 600; text-decoration: underline; }

.apwc-switch-banner a:hover, .apwc-switch-banner a:focus { color: #fff; }

/* Customer pages box (native wp-admin layer) */
.apwc-cp { --apwc-accent: var(--wp-admin-theme-color, #2271b1); }

.apwc-cp .apwc-icon { width: 14px; height: 14px; flex: none; }

.apwc-cp__section + .apwc-cp__section { margin-top: 12px; padding-top: 12px; border-top: 1px solid #f0f0f1; }

.apwc-cp__title { margin: 4px 0 8px; color: #1d2327; font-size: 13px; font-weight: 600; }

.apwc-cp__url { width: 100%; min-height: 40px; color: #50575e; font-size: 12px; }

.apwc-cp__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.apwc-cp__actions .button, .apwc-cp .apwc-cp__wide { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }

/* Equal widths, one row when all three fit (tighter padding than WordPress's so they do in the sidebar). */
.wp-core-ui .apwc-cp__actions .button { flex: 1 1 0; padding-right: 10px; padding-left: 10px; }

.apwc-cp .apwc-cp__wide { width: 100%; }

.apwc-cp .button.is-done { border-color: #007017; color: #007017; }

.apwc-cp__confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 8px 0 0; padding: 8px 10px; border: 1px solid #dcdcde; border-radius: 2px; background: #f6f7f7; color: #1d2327; font-size: 12px; }

.apwc-cp__confirm span { flex: 1 1 100%; word-break: break-all; }

.apwc-cp__help, .apwc-cp__state { margin: 8px 0 0; color: #646970; font-size: 12px; }

.apwc-cp__state { margin-top: 0; }

/* Thank-you page preview banner (front end, no scripts) */
.apwc-preview-banner { position: sticky; top: 0; z-index: 99999; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 10px 16px; background: #1d2327; color: #f0f0f1; font: 13px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

.apwc-preview-banner strong { color: #fff; }

/* stylelint-disable-next-line no-descending-specificity -- a different banner from the switch-user one above; never the same link. */
.apwc-preview-banner a { margin-left: auto; color: #72aee6; font-weight: 600; text-decoration: underline; }

.apwc-preview-banner a:hover, .apwc-preview-banner a:focus { color: #fff; }

.apwc-cp [hidden], .apwc-inspector [hidden] { display: none !important; }


/* ------------------------------------------------------------------ customer tags (Users list, profile) */

.apwc-ct-profile .select2-container { max-width: 100%; }

.tablenav .apwc-tag-filter { max-width: 14rem; }

/* ------------------------------------------------------------------ advanced customer search */

.apwc-cs.is-placed { display: inline-block; margin-right: 4px; vertical-align: top; }

.apwc-cs select { max-width: 11rem; }

/* Match the search field and button beside it (WordPress draws selects taller). */
.search-box .apwc-cs select { min-height: 32px; height: 32px; padding-top: 0; padding-bottom: 0; line-height: 30px; vertical-align: top; }

.tablenav .apwc-cs:not(.is-placed) { float: left; margin-right: 6px; }

/* ------------------------------------------------------------------ advanced order search (Orders list) */

/* WooCommerce hides its "Search by" dropdown on phones, which would hide our search types.
   Show it (beside the Search button, under the search field) only when it lists our types. */
@media screen and (max-width: 782px) {

	/* stylelint-disable-next-line selector-class-pattern -- WooCommerce's body class. */
	.woocommerce_page_wc-orders #order-search-filter:has(option[value^="apwc_"]) { display: block; flex: 1 1 0; min-width: 0; min-height: 40px; margin: 0 0 10px; float: none; }
}

/* ------------------------------------------------------------------ order "Emails" box */

.apwc-oe__list { margin: 0; }

.apwc-oe__item { display: grid; gap: 1px; margin: 0; padding: 8px 0; border-bottom: 1px solid #f0f0f1; }

.apwc-oe__item:first-child { padding-top: 0; }

.apwc-oe__meta, .apwc-oe__to { color: #646970; font-size: 12px; }

.apwc-oe__to { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.apwc-oe__status[data-status="failed"] { color: #d63638; font-weight: 600; }

.apwc-oe__empty { margin: 0; color: #646970; }

.apwc-oe__all { margin: 8px 0 0; }

/* High-value order alerts (Orders list) */
.apwc-high-value-badge { display: inline-block; margin-left: 6px; padding: 0 6px; border: 1px solid #c5a7f6; border-radius: 3px; background: #f5effe; color: #5b0bbd; font-size: 11px; font-weight: 500; line-height: 18px; vertical-align: 1px; white-space: nowrap; }

tr.apwc-high-value > th.check-column { box-shadow: inset 3px 0 0 #720eec; }
