/**
 * UmaCity Motion UI Component Styles
 * Motion Prompt #053: Dropdown (select)
 * Motion Prompt #063: Stepper (+/−)
 */

/* =========================================================
   MOTION PROMPT #053: DROPDOWN (SELECT)
   ========================================================= */

.uma-select-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
  vertical-align: middle;
}

.uma-select-wrap.is-open {
  z-index: 1000 !important;
}

.uma-select-wrap.shrink-0 {
  flex-shrink: 0;
  width: auto;
}

/* Stacking context lifting for parent panels when dropdown is open */
.theme-panel:has(.uma-select-wrap.is-open),
.theme-card:has(.uma-select-wrap.is-open),
div:has(> .uma-select-wrap.is-open),
div:has(> div > .uma-select-wrap.is-open) {
  position: relative;
  z-index: 100 !important;
}

.uma-select-trigger {
  width: 100%;
  height: 38px;
  min-height: 38px;
  box-sizing: border-box;
  padding: 0 10px 0 12px;
  border-radius: 8px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.65);
  color: #f1f5f9;
  font-size: 11.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
  text-align: left;
  user-select: none;
  outline: none;
  /* Motion timing: 0.25s easeOutCubic border & glow */
  transition: border-color 0.25s cubic-bezier(0.33, 1, 0.68, 1),
              box-shadow 0.25s cubic-bezier(0.33, 1, 0.68, 1),
              background 0.2s ease;
}

.uma-select-wrap.uma-select-sm .uma-select-trigger {
  height: 36px;
  min-height: 36px;
  font-size: 11px;
  padding: 0 8px 0 10px;
}

.uma-select-trigger:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(15, 23, 42, 0.85);
}

/* Open state: border becomes 2px and accent color */
.uma-select-trigger.is-open {
  border-width: 2px !important;
  border-color: var(--uma-turf, #10b981) !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2) !important;
}

.uma-select-trigger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.uma-select-value {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.uma-select-value.is-placeholder {
  color: #94a3b8;
  font-weight: 500;
}

/* Chevron rotates 180deg over 0.25s */
.uma-select-chevron {
  flex-shrink: 0;
  color: #94a3b8;
  transition: transform 0.25s cubic-bezier(0.33, 1, 0.68, 1), color 0.2s ease;
}

.uma-select-chevron.is-open {
  transform: rotate(180deg);
  color: var(--uma-turf, #10b981);
}

/* Dropdown list container: shadow blur 18, radius 8 */
.uma-select-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  min-width: 100%;
  z-index: 99999 !important;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #111827;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  padding: 4px;
  transform-origin: top center;
  /* Opening: 0.25s easeOutCubic, drops 6px */
  animation: umaSelectDropIn 0.25s cubic-bezier(0.33, 1, 0.68, 1) forwards;
}

.uma-select-dropdown.drop-down {
  top: calc(100% + 4px);
  transform-origin: top center;
}

.uma-select-dropdown.drop-up {
  bottom: calc(100% + 4px);
  transform-origin: bottom center;
  animation: umaSelectDropInUp 0.25s cubic-bezier(0.33, 1, 0.68, 1) forwards;
}

/* Closing: 0.15s easeInOutCubic */
.uma-select-dropdown.is-closing {
  animation: umaSelectDropOut 0.15s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

@keyframes umaSelectDropIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes umaSelectDropInUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes umaSelectDropOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.uma-select-list {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Option item: comfortable spacing, highlight on hover/focus */
.uma-select-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 6px;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  user-select: none;
}

.uma-select-option:hover,
.uma-select-option.is-focused {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  font-weight: 600;
}

.uma-select-option.is-selected {
  background: rgba(16, 185, 129, 0.22);
  color: #10b981;
  font-weight: 700;
}

.uma-select-option.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.uma-select-check {
  font-size: 11px;
  font-weight: 800;
}

/* Light theme for select */
html[data-theme="light"] .uma-select-trigger {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}
html[data-theme="light"] .uma-select-trigger:hover:not(:disabled) {
  border-color: #94a3b8;
  background: #f8fafc;
}
html[data-theme="light"] .uma-select-dropdown {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}
html[data-theme="light"] .uma-select-option {
  color: #334155;
}
html[data-theme="light"] .uma-select-option:hover,
html[data-theme="light"] .uma-select-option.is-focused {
  background: #ecfdf5;
  color: #059669;
}
html[data-theme="light"] .uma-select-option.is-selected {
  background: #d1fae5;
  color: #047857;
}


/* =========================================================
   MOTION PROMPT #063: STEPPER (+/−)
   ========================================================= */

.uma-stepper {
  display: inline-flex;
  align-items: stretch;
  width: 100%;
  height: 36px;
  min-height: 36px;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.65);
  overflow: hidden;
  user-select: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.uma-stepper:focus-within,
.uma-stepper:hover {
  border-color: rgba(255, 255, 255, 0.25);
}

.uma-stepper-sm {
  height: 34px;
  min-height: 34px;
}

.uma-stepper-sm .uma-stepper-btn {
  width: 28px;
  min-width: 28px;
}

.uma-stepper-sm .uma-stepper-symbol {
  font-size: 14px;
}

.uma-stepper-sm .uma-stepper-value-wrap {
  min-width: 24px;
  padding: 0 2px;
}

.uma-stepper-sm .uma-stepper-value {
  font-size: 12px;
}

/* Button segments: 34-38px */
.uma-stepper-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  background: transparent;
  border: none;
  outline: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0;
  /* Segment active tint transition */
  transition: background 0.15s ease, color 0.15s ease;
}

.uma-stepper-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.uma-stepper-btn.is-pressed,
.uma-stepper-btn:active:not(:disabled) {
  background: rgba(16, 185, 129, 0.25) !important;
  color: var(--uma-turf, #10b981) !important;
}

.uma-stepper-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.uma-stepper-symbol {
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
}

.uma-stepper-divider {
  width: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 6px 0;
  flex-shrink: 0;
}

/* Middle segment: number */
.uma-stepper-value-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 0 4px;
}

.uma-stepper-value-wrap.is-clickable {
  cursor: text;
}

.uma-stepper-value {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  transform-origin: center center;
  will-change: transform, color;
}

/* Number pop animation: scale 1.18 -> 1 over 0.25s linear with accent color */
@keyframes umaNumberPopAnim {
  0% {
    transform: scale(1.18);
    color: var(--uma-turf, #10b981);
  }
  100% {
    transform: scale(1);
    color: #f8fafc;
  }
}

.uma-stepper-value.uma-number-pop {
  animation: umaNumberPopAnim 0.25s linear forwards;
}

.uma-stepper-input {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: #ffffff;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  padding: 0;
  -moz-appearance: textfield;
}

.uma-stepper-input::-webkit-inner-spin-button,
.uma-stepper-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Light theme for stepper */
html[data-theme="light"] .uma-stepper {
  background: #ffffff;
  border-color: #cbd5e1;
}
html[data-theme="light"] .uma-stepper:focus-within,
html[data-theme="light"] .uma-stepper:hover {
  border-color: #94a3b8;
}
html[data-theme="light"] .uma-stepper-btn {
  color: #64748b;
}
html[data-theme="light"] .uma-stepper-btn:hover:not(:disabled) {
  background: #f1f5f9;
  color: #0f172a;
}
html[data-theme="light"] .uma-stepper-btn.is-pressed,
html[data-theme="light"] .uma-stepper-btn:active:not(:disabled) {
  background: #d1fae5 !important;
  color: #059669 !important;
}
html[data-theme="light"] .uma-stepper-divider {
  background: #e2e8f0;
}
html[data-theme="light"] .uma-stepper-value {
  color: #0f172a;
}
@keyframes umaNumberPopAnimLight {
  0% {
    transform: scale(1.18);
    color: #059669;
  }
  100% {
    transform: scale(1);
    color: #0f172a;
  }
}
html[data-theme="light"] .uma-stepper-value.uma-number-pop {
  animation: umaNumberPopAnimLight 0.25s linear forwards;
}
html[data-theme="light"] .uma-stepper-input {
  color: #0f172a;
}
