/**
 * Minimal iOS-style selects — native + Select2
 * Clean grouped-control look (Settings / Forms on iOS)
 */
:root {
  --pp-select-bg: hsl(240 6% 97%);
  --pp-select-bg-open: #fff;
  --pp-select-border: rgba(60, 60, 67, 0.14);
  --pp-select-border-focus: var(--pp-admin-primary, hsl(221 83% 53%));
  --pp-select-radius: 10px;
  --pp-select-radius-sm: 8px;
  --pp-select-text: hsl(222 47% 11%);
  --pp-select-muted: rgba(60, 60, 67, 0.55);
  --pp-select-chevron: rgba(60, 60, 67, 0.42);
  --pp-select-height: calc(2.5rem + 2px);
  --pp-select-height-sm: calc(2rem + 2px);
  --pp-select-option-hover: hsl(221 83% 53% / 0.08);
  --pp-select-option-active: hsl(221 83% 53% / 0.14);
  --pp-select-dropdown-shadow: 0 8px 28px rgba(15, 23, 42, 0.1);
}

/* —— Native select —— */
body#app select,
body#app select.form-control,
body#app .custom-select,
.pp-spa-wrapper select,
.pp-spa-wrapper select.form-control,
.pp-spa-wrapper .custom-select,
.modal select,
.modal select.form-control,
.modal .custom-select {
  min-height: var(--pp-select-height);
  height: var(--pp-select-height);
  padding: 0.45rem 2.25rem 0.45rem 0.85rem;
  font-size: 0.9375rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--pp-select-text);
  background-color: var(--pp-select-bg);
  border: 1px solid var(--pp-select-border);
  border-radius: var(--pp-select-radius);
  box-shadow: none;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='rgba(60,60,67,0.45)' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 16px;
}

body#app select.form-control-sm,
.pp-spa-wrapper select.form-control-sm,
.modal select.form-control-sm {
  min-height: var(--pp-select-height-sm);
  height: var(--pp-select-height-sm);
  padding: 0.3rem 2rem 0.3rem 0.65rem;
  font-size: 0.875rem;
  border-radius: var(--pp-select-radius-sm);
  background-position: right 0.5rem center;
  background-size: 14px;
}

body#app select:hover,
body#app select.form-control:hover,
.pp-spa-wrapper select:hover,
.modal select:hover {
  background-color: hsl(240 6% 95%);
  border-color: rgba(60, 60, 67, 0.2);
}

body#app select:focus,
body#app select.form-control:focus,
body#app .custom-select:focus,
.pp-spa-wrapper select:focus,
.modal select:focus {
  background-color: var(--pp-select-bg-open);
  border-color: var(--pp-select-border-focus);
  outline: none;
  box-shadow: none;
}

body#app select:disabled,
.pp-spa-wrapper select:disabled,
.modal select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background-color: hsl(240 5% 94%);
}

/* option list (limited browser styling) */
body#app select option,
.pp-spa-wrapper select option {
  font-size: 0.9375rem;
  padding: 0.35rem 0.5rem;
  color: var(--pp-select-text);
}

/* POS cart #list-sale — AdminLTE3 / Bootstrap 4 form-control-sm (native menulist, no iOS skin) */
body#app #list-sale select.form-control,
.pp-spa-wrapper #list-sale select.form-control,
#list-sale select.form-control {
  -webkit-appearance: menulist;
  appearance: auto;
  display: inline-block;
  width: auto;
  max-width: 100%;
  min-height: 22px;
  height: 22px;
  padding: 0 0.3rem;
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 22px;
  letter-spacing: normal;
  color: #495057;
  background-color: #fff;
  background-image: none;
  border: 1px solid #ced4da;
  border-radius: 0.2rem;
  box-shadow: none;
  cursor: pointer;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  vertical-align: middle;
  flex: none;
}

body#app #list-sale select.form-control:hover,
.pp-spa-wrapper #list-sale select.form-control:hover,
#list-sale select.form-control:hover {
  background-color: #fff;
  border-color: #adb5bd;
}

body#app #list-sale select.form-control:focus,
.pp-spa-wrapper #list-sale select.form-control:focus,
#list-sale select.form-control:focus {
  background-color: #fff;
  border-color: #80bdff;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

body#app #list-sale select.form-control option,
.pp-spa-wrapper #list-sale select.form-control option,
#list-sale select.form-control option {
  font-size: 0.8125rem;
  padding: 0;
  color: #212529;
}

/* POS cart #list-sale — qty stepper (topping-style compact) */
#list-sale .pos-qty-stepper--cart {
  flex-shrink: 0;
}

body#app #list-sale .pos-qty-stepper--cart .pos-qty-input,
.pp-spa-wrapper #list-sale .pos-qty-stepper--cart .pos-qty-input,
#list-sale .pos-qty-stepper--cart .pos-qty-input {
  box-sizing: border-box;
  margin: 0;
  border-radius: 0;
  background: #fff !important;
  box-shadow: none !important;
  outline: none;
}

body#app #list-sale .pos-qty-stepper--cart .pos-qty-input:focus,
.pp-spa-wrapper #list-sale .pos-qty-stepper--cart .pos-qty-input:focus,
#list-sale .pos-qty-stepper--cart .pos-qty-input:focus {
  background: #fff !important;
  box-shadow: inset 0 0 0 1px rgba(1, 123, 255, 0.35) !important;
  outline: none;
}

/* POS cart #list-sale — unit + price type: borderless inline selects */
body#app #list-sale select.pos-cart-unit-select,
.pp-spa-wrapper #list-sale select.pos-cart-unit-select,
#list-sale select.pos-cart-unit-select,
body#app #list-sale select.pos-cart-price-type,
.pp-spa-wrapper #list-sale select.pos-cart-price-type,
#list-sale select.pos-cart-price-type {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none;
  -webkit-appearance: menulist;
  appearance: menulist;
}

body#app #list-sale select.pos-cart-unit-select:focus,
.pp-spa-wrapper #list-sale select.pos-cart-unit-select:focus,
#list-sale select.pos-cart-unit-select:focus,
body#app #list-sale select.pos-cart-price-type:focus,
.pp-spa-wrapper #list-sale select.pos-cart-price-type:focus,
#list-sale select.pos-cart-price-type:focus {
  border: none !important;
  box-shadow: none !important;
  outline: none;
}

/* POS cart #list-sale — unit select compact 50px */
body#app #list-sale select.pos-cart-unit-select,
.pp-spa-wrapper #list-sale select.pos-cart-unit-select,
#list-sale select.pos-cart-unit-select {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  min-height: 20px;
  height: 20px;
  max-height: 20px;
  padding: 0 0.05rem;
  font-size: 0.6875rem;
  line-height: 18px;
  box-sizing: border-box;
  text-overflow: ellipsis;
}

/* POS cart bottom row — price left · qty center · actions right */
#list-sale .pb-li-bot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
}

#list-sale .pb-li-bot .pb-li-price {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}

#list-sale .pb-qty {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-width: 0;
  margin-left: 0;
}

#list-sale .pb-li-bot-actions {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  align-self: center;
  gap: 0.25rem;
  margin-left: 0;
  flex-shrink: 0;
}

/* POS cart #list-sale — price type select compact (N/A/B/C/D) */
body#app #list-sale select.pos-cart-price-type,
.pp-spa-wrapper #list-sale select.pos-cart-price-type,
#list-sale select.pos-cart-price-type {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  min-height: 22px;
  height: 22px;
  max-height: 22px;
  padding: 0 0.1rem;
  font-size: 0.8125rem;
  line-height: 20px;
  box-sizing: border-box;
  text-align: center;
  text-align-last: center;
}

/* —— Select2 — iOS picker sheet feel —— */
.select2-container--bootstrap4 {
  width: 100% !important;
}

.select2-container--bootstrap4 .select2-selection--single,
.select2-container--bootstrap4 .select2-selection--multiple {
  min-height: var(--pp-select-height);
  border: 1px solid var(--pp-select-border);
  border-radius: var(--pp-select-radius);
  background: var(--pp-select-bg);
  box-shadow: none;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.select2-container--bootstrap4 .select2-selection--single {
  display: flex;
  align-items: center;
  padding: 0;
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
  padding: 0.45rem 2.25rem 0.45rem 0.85rem;
  font-size: 0.9375rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.35;
  color: var(--pp-select-text);
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__placeholder {
  color: var(--pp-select-muted);
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
  top: 50%;
  right: 0.55rem;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: -0.625rem;
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow b {
  display: none;
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow::after {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  margin: 0 auto;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='rgba(60,60,67,0.45)' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.2s ease;
}

.select2-container--bootstrap4.select2-container--open .select2-selection--single .select2-selection__arrow::after {
  transform: rotate(180deg);
}

.select2-container--bootstrap4.select2-container--focus .select2-selection,
.select2-container--bootstrap4.select2-container--open .select2-selection {
  border-color: var(--pp-select-border-focus);
  background: var(--pp-select-bg-open);
  box-shadow: none;
}

/* Multiple */
.select2-container--bootstrap4 .select2-selection--multiple {
  padding: 0.25rem 0.45rem;
  min-height: var(--pp-select-height);
}

.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice {
  border: none;
  border-radius: 999px;
  background: var(--pp-select-option-active);
  color: var(--pp-select-border-focus);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.15rem 0.55rem;
  margin: 0.15rem 0.25rem 0.15rem 0;
}

.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__remove {
  color: var(--pp-select-border-focus);
  margin-right: 0.25rem;
  border: none;
}

.select2-container--bootstrap4 .select2-selection--multiple .select2-search__field {
  font-size: 0.9375rem;
  margin-top: 0.2rem;
}

/* Dropdown panel */
.select2-container--bootstrap4 .select2-dropdown {
  margin-top: 4px;
  border: 1px solid var(--pp-select-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--pp-select-dropdown-shadow);
  overflow: hidden;
}

.select2-container--bootstrap4 .select2-search--dropdown {
  padding: 0.5rem 0.55rem 0.35rem;
}

.select2-container--bootstrap4 .select2-search--dropdown .select2-search__field {
  border: 1px solid var(--pp-select-border);
  border-radius: 8px;
  background: var(--pp-select-bg);
  padding: 0.45rem 0.65rem;
  font-size: 0.9375rem;
  box-shadow: none;
}

.select2-container--bootstrap4 .select2-search--dropdown .select2-search__field:focus {
  border-color: var(--pp-select-border-focus);
  outline: none;
  box-shadow: none;
  background: #fff;
}

.select2-container--bootstrap4 .select2-results__options {
  max-height: 280px;
  padding: 0.35rem;
}

.select2-container--bootstrap4 .select2-results__option {
  padding: 0.55rem 0.75rem;
  font-size: 0.9375rem;
  border-radius: 8px;
  color: var(--pp-select-text);
  transition: background-color 0.12s ease;
}

.select2-container--bootstrap4 .select2-results__option--highlighted,
.select2-container--bootstrap4 .select2-results__option--highlighted[aria-selected] {
  background: var(--pp-select-option-hover);
  color: var(--pp-select-text);
}

.select2-container--bootstrap4 .select2-results__option[aria-selected="true"] {
  background: var(--pp-select-option-active);
  color: var(--pp-select-border-focus);
  font-weight: 600;
}

.select2-container--bootstrap4 .select2-results__option--selected {
  background: var(--pp-select-option-active);
  color: var(--pp-select-border-focus);
}

.select2-container--bootstrap4 .select2-results__message {
  font-size: 0.875rem;
  color: var(--pp-select-muted);
  padding: 0.65rem 0.75rem;
}

/* Dashboard filters */
.dash-crm select.form-control-sm,
.dash-crm .dashFilters select.form-control-sm {
  min-height: var(--pp-select-height-sm);
  height: var(--pp-select-height-sm);
  background-color: var(--pp-select-bg);
  border-color: var(--pp-select-border);
  border-radius: var(--pp-select-radius-sm);
}

.dash-crm select.form-control-sm:focus,
.dash-crm .dashFilters select.form-control-sm:focus {
  background-color: #fff;
  border-color: var(--pp-select-border-focus);
}

/* Grouped row — iOS inset list */
.pp-select-group {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: var(--pp-select-radius);
  overflow: hidden;
  border: 1px solid var(--pp-select-border);
  background: var(--pp-select-bg);
}

.pp-select-group select,
.pp-select-group .form-control {
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--pp-select-border);
  background: transparent;
}

.pp-select-group select:last-child,
.pp-select-group .form-control:last-child {
  border-bottom: none;
}

@media (max-width: 767.98px) {
  body#app select,
  body#app select.form-control,
  .pp-spa-wrapper select,
  .pp-spa-wrapper select.form-control,
  .modal select,
  .modal select.form-control,
  .modal .custom-select,
  .select2-container--bootstrap4 .select2-selection--single,
  .select2-container--bootstrap4 .select2-selection--multiple {
    min-height: 48px;
    font-size: 16px !important;
    touch-action: manipulation;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
  }

  body#app #list-sale select.form-control,
  .pp-spa-wrapper #list-sale select.form-control,
  #list-sale select.form-control {
    min-height: 20px !important;
    height: 20px !important;
    line-height: 18px !important;
    font-size: 0.6875rem !important;
  }

  body#app #list-sale .pos-qty-stepper--cart .pos-qty-input,
  .pp-spa-wrapper #list-sale .pos-qty-stepper--cart .pos-qty-input,
  #list-sale .pos-qty-stepper--cart .pos-qty-input {
    min-height: 1.25rem !important;
    height: 1.25rem !important;
    max-height: 1.25rem !important;
    line-height: 1.25rem !important;
    font-size: 0.75rem !important;
    width: 1.625rem !important;
    min-width: 1.625rem !important;
    max-width: 1.625rem !important;
    color: #017BFF !important;
  }

  body#app #list-sale .pos-qty-stepper--cart .pos-qty-step,
  .pp-spa-wrapper #list-sale .pos-qty-stepper--cart .pos-qty-step,
  #list-sale .pos-qty-stepper--cart .pos-qty-step {
    min-height: 1.25rem !important;
    height: 1.25rem !important;
    max-height: 1.25rem !important;
    flex: 0 0 1.25rem !important;
    width: 1.25rem !important;
    background: #017BFF !important;
    color: #fff !important;
  }

  .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
    font-size: 16px !important;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }

  .select2-container--bootstrap4 .select2-results__option {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  body#app select,
  .select2-container--bootstrap4 .select2-selection--single,
  .select2-container--bootstrap4 .select2-results__option {
    transition: none;
  }
}
