/**
 * Environment Flags Selector Styles
 *
 * Uses the same CSS variables as the rest of the app.
 */

.efs-container {
  position: relative;
}

.efs-trigger {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--font-size-sm);
  transition: all 0.15s ease;
}

.efs-trigger:hover {
  background: var(--bg-secondary);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.efs-trigger.efs-has-mods {
  border-color: var(--ctp-peach);
  color: var(--ctp-peach);
}

.efs-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--ctp-peach);
  border-radius: 8px;
  color: var(--bg-primary);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.efs-chevron {
  transition: transform 0.15s ease;
}

.efs-chevron.rotated {
  transform: rotate(180deg);
}

.efs-dropdown {
  /* position: fixed is applied via inline styles */
  width: 380px;
  max-height: 500px;
  /* Solid background - never transparent regardless of theme */
  background-color: var(--vscode-sideBar-background, var(--bg-primary, #1e1e2e));
  border: 1px solid var(--border-default);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* Prevent any transparency from parent elements */
  isolation: isolate;
}

.efs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.efs-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.efs-clear-btn {
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}

.efs-clear-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--ctp-red);
  color: var(--ctp-red);
}

.efs-filter {
  margin: 8px 12px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-family: inherit;
}

.efs-filter:focus {
  outline: none;
  border-color: var(--ctp-blue);
}

.efs-filter::placeholder {
  color: var(--text-muted);
}

.efs-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.efs-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-default);
  border-top-color: var(--ctp-blue);
  border-radius: 50%;
  animation: efs-spin 0.8s linear infinite;
}

@keyframes efs-spin {
  to { transform: rotate(360deg); }
}

.efs-error {
  padding: 12px;
  color: var(--ctp-red);
  font-size: var(--font-size-sm);
}

.efs-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.efs-flags-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.efs-flag-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.1s ease;
}

.efs-flag-row:hover {
  background: var(--bg-secondary);
}

.efs-flag-row.modified {
  background: rgba(250, 179, 135, 0.1);
}

.efs-flag-row:last-child {
  border-bottom: none;
}

.efs-flag-info {
  flex: 1;
  min-width: 0;
}

.efs-flag-name {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-all;
}

.efs-flag-desc {
  margin-top: 2px;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.efs-flag-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.efs-flag-type {
  padding: 1px 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  font-size: var(--font-size-xs);
  color: var(--ctp-mauve);
}

.efs-flag-default {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.efs-flag-input {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.efs-bool-input {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.efs-bool-input input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--ctp-green);
}

.efs-bool-label {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.efs-number-wrapper {
  display: flex;
  align-items: center;
  gap: 0;
}

.efs-number-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: var(--font-size-lg);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.1s ease;
}

.efs-number-btn:first-child {
  border-radius: 4px 0 0 4px;
  border-right: none;
}

.efs-number-btn:last-child {
  border-radius: 0 4px 4px 0;
  border-left: none;
}

.efs-number-btn:hover {
  background: var(--ctp-surface0);
  color: var(--ctp-blue);
}

.efs-number-btn:active {
  background: var(--ctp-surface1);
}

.efs-number-input {
  width: 50px;
  padding: 4px 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  text-align: center;
  -moz-appearance: textfield;
}

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

.efs-text-input {
  width: 80px;
  padding: 4px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
}

.efs-number-input:focus,
.efs-text-input:focus {
  outline: none;
  border-color: var(--ctp-blue);
}

.efs-number-input::placeholder,
.efs-text-input::placeholder {
  color: var(--text-muted);
}
