/* ================================================================
   GTExD UI Core 1.2.5 — canonical form controls
   Source of truth: shared dropdown affordance + focus and contrast.
   Scoped to GTExD WordPress admin pages and GTExD frontend shells.
   No page scripts, no DOM rewriting, no impact on native WP pages.
   ================================================================ */

:root {
  --gtexd-control-bg: #0e1319;
  --gtexd-control-border: #465665;
  --gtexd-control-text: #f4f5f7;
  --gtexd-control-arrow-surface: #171c22;
  --gtexd-control-height: 46px;
  --gtexd-control-radius: 4px;
}

/* Self-contained right-hand chevron panel. A background IMAGE on the select
   avoids extra wrapper markup, preserving label > select layout, grid/flex,
   existing JS event listeners, keyboard and native dropdown interaction.
   Unlike native arrows this remains visible in Safari and wp-admin themes. */
:where(body.gtexd-ui-managed #wpcontent,
       .gtexd-page,
       .gtexd-event-hub,
       .gtexd-market-hub,
       .gtexd-gt7-market-hub,
       .gtexd-driver-hub,
       .gtexd-ui)
  select:not([multiple]):not([size]):not([data-gtexd-native-select]) {
  appearance: none !important;
  -webkit-appearance: none !important;
  box-sizing: border-box !important;
  max-width: 100% !important;
  min-height: var(--gtexd-control-height) !important;
  padding-right: 58px !important;
  border: 1px solid var(--gtexd-control-border) !important;
  border-radius: var(--gtexd-control-radius) !important;
  background-color: var(--gtexd-control-bg) !important;
  color: var(--gtexd-control-text) !important;
  -webkit-text-fill-color: var(--gtexd-control-text) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Crect width='48' height='48' fill='%23171c22'/%3E%3Cpath d='M1 0V48' fill='none' stroke='%234f6170' stroke-width='1'/%3E%3Cpath d='m17 20 7 7 7-7' fill='none' stroke='%23f4f5f7' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-position: right center !important;
  background-size: 47px 100% !important;
  background-repeat: no-repeat !important;
  box-shadow: none !important;
  cursor: pointer !important;
}

/* Custom selectors supplied by UI Core and Vision already have an independent
   chevron and their own correct geometry. Never draw a second one. */
:where(body.gtexd-ui-managed #wpcontent,
       .gtexd-page,
       .gtexd-event-hub,
       .gtexd-market-hub,
       .gtexd-gt7-market-hub,
       .gtexd-driver-hub,
       .gtexd-ui)
  :is(.gtexd-select-wrap > select,
      .gtexd-vision-type-select > select) {
  background-image: none !important;
  padding-right: 52px !important;
}

:where(body.gtexd-ui-managed #wpcontent,
       .gtexd-page,
       .gtexd-event-hub,
       .gtexd-market-hub,
       .gtexd-gt7-market-hub,
       .gtexd-driver-hub,
       .gtexd-ui)
  select:not([multiple]):not([size]):focus-visible {
  border-color: var(--gtexd-color-accent, #c42026) !important;
  outline: 2px solid var(--gtexd-color-accent, #c42026) !important;
  outline-offset: 1px;
}

:where(body.gtexd-ui-managed #wpcontent,
       .gtexd-page,
       .gtexd-event-hub,
       .gtexd-market-hub,
       .gtexd-gt7-market-hub,
       .gtexd-driver-hub,
       .gtexd-ui)
  select:not([multiple]):not([size]):disabled {
  cursor: not-allowed !important;
  opacity: .7;
}

/* Other form fields share the same baseline; preserve per-module width, spacing
   and special-purpose focus behaviours. Limit admin rule to GTExD pages only. */
body.gtexd-ui-managed #wpcontent
  :is(input[type='text'],input[type='search'],input[type='url'],input[type='email'],input[type='number'],textarea):not(.wp-color-picker) {
  box-sizing: border-box;
  max-width: 100%;
  border-radius: var(--gtexd-control-radius);
}

@media (max-width: 782px) {
  :where(body.gtexd-ui-managed #wpcontent,
         .gtexd-page,
         .gtexd-event-hub,
         .gtexd-market-hub,
         .gtexd-gt7-market-hub,
         .gtexd-driver-hub,
         .gtexd-ui)
    select:not([multiple]):not([size]) {
    font-size: 16px !important; /* Prevent automatic iOS zoom on focus */
  }
}

/* High-specificity exemption: Vision's chevron and the UI Core select shell
   belong to their wrapper. Override the generic :not() specificity above. */
body.gtexd-ui-managed #wpcontent .gtexd-vision-type-select > select,
body.gtexd-ui-managed #wpcontent .gtexd-select-wrap > select,
.gtexd-vision-shell .gtexd-vision-type-select > select,
.gtexd-vision-shell .gtexd-select-wrap > select {
  background-image: none !important;
  padding-right: 52px !important;
}

/* Opened native menus receive readable text as well; without this, Chrome/iOS
   may use a light option list with inherited near-white text. */
body.gtexd-ui-managed #wpcontent select option,
body.gtexd-ui-managed #wpcontent select optgroup {
  background-color: #171c22 !important;
  color: #f4f5f7 !important;
}

/* Same exclusion in the public UI: structural chevrons must remain single. */
:is(.gtexd-page,.gtexd-event-hub,.gtexd-market-hub,.gtexd-gt7-market-hub,.gtexd-driver-hub,.gtexd-ui)
  .gtexd-select-wrap.gtexd-select-wrap > select,
:is(.gtexd-page,.gtexd-event-hub,.gtexd-market-hub,.gtexd-gt7-market-hub,.gtexd-driver-hub,.gtexd-ui)
  .gtexd-vision-type-select.gtexd-vision-type-select > select {
  background-image: none !important;
  padding-right: 52px !important;
}
