/* cignyl-sftp 20260824 */
/* ------------------------------ */
/* v2 Select (dropdown select)    */
/* ------------------------------ */

.v2-theme .v2-select {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--v2-space-xsm);

  --v2-select-height: 2.25rem; /* default (36px) */
  --v2-select-pad-x: var(--v2-space-sm);
  --v2-select-icon-hit: 2.25rem;
  --v2-select-caret-hit: 2rem;

  --v2-select-border: hsl(var(--input));
  --v2-select-bg: hsl(var(--background));
  --v2-select-fg: hsl(var(--foreground));
  --v2-select-muted: hsl(var(--muted-foreground));
  --v2-select-accent: hsl(var(--primary));
}

.v2-theme .v2-select__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--v2-space-md);
}

.v2-theme .v2-select__label {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  font-size: 0.875rem;
  /* Labels should read slightly stronger than field values. */
  font-weight: 600;
  line-height: 1.2;
  color: hsl(var(--foreground));
  min-width: 0;
}

.v2-theme .v2-select__label-right-slot {
  flex: 0 0 auto;
}

.v2-theme .v2-select__description {
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--v2-select-muted);
}

.v2-theme .v2-select__message {
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--v2-select-muted);
}

.v2-theme .v2-select__control {
  display: flex;
  align-items: stretch;
  width: 100%;

  background: var(--v2-select-bg);
  border: 1px solid var(--v2-select-border);
  border-radius: calc(var(--radius) - 2px);
  overflow: hidden;

  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.v2-theme .v2-select__control:focus-within {
  border-color: var(--v2-select-accent);
  box-shadow: 0 0 0 1px var(--v2-select-accent), 0 1px 2px hsl(var(--foreground) / 0.08);
}

.v2-theme .v2-select--disabled-true {
  opacity: 0.65;
  pointer-events: none;
}

.v2-theme .v2-select--readonly-true .v2-select__control {
  background: hsl(var(--muted) / 0.15);
}

.v2-theme .v2-select__addon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--v2-select-height);
  padding: 0 var(--v2-select-pad-x);
  font-size: 0.875rem;
  color: var(--v2-select-muted);
  background: hsl(var(--muted) / 0.35);
  white-space: nowrap;
}

.v2-theme .v2-select__addon--prefix { border-right: 1px solid hsl(var(--border)); }
.v2-theme .v2-select__addon--suffix { border-left: 1px solid hsl(var(--border)); }

.v2-theme .v2-select__btn {
  all: unset;
  box-sizing: border-box;
  height: var(--v2-select-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--v2-space-xsm);
  padding: 0 var(--v2-select-pad-x);

  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;

  color: hsl(var(--foreground));
  background: hsl(var(--background));
  transition: background-color 120ms ease, color 120ms ease;
}

.v2-theme .v2-select__btn:disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: default;
}

.v2-theme .v2-select__btn--left { border-right: 1px solid hsl(var(--border)); }
.v2-theme .v2-select__btn--right { border-left: 1px solid hsl(var(--border)); }

.v2-theme .v2-select__btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 0.95em;
}

.v2-theme .v2-select__btn--icon-right { flex-direction: row-reverse; }

/* button variants (subtle, input-group friendly) */
.v2-theme .v2-select__btn--variant-default { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.v2-theme .v2-select__btn--variant-default:hover { background: hsl(var(--primary) / 0.9); }
.v2-theme .v2-select__btn--variant-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.v2-theme .v2-select__btn--variant-secondary:hover { background: hsl(var(--secondary) / 0.85); }
.v2-theme .v2-select__btn--variant-destructive { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); }
.v2-theme .v2-select__btn--variant-destructive:hover { background: hsl(var(--destructive) / 0.9); }
.v2-theme .v2-select__btn--variant-success { background: hsl(var(--success)); color: hsl(var(--success-foreground)); }
.v2-theme .v2-select__btn--variant-success:hover { background: hsl(var(--success) / 0.9); }
.v2-theme .v2-select__btn--variant-warning { background: hsl(var(--warning)); color: hsl(var(--warning-foreground)); }
.v2-theme .v2-select__btn--variant-warning:hover { background: hsl(var(--warning) / 0.9); }
.v2-theme .v2-select__btn--variant-info { background: hsl(var(--info)); color: hsl(var(--info-foreground)); }
.v2-theme .v2-select__btn--variant-info:hover { background: hsl(var(--info) / 0.9); }
.v2-theme .v2-select__btn--variant-outline { background: hsl(var(--background)); color: hsl(var(--foreground)); }
.v2-theme .v2-select__btn--variant-outline:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.v2-theme .v2-select__btn--variant-ghost { background: transparent; }
.v2-theme .v2-select__btn--variant-ghost:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.v2-theme .v2-select__btn--variant-link { background: transparent; color: hsl(var(--primary)); text-decoration: underline; text-underline-offset: 4px; }
.v2-theme .v2-select__btn--variant-link:hover { color: hsl(var(--primary) / 0.85); }

.v2-theme .v2-select__trigger-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.v2-theme .v2-select__hidden { display: none; }

.v2-theme .v2-select__trigger {
  all: unset;
  box-sizing: border-box;
  width: 100%;
  height: var(--v2-select-height);
  padding: 0 var(--v2-select-pad-x);
  position: relative;

  display: flex;
  align-items: center;
  gap: var(--v2-space-xsm);

  font-size: 0.875rem;
  /* Keep the displayed value lighter than the label. */
  font-weight: 400;
  color: var(--v2-select-fg);
  cursor: pointer;
  user-select: none;
}

.v2-theme .v2-select__trigger:disabled {
  cursor: default;
}

.v2-theme .v2-select__value,
.v2-theme .v2-select__placeholder {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v2-theme .v2-select__value {
  font-weight: 400;
}

.v2-theme .v2-select__placeholder {
  color: var(--v2-select-muted);
}

.v2-theme .v2-select__icon-btn {
  position: absolute;
  top: 0;
  height: 100%;
  width: var(--v2-select-icon-hit);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--v2-select-muted);
  transition: background-color 120ms ease, color 120ms ease;
}

.v2-theme .v2-select__icon-btn--left { left: 0; }
.v2-theme .v2-select__icon-btn--right { right: var(--v2-select-caret-hit); }

.v2-theme .v2-select__icon-btn[data-disabled="true"] {
  pointer-events: none;
  opacity: 0.8;
}

.v2-theme .v2-select__icon-btn:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.v2-theme .v2-select__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 0.95em;
}

.v2-theme .v2-select__right-icons {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  width: calc(var(--v2-select-caret-hit) + var(--v2-select-icon-hit));
  pointer-events: none; /* allow clicks only on icon-btn span */
}

.v2-theme .v2-select__right-icons .v2-select__icon-btn {
  pointer-events: auto;
}

.v2-theme .v2-select--icon-right-false .v2-select__right-icons {
  width: var(--v2-select-caret-hit);
}

.v2-theme .v2-select--icon-right-false .v2-select__icon-btn--right {
  display: none !important;
}

.v2-theme .v2-select__caret {
  width: var(--v2-select-caret-hit);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--v2-select-muted);
  font-size: 0.9em;
}

.v2-theme .v2-select--icon-left-true .v2-select__trigger { padding-left: calc(var(--v2-select-pad-x) + var(--v2-select-icon-hit)); }
.v2-theme .v2-select--icon-right-true .v2-select__trigger { padding-right: calc(var(--v2-select-pad-x) + var(--v2-select-caret-hit) + var(--v2-select-icon-hit)); }
.v2-theme .v2-select--icon-right-false .v2-select__trigger { padding-right: calc(var(--v2-select-pad-x) + var(--v2-select-caret-hit)); }

/* sizes */
.v2-theme .v2-select--size-xsm { --v2-select-height: 1.75rem; --v2-select-pad-x: var(--v2-space-xsm); --v2-select-icon-hit: 1.75rem; --v2-select-caret-hit: 1.6rem; }
.v2-theme .v2-select--size-sm  { --v2-select-height: 2rem;    --v2-select-pad-x: var(--v2-space-xsm); --v2-select-icon-hit: 2rem; --v2-select-caret-hit: 1.8rem; }
.v2-theme .v2-select--size-default { --v2-select-height: 2.25rem; --v2-select-pad-x: var(--v2-space-sm); --v2-select-icon-hit: 2.25rem; --v2-select-caret-hit: 2rem; }
.v2-theme .v2-select--size-lg  { --v2-select-height: 2.5rem;  --v2-select-pad-x: var(--v2-space-md); --v2-select-icon-hit: 2.5rem; --v2-select-caret-hit: 2.1rem; }
.v2-theme .v2-select--size-xlg { --v2-select-height: 2.75rem; --v2-select-pad-x: var(--v2-space-md); --v2-select-icon-hit: 2.75rem; --v2-select-caret-hit: 2.2rem; }

/* variants (accent color) */
.v2-theme .v2-select--variant-default    { --v2-select-accent: hsl(var(--primary)); }
.v2-theme .v2-select--variant-secondary  { --v2-select-accent: hsl(var(--secondary-foreground)); }
.v2-theme .v2-select--variant-destructive{ --v2-select-accent: hsl(var(--destructive)); }
.v2-theme .v2-select--variant-success    { --v2-select-accent: hsl(var(--success)); }
.v2-theme .v2-select--variant-warning    { --v2-select-accent: hsl(var(--warning)); }
.v2-theme .v2-select--variant-info       { --v2-select-accent: hsl(var(--info)); }
.v2-theme .v2-select--variant-outline    { --v2-select-accent: hsl(var(--primary)); }
.v2-theme .v2-select--variant-ghost      { --v2-select-accent: hsl(var(--primary)); }

.v2-theme .v2-select--variant-outline .v2-select__control,
.v2-theme .v2-select--variant-ghost .v2-select__control {
  background: transparent;
}

.v2-theme .v2-select--variant-ghost .v2-select__control:hover {
  background: hsl(var(--muted) / 0.25);
}

/* statuses (border + message tone) */
.v2-theme .v2-select--status-default { --v2-select-border: hsl(var(--input)); }
.v2-theme .v2-select--status-error { --v2-select-border: hsl(var(--destructive)); }
.v2-theme .v2-select--status-error .v2-select__message { color: hsl(var(--destructive)); }
.v2-theme .v2-select--status-success { --v2-select-border: hsl(var(--success)); }
.v2-theme .v2-select--status-success .v2-select__message { color: hsl(var(--success)); }
.v2-theme .v2-select--status-warning { --v2-select-border: hsl(var(--warning)); }
.v2-theme .v2-select--status-warning .v2-select__message { color: hsl(var(--warning)); }
.v2-theme .v2-select--status-info { --v2-select-border: hsl(var(--info)); }
.v2-theme .v2-select--status-info .v2-select__message { color: hsl(var(--info)); }

/* dropdown */
.v2-theme .v2-select__dropdown {
  display: none;
  position: fixed; /* positioned by JS */
  z-index: var(--v2-layer-popover, 2147482000);
  background: hsl(var(--popover));
  color: hsl(var(--popover-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  box-shadow: 0 12px 28px hsl(0 0% 0% / 0.18);
  overflow: hidden;
}

.v2-theme .v2-select__dropdown[data-state="open"] {
  display: block;
}

.v2-theme .v2-select__dropdown[data-v2-measuring="true"] {
  transition: none !important;
}

.v2-theme .v2-select__search-wrap {
  padding: var(--v2-space-xsm);
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background));
}

.v2-theme .v2-select__search {
  all: unset;
  box-sizing: border-box;
  width: 100%;
  height: 2.25rem;
  padding: 0 var(--v2-space-sm);
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 4px);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 0.875rem;
}

.v2-theme .v2-select__search::placeholder {
  color: hsl(var(--muted-foreground));
}

.v2-theme .v2-select__search:focus-visible {
  /* Search input (dropdown) focus: remove ring/border emphasis (looks noisy in this component). */
  box-shadow: none;
  border-color: hsl(var(--border));
  background: hsl(var(--accent) / 0.20);
}

.v2-theme .v2-select__list {
  /* IMPORTANT:
   * Sticky group labels use `top: 0`. If the scroll container has top padding,
   * you can see scrolled option content in that gap above the sticky header.
   * Keep side/bottom padding, but remove top padding to avoid “bleed above label”.
   */
  padding: 0 0.25rem 0.25rem;
  overflow: auto;
}

.v2-theme .v2-select__group-label {
  padding: 0.5rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--background));
  position: sticky;
  top: 0;
  z-index: 1;
}

.v2-theme .v2-select__option {
  all: unset;
  box-sizing: border-box;
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: var(--v2-space-xsm);
  padding: 0.5rem 0.625rem;
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer;
  user-select: none;
  transition: background-color 120ms ease, color 120ms ease;
}

.v2-theme .v2-select__option:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.v2-theme .v2-select__option:disabled,
.v2-theme .v2-select__option[data-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}

.v2-theme .v2-select__option[data-selected="true"] {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.v2-theme .v2-select__option[data-active="true"] {
  box-shadow: inset 0 0 0 2px var(--v2-select-accent);
}

.v2-theme .v2-select__option-icon {
  flex: 0 0 auto;
  margin-top: 0.125rem;
  color: hsl(var(--muted-foreground));
}

.v2-theme .v2-select__option-main {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.v2-theme .v2-select__option-label {
  font-size: 0.875rem;
  /* Option text should not compete with the field label. */
  font-weight: 400;
  line-height: 1.2;
  color: inherit;
}

.v2-theme .v2-select__option-desc {
  font-size: 0.8125rem;
  line-height: 1.25;
  color: hsl(var(--muted-foreground));
}

.v2-theme .v2-select__empty {
  padding: var(--v2-space-md);
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
}

