/* sp_controls_html — the controls card's own rules, kept here because the
 * server strips a template's <style> block.
 *
 * The form root is the .sp-controls-card div itself, so that rule and its
 * :hover stay BARE classes; every other class rule is scoped
 * :where(.sp-controls-card), which adds zero specificity and so cannot change
 * which rule wins. This is a child form mounted into the stock-pick-list
 * shell, never a screen, so the root rule takes no position, flex or
 * min-height and carries exactly what it carried before.
 *
 * The five #sp-home-input rules stay BARE and id-led: at (1,0,0) or better they
 * win from any document position, and moving this sheet from a body <style>
 * block to a head <link> only changes document order.
 * #sp-home-input:focus ~ .sp-home-combo-icon is kept byte-identical: its
 * subject is now the <span> wrapping that svg, in the same sibling position.
 *
 * TWO DECLARATIONS ARE NEW, both `line-height: 0`. The designer cannot set a
 * class on an <svg> (it assigns element.className, read-only on SVGElement), so
 * the search icon and the chevron are each wrapped in a <span> carrying the
 * svg's classes, and these rules now position the span. `line-height: 0` is
 * what makes the span's box equal the svg's. The rotate on
 * .sp-home-combo.open .sp-home-combo-chevron acts on the span and takes the
 * svg with it. Nothing else in either rule changes.
 *
 * No designer gate. Nothing here is hidden until JavaScript runs:
 * .sp-home-dropdown's `display: none` is a CLOSED dropdown, which is the right
 * resting state on the canvas too, and the reveal
 * (.sp-home-combo.open .sp-home-dropdown) is one class heavier either way.
 *
 * The three @media blocks keep the same scoping rule as their base rules, so
 * which of a pair wins is still decided by their order in this file, exactly as
 * it was decided by their order in the style block.
 *
 * The accent tokens (--accent, --accent-subtle) are declared on .sp-dashboard
 * by the shell and reach here by inheritance, unchanged.
 */

/* ========================================
   SP CONTROLS CARD - uses shared .px-card
   Form-specific note and grid layout
   ======================================== */
.sp-controls-card {
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.sp-controls-card:hover {
  box-shadow: var(--px-shadow-md);
}


:where(.sp-controls-card) .sp-controls-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ========================================
   HOME SELECTION - SEARCHABLE COMBOBOX
   ======================================== */
:where(.sp-controls-card) .sp-controls-home-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

:where(.sp-controls-card) .sp-home-label {
  font-family: var(--px-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--px-text-muted);
}

:where(.sp-controls-card) .sp-home-combo {
  position: relative;
}

:where(.sp-controls-card) .sp-home-combo-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--px-text-muted);
  pointer-events: none;
  transition: color 0.2s ease;
  line-height: 0;
}

:where(.sp-controls-card) .sp-home-combo-chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  color: var(--px-text-muted);
  pointer-events: none;
  transition: color 0.2s ease, transform 0.2s ease;
  line-height: 0;
}

:where(.sp-controls-card) .sp-home-combo.open .sp-home-combo-chevron {
  transform: translateY(-50%) rotate(180deg);
  color: var(--accent);
}

#sp-home-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 36px 10px 36px;
  font-family: var(--px-font);
  font-size: 13px;
  font-weight: 500;
  color: var(--px-text-primary);
  background: var(--px-bg-elevated);
  border: 1px solid var(--px-border);
  border-radius: var(--px-radius-sm);
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#sp-home-input::placeholder {
  color: var(--px-text-muted);
  font-weight: 400;
}

#sp-home-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
  cursor: text;
}

#sp-home-input:focus ~ .sp-home-combo-icon {
  color: var(--accent);
}

:where(.sp-controls-card) .sp-home-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--px-bg-card);
  border: 1px solid var(--px-border);
  border-radius: var(--px-radius-sm);
  box-shadow: var(--px-shadow-md);
  z-index: 100;
}

:where(.sp-controls-card) .sp-home-combo.open .sp-home-dropdown {
  display: block;
}

:where(.sp-controls-card) .sp-home-dropdown::-webkit-scrollbar {
  width: 6px;
}

:where(.sp-controls-card) .sp-home-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

:where(.sp-controls-card) .sp-home-dropdown::-webkit-scrollbar-thumb {
  background: var(--px-border);
  border-radius: 3px;
}

:where(.sp-controls-card) .sp-home-option {
  padding: 9px 12px;
  font-family: var(--px-font);
  font-size: 13px;
  color: var(--px-text-primary);
  cursor: pointer;
  transition: background 0.15s ease;
}

:where(.sp-controls-card) .sp-home-option:hover,
:where(.sp-controls-card) .sp-home-option.highlighted {
  background: var(--accent-subtle);
  color: var(--accent);
}

:where(.sp-controls-card) .sp-home-option.selected {
  font-weight: 600;
  color: var(--accent);
}

:where(.sp-controls-card) .sp-home-no-results {
  padding: 12px;
  font-family: var(--px-font);
  font-size: 13px;
  color: var(--px-text-muted);
  font-style: italic;
  text-align: center;
}

/* ========================================
   DATES SECTION
   ======================================== */
:where(.sp-controls-card) .sp-controls-dates-section {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  gap: 16px;
  align-items: end;
}

:where(.sp-controls-card) .sp-date-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

:where(.sp-controls-card) .sp-date-group label {
  font-family: var(--px-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--px-text-muted);
}

:where(.sp-controls-card) .sp-date-group input[type="date"] {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-family: var(--px-font);
  font-size: 13px;
  color: var(--px-text-primary);
  background: var(--px-bg-elevated);
  border: 1px solid var(--px-border);
  border-radius: var(--px-radius-sm);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

:where(.sp-controls-card) .sp-date-group input[type="date"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

:where(.sp-controls-card) .sp-date-group input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

:where(.sp-controls-card) .sp-date-group input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* ========================================
   ACTIONS SECTION
   ======================================== */
:where(.sp-controls-card) .sp-controls-actions-section {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  align-items: center;
}

:where(.sp-controls-card) .sp-controls-actions-section .sp-toggle-wrap {
  padding: 0;
}

/* ========================================
   TOGGLE SWITCH
   ======================================== */
:where(.sp-controls-card) .sp-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

:where(.sp-controls-card) .sp-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

:where(.sp-controls-card) .sp-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

:where(.sp-controls-card) .sp-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--px-border);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

:where(.sp-controls-card) .sp-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

:where(.sp-controls-card) .sp-toggle input:checked + .sp-toggle-slider {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

:where(.sp-controls-card) .sp-toggle input:checked + .sp-toggle-slider::before {
  transform: translateX(20px);
}

:where(.sp-controls-card) .sp-toggle input:focus-visible + .sp-toggle-slider {
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

:where(.sp-controls-card) .sp-toggle-label {
  font-family: var(--px-font);
  font-size: 13px;
  font-weight: 500;
  color: var(--px-text-secondary);
  user-select: none;
}

:where(.sp-controls-card) .sp-toggle-tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 11px;
  font-style: normal;
  color: var(--px-text-muted);
  border: 1px solid var(--px-border);
  border-radius: 50%;
  cursor: help;
  flex-shrink: 0;
  transition: color 0.2s ease, border-color 0.2s ease;
}

:where(.sp-controls-card) .sp-toggle-tooltip:hover {
  color: var(--accent);
  border-color: var(--accent);
}

:where(.sp-controls-card) .sp-toggle-wrap.sp-disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 900px) {
  :where(.sp-controls-card) .sp-controls-dates-section,
  :where(.sp-controls-card) .sp-controls-actions-section {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  :where(.sp-controls-card) .sp-home-option {
    padding: 12px;
    font-size: 14px;
  }

  :where(.sp-controls-card) .sp-home-dropdown {
    max-height: 260px;
  }
}

@media (max-width: 600px) {
  .sp-controls-card {
    padding: 16px;
  }

  :where(.sp-controls-card) .sp-controls-dates-section,
  :where(.sp-controls-card) .sp-controls-actions-section {
    grid-template-columns: 1fr;
  }

  #sp-home-input,
  :where(.sp-controls-card) .sp-date-group input[type="date"] {
    padding: 12px 36px 12px 36px;
    font-size: 14px;
  }

  :where(.sp-controls-card) .sp-date-group input[type="date"] {
    padding: 12px;
  }

  :where(.sp-controls-card) .sp-toggle-wrap {
    padding: 10px 0;
  }

  :where(.sp-controls-card) .sp-toggle-label {
    font-size: 14px;
  }
}
