/* Shared action palette. Load after module styles; navigation, status badges,
   calendar days, switches and text-only table actions keep their own semantics. */
:root {
  --action-background: #ffffff;
  --action-border: #cbd5e1;
  --action-text: #334155;
  --action-hover-background: #f8fafc;
  --action-hover-border: #94a3b8;
  --action-active-background: #f1f5f9;
  --action-disabled-background: #f8fafc;
  --action-disabled-border: #e2e8f0;
  --action-disabled-text: #94a3b8;
  --action-focus: #64748b;
  --action-danger-text: #b42318;
  --action-danger-border: #f1b8bd;
}

/* State values are separate from selectors that paint a control. This keeps a
   module's more specific selector from restoring its old fill on hover. */
:where(button, .link-button, .order-email-record-actions > a.secondary, .platform-logo-upload, .mall-hero-upload, .mall-media-upload, .traveller-image-upload) {
  --control-background: var(--action-background);
  --control-border: var(--action-border);
  --control-text: var(--action-text);
}
:where(button, .link-button, .order-email-record-actions > a.secondary, .platform-logo-upload, .mall-hero-upload, .mall-media-upload, .traveller-image-upload):hover {
  --control-background: var(--action-hover-background);
  --control-border: var(--action-hover-border);
}
:where(button, .link-button, .order-email-record-actions > a.secondary, .platform-logo-upload, .mall-hero-upload, .mall-media-upload, .traveller-image-upload):active {
  --control-background: var(--action-active-background);
}
:where(button, .link-button):is(.danger, .danger-button) {
  --control-text: var(--action-danger-text);
  --control-border: var(--action-danger-border);
}
:where(button, .link-button):is(:disabled, [aria-disabled="true"]) {
  --control-background: var(--action-disabled-background);
  --control-border: var(--action-disabled-border);
  --control-text: var(--action-disabled-text);
}

/* Default and secondary actions across all web entry points. Keep specificity
   low enough for navigation, compound selectors and inline links to opt out. */
.premium-admin button,
.premium-admin button.ghost,
.premium-admin button.secondary,
.premium-agency button,
body.premium-agency[data-frontend-theme-style] button.ghost,
body.premium-agency[data-frontend-theme-style] button.secondary,
body.premium-login[data-frontend-theme-style] button[type="submit"],
.platform-console button:where(:not(.nav button)),
.platform-console button.secondary,
.platform-console button.ghost,
.purchase-reference button,
.purchase-reference .link-button,
.purchase-reference :is(button, .link-button):is(.light, .dark) {
  border: 1px solid var(--control-border);
  background: var(--control-background);
  color: var(--control-text);
  box-shadow: none;
}

/* Named action surfaces previously used local blue, teal, gold or grey fills.
   Only actual actions are listed: no broad .actions descendant reset. */
body.premium-admin :is(button.ghost, button.secondary):hover:not(:disabled),
.premium-admin button:hover:where(:not(:disabled)),
.premium-agency button:hover:not(:disabled),
body.premium-agency[data-frontend-theme-style] :is(button.ghost, button.secondary):hover:not(:disabled),
body.premium-agency[data-frontend-theme-style] :is(.mall-search-form button, .order-actions > button:not(.ghost), .quick-order-actions > button:not(.ghost)),
body.premium-agency[data-frontend-theme-style] :is(.mall-search-form button, .order-actions > button:not(.ghost), .quick-order-actions > button:not(.ghost)):hover:not(:disabled),
body.premium-agency[data-frontend-theme-style] .agency-home-discovery .mall-search-form button,
body.premium-agency[data-frontend-theme-style] .mall-product-buy > button[data-mall-product-select]:is(.ghost, :not(.ghost)),
body.premium-agency[data-frontend-theme-style] .mall-product-buy > button[data-mall-product-select]:hover:not(:disabled),
body.premium-agency[data-frontend-theme-style] .mall-product-spec-action > button,
body.premium-agency[data-frontend-theme-style] .mall-product-spec-action > button:hover:not(:disabled),
body.premium-agency[data-frontend-theme-style] .mall-product-spec-action > button.is-selected,
body.premium-agency[data-frontend-theme-style] .mall-product-spec-action > button.is-selected:hover:not(:disabled),
body.premium-login[data-frontend-theme-style] button[type="submit"]:hover,
.platform-console button:where(:not(.nav button)):hover,
.purchase-reference :is(button, .link-button):hover,
.purchase-reference :is(button, .link-button):is(.light, .dark):hover,
.purchase-reference .qty-row .add-button,
body.premium-agency #quickOrderRecognize,
body.premium-agency #quickOrderApply,
body.premium-agency #quickOrderRecognize:hover:not(:disabled),
body.premium-agency #quickOrderApply:hover:not(:disabled),
body.premium-agency[data-frontend-theme-style] .mall-order-side button:is(.stable-date-trigger, .period-trigger),
body.premium-agency[data-frontend-theme-style] .mall-order-side button:is(.stable-date-trigger, .period-trigger):hover:not(:disabled),
body.premium-agency[data-frontend-theme-style] .traveller-image-upload,
body.premium-agency[data-frontend-theme-style] .traveller-image-upload:hover,
.premium-admin #addMallAdmin,
.premium-admin #addMallAdmin:hover:not(:disabled),
.premium-admin [data-mall-product-sync],
.premium-admin [data-mall-product-sync]:hover:not(:disabled),
#orderTable #searchOrdersBtn,
#orderTable [data-ow-filters],
#orderTable .ow-pane-copy,
#channels .cm-button,
#channels .cm-button:hover,
:is(#channelAccess, #channelCustomers) .ca-primary,
#agencies #channelCustomers .ca-primary,
.ca-dialog .ca-primary,
.aor-window .aor-primary,
.aor-window .aor-primary:hover,
.premium-admin :is(.platform-logo-upload, .mall-hero-upload, .mall-media-upload, .traveller-image-upload),
.premium-admin :is(.platform-logo-upload, .mall-hero-upload, .mall-media-upload, .traveller-image-upload):hover,
.premium-admin .price-selector-layout :is(button.ghost, button.secondary),
.premium-admin .price-selector-layout :is(button.ghost, button.secondary):hover:not(:disabled),
.premium-admin #modalForm .order-email-quick-copy,
.detail-copy-toolbar .order-email-quick-copy,
.order-email-record-actions > a.secondary {
  border: 1px solid var(--control-border);
  background: var(--control-background);
  color: var(--control-text);
  box-shadow: none;
  transform: none;
}

/* Email copy buttons had !important module declarations; resolve them at their
   source in admin-order-emails.css instead of adding another important layer. */
.premium-admin #modalForm .order-email-quick-copy strong { color: var(--control-text); }

/* Keep storefront search white even when older browsers discard the :is/:where
   selector groups above. Both agency levels use this same control. */
body.premium-agency[data-frontend-theme-style] .agency-home-discovery .mall-search-form button {
  border: 1px solid var(--control-border, #cbd5e1);
  background: var(--control-background, #ffffff);
  color: var(--control-text, #334155);
  box-shadow: none;
}

/* Preserve a visible selected state without a solid blue fill. */
body.premium-agency[data-frontend-theme-style] .mall-product-spec-action > button.is-selected:not(:disabled),
body.premium-agency[data-frontend-theme-style] .mall-section-nav button.is-active {
  --control-border: #64748b;
  --control-text: #172033;
  box-shadow: inset 0 0 0 1px #64748b;
}
body.premium-agency[data-frontend-theme-style] .aor-image-toolbar button[aria-pressed="true"]:not(:disabled),
body.premium-agency[data-frontend-theme-style] .aor-image-toolbar button[aria-pressed="true"]:hover:not(:disabled) {
  border: 1px solid #64748b;
  background: var(--control-background);
  color: #172033;
  box-shadow: inset 0 0 0 1px #64748b;
}

/* Destructive actions stay recognizable, with the same white surface. */
body.premium-admin button.danger:not(:disabled),
body.premium-agency[data-frontend-theme-style] button.danger:not(:disabled),
.platform-console button.danger,
.purchase-reference button.danger {
  border: 1px solid var(--control-border);
  background: var(--control-background);
  color: var(--control-text);
  box-shadow: none;
}

/* Gallery buttons are image surfaces and invisible navigation hit areas.
   Shared action borders would draw two vertical seams across the image. */
body.premium-agency .mall-detail-media button:is(.mall-scenic-nav, .mall-detail-media-frame),
body.premium-agency .mall-detail-media button:is(.mall-scenic-nav, .mall-detail-media-frame):is(:hover, :active, :disabled) {
  border: 0;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  transform: none;
}
body.premium-agency .mall-detail-media button.mall-scenic-nav,
body.premium-agency .mall-detail-media button.mall-scenic-nav:is(:hover, :active, :disabled) {
  background: transparent !important;
  color: transparent;
}

/* Keyboard and disabled states must not depend on a colored fill or shadow. */
:is(.premium-admin, .premium-agency, .premium-login, .platform-console, .purchase-reference) :is(button, .link-button):focus-visible {
  outline: 2px solid var(--action-focus);
  outline-offset: 3px;
}
#orderTable :is(button, summary, a):focus-visible {
  outline: 2px solid var(--action-focus);
  outline-offset: 3px;
}
body.premium-admin button:disabled,
body.premium-agency[data-frontend-theme-style] button:disabled,
body.premium-login[data-frontend-theme-style] button:disabled,
.platform-console button:disabled,
.purchase-reference button:disabled {
  border-color: var(--action-disabled-border);
  background: var(--action-disabled-background);
  color: var(--action-disabled-text);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

@media (forced-colors: active) {
  :is(.premium-admin, .premium-agency, .premium-login, .platform-console, .purchase-reference) button:focus-visible {
    outline-color: Highlight;
  }
}
