/* SmartSub-style custom select component */

.smartsub-select-wrap {
  position: relative;
  width: 100%;
  display: block;
}

.smartsub-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.smartsub-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 36px;
  padding: 0 12px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #dee0e3);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text, #1f2329);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s cubic-bezier(0.16, 1, 0.3, 1), 
              box-shadow 0.15s cubic-bezier(0.16, 1, 0.3, 1), 
              background 0.15s;
  box-sizing: border-box;
  text-align: left;
}

.smartsub-select-trigger:hover {
  border-color: #b8bcc4;
}

.smartsub-select-trigger:focus-visible,
.smartsub-select-trigger.is-open {
  border-color: var(--primary, #1e6fff);
  box-shadow: 0 0 0 2px rgba(30, 111, 255, 0.14);
  outline: none;
}

.smartsub-select-value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.smartsub-select-chevron {
  width: 15px;
  height: 15px;
  color: var(--text-tertiary, #8f959e);
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.15s;
}

.smartsub-select-trigger.is-open .smartsub-select-chevron {
  transform: rotate(180deg);
  color: var(--primary, #1e6fff);
}

.smartsub-select-popover {
  position: absolute;
  left: 0;
  right: 0;
  min-width: 100%;
  z-index: 1050;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border-soft, #dee0e3);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 
              0 10px 15px -3px rgba(0, 0, 0, 0.08), 
              0 0 0 1px rgba(0, 0, 0, 0.04);
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: none;
  box-sizing: border-box;
  transform-origin: top center;
}

.smartsub-select-popover[data-side="top"] {
  transform-origin: bottom center;
}

.smartsub-select-popover.is-open {
  display: block;
  animation: smartsubSelectInBottom 160ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.smartsub-select-popover.is-open[data-side="top"] {
  display: block;
  animation: smartsubSelectInTop 160ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.smartsub-select-popover.is-closing {
  display: block;
  animation: smartsubSelectOutBottom 100ms ease-in forwards;
  pointer-events: none;
}

.smartsub-select-popover.is-closing[data-side="top"] {
  display: block;
  animation: smartsubSelectOutTop 100ms ease-in forwards;
  pointer-events: none;
}

@keyframes smartsubSelectInBottom {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes smartsubSelectInTop {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes smartsubSelectOutBottom {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }
}

@keyframes smartsubSelectOutTop {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
}

.smartsub-select-item {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 7px 10px 7px 30px;
  font-size: 13px;
  color: var(--text, #1f2329);
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, color 0.12s;
  box-sizing: border-box;
  line-height: 1.4;
}

.smartsub-select-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.smartsub-select-item.is-selected {
  background: #eff6ff;
  color: var(--primary, #1e6fff);
  font-weight: 500;
}

.smartsub-select-check {
  position: absolute;
  left: 8px;
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s cubic-bezier(0.16, 1, 0.3, 1), transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.smartsub-select-item.is-selected .smartsub-select-check {
  opacity: 1;
  transform: scale(1);
}
