/* Mode selection for the RLinf Sphinx AI assistant. */

.sphinx-mode-badge {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  height: var(--assistant-control-height);
  padding: 0 10px;
  background: var(--sphinx-background);
  border: 1px solid var(--sphinx-border);
  border-radius: var(--assistant-control-radius);
  color: var(--sphinx-text-primary);
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
  font-size: var(--text-xs);
  font-weight: 650;
  line-height: 1;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
  user-select: none;
}

.sphinx-mode-badge:hover,
.sphinx-mode-badge-open {
  background: var(--sphinx-primary-soft);
  border-color: var(--sphinx-primary);
  color: var(--sphinx-primary);
}

.sphinx-mode-badge:focus-visible,
.sphinx-mode-option:focus-visible {
  outline: 2px solid var(--sphinx-primary);
  outline-offset: 2px;
}

.sphinx-mode-badge-icon,
.sphinx-mode-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: currentColor;
}

.sphinx-mode-badge-icon {
  width: 14px;
  height: 14px;
}

.sphinx-mode-icon {
  width: 20px;
  height: 20px;
}

.sphinx-mode-icon-svg,
.sphinx-mode-chevron {
  width: 100%;
  height: 100%;
}

.sphinx-mode-badge-text {
  white-space: nowrap;
}

.sphinx-mode-chevron {
  width: 14px;
  height: 14px;
  opacity: 0.7;
  transform: rotate(90deg);
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.sphinx-mode-badge-open .sphinx-mode-chevron {
  opacity: 1;
  transform: rotate(270deg);
}

.sphinx-mode-panel {
  position: absolute;
  bottom: calc(100% + var(--space-sm));
  left: 0;
  z-index: 1003;
  width: 320px;
  min-width: 280px;
  max-width: min(400px, calc(100vw - 40px));
  padding: var(--space-xs);
  background: var(--sphinx-background);
  border: 1px solid var(--sphinx-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--sphinx-shadow-subtle);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.sphinx-mode-panel-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.sphinx-mode-panel-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sphinx-mode-option {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: var(--space-md);
  padding: var(--space-md);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--sphinx-text-primary);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.sphinx-mode-option:hover {
  background: var(--sphinx-surface);
}

.sphinx-mode-option-active {
  background: var(--sphinx-primary-soft);
  border-color: color-mix(in srgb, var(--sphinx-primary) 28%, var(--sphinx-border));
}

.sphinx-mode-option-content {
  display: flex;
  align-items: flex-start;
  min-width: 0;
  flex: 1;
  gap: var(--space-md);
}

.sphinx-mode-info {
  min-width: 0;
  flex: 1;
}

.sphinx-mode-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: 2px;
}

.sphinx-mode-label {
  color: var(--sphinx-text-primary);
  font-size: var(--text-sm);
  font-weight: 650;
  line-height: var(--leading-tight);
}

.sphinx-mode-time {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  background: var(--sphinx-surface);
  border: 1px solid var(--sphinx-border);
  border-radius: var(--radius-sm);
  color: var(--sphinx-text-secondary);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1;
}

.sphinx-mode-description {
  margin: 0;
  color: var(--sphinx-text-secondary);
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
}

.sphinx-mode-radio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: 1px solid var(--sphinx-border);
  border-radius: 50%;
  flex-shrink: 0;
}

.sphinx-mode-radio-selected {
  border-color: var(--sphinx-primary);
}

.sphinx-mode-radio-dot {
  width: 8px;
  height: 8px;
  background: var(--sphinx-primary);
  border-radius: 50%;
}

@media (max-width: 768px) {
  .sphinx-mode-badge {
    height: var(--assistant-control-height);
  }

  .sphinx-mode-panel {
    width: 280px;
    min-width: 260px;
  }

  .sphinx-mode-option {
    padding: var(--space-sm);
  }
}

@media (max-width: 520px) {
  .sphinx-mode-panel {
    left: 0;
    width: min(280px, calc(100vw - 32px));
    min-width: min(240px, calc(100vw - 32px));
  }
}
