/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0d1117;
  --bg-card: #161b22;
  --bg-hover: #1c2333;
  --bg-input: #0d1117;
  --border: #30363d;
  --border-focus: #58a6ff;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #58a6ff;
  --accent-glow: rgba(88, 166, 255, 0.15);
  --green: #3fb950;
  --orange: #d29922;
  --red: #f85149;
  --radius: 8px;
  --font: 'SF Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono', Consolas, monospace;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== App Layout ===== */
.app {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px 320px;
}

header {
  text-align: center;
  padding: 32px 0 24px;
}

header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.accent {
  color: var(--accent);
}

.subtitle {
  color: var(--text-dim);
  font-size: 14px;
  margin-top: 4px;
}

/* ===== Sections ===== */
.section {
  margin-bottom: 28px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ===== Info Button & Bubble ===== */
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.info-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.info-btn.active {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.info-btn-inline {
  vertical-align: middle;
  margin-left: 4px;
}

.info-bubble {
  display: none;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: #1a2332;
  border: 1px solid var(--accent);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text);
  animation: fadeIn 0.15s ease;
}

.info-bubble.visible {
  display: block;
}

.info-bubble code {
  font-family: var(--font);
  color: var(--green);
}

.info-example {
  display: block;
  margin-top: 8px;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 4px;
  font-size: 12px;
}

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

/* ===== Tooltip (hover on cards/chips) ===== */
.tooltip {
  display: none;
  position: fixed;
  max-width: 360px;
  padding: 12px 14px;
  background: #1a2332;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  z-index: 200;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.1s ease;
}

.tooltip.visible {
  display: block;
}

/* ===== Radio Cards ===== */
.option-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.radio-card {
  display: block;
  cursor: pointer;
}

.radio-card input {
  display: none;
}

.card-content {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: all 0.15s ease;
}

.card-content:hover {
  background: var(--bg-hover);
  border-color: var(--text-dim);
}

.radio-card input:checked + .card-content {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 0 1px var(--accent);
}

.card-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.card-desc {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ===== Toggle Switches ===== */
.toggles-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.toggle-row:hover {
  background: var(--bg-hover);
}

.toggle-row input {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 40px;
  min-width: 40px;
  height: 22px;
  background: var(--border);
  border-radius: 11px;
  transition: background 0.2s;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: all 0.2s;
}

.toggle-row input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-row input:checked + .toggle-slider::after {
  left: 21px;
  background: #fff;
}

.toggle-info {
  display: flex;
  flex-direction: column;
}

.toggle-label {
  font-size: 13px;
  font-weight: 600;
}

.toggle-desc {
  font-size: 11px;
  color: var(--text-dim);
}

/* ===== Inputs ===== */
.input-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-row label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
}

input[type="text"],
textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

textarea {
  resize: vertical;
  min-height: 60px;
}

.sub-field {
  margin-top: 10px;
}

.hidden {
  display: none !important;
}

/* ===== Dir rows ===== */
.dir-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.dir-row input {
  flex: 1;
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  transition: all 0.15s;
}

.btn-icon:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.btn-small {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s;
}

.btn-small:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
}

/* ===== Agent Selector ===== */
.agent-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.agent-chip {
  cursor: pointer;
}

.agent-chip input {
  display: none;
}

.agent-chip span {
  display: inline-block;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-dim);
  transition: all 0.15s;
}

.agent-chip:hover span {
  border-color: var(--text-dim);
}

.agent-chip input:checked + span {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== Tool Chips ===== */
.tools-info {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.tools-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-chip {
  cursor: pointer;
}

.tool-chip input {
  display: none;
}

.tool-chip span {
  display: inline-block;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-dim);
  transition: all 0.15s;
}

.tool-chip:hover span {
  border-color: var(--text-dim);
}

.tool-chip input:checked + span {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== Command Bar (sticky bottom) ===== */
.command-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 16px;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(22, 27, 34, 0.95);
}

.command-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 800px;
  margin: 0 auto 10px;
}

.command-header h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
}

.command-actions {
  display: flex;
  gap: 8px;
}

.btn-copy, .btn-reset {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid;
}

.btn-copy {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-copy:hover {
  background: #79c0ff;
}

.btn-copy.copied {
  background: var(--green);
  border-color: var(--green);
}

.btn-reset {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
}

.btn-reset:hover {
  color: var(--red);
  border-color: var(--red);
}

.command-output {
  max-width: 800px;
  margin: 0 auto;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.command-output code {
  font-size: 13px;
  color: var(--green);
  font-family: var(--font);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .app {
    padding: 16px 12px 340px;
  }

  header h1 {
    font-size: 22px;
  }

  .option-group {
    grid-template-columns: repeat(2, 1fr);
  }

  .command-bar {
    padding: 12px;
  }
}
