/* Reusable components */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

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

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

.btn-sm {
  padding: 4px 8px;
  font-size: 11px;
}

/* Inputs */
.input-group {
  margin-bottom: 12px;
}

.input-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

textarea.input, input.input, select.input {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

textarea.input {
  min-height: 120px;
  resize: vertical;
}

textarea.input:focus, input.input:focus, select.input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Panels */
.panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}

.panel-header {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
}

.panel-body {
  padding: 12px;
}

/* Split view */
.split-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.split-row .split-half {
  flex: 1;
  min-width: 280px;
}

/* Code / pre */
.pre-block {
  margin: 0;
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Messages */
.msg-success { color: var(--success); }
.msg-error { color: var(--error); }
.msg-warning { color: var(--warning); }

/* AI panel */
.ai-panel {
  margin-top: 16px;
}

.ai-panel .result-box {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.5;
  max-height: 400px;
  overflow-y: auto;
}

.ai-panel .loading {
  color: var(--text-muted);
  font-style: italic;
}

/* AI tools temporarily unavailable (full workspace) */
.ai-tools-unavailable {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  padding: 24px;
}

.ai-tools-unavailable-inner {
  max-width: 420px;
  padding: 20px 24px;
  text-align: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.ai-tools-unavailable-title {
  margin: 0 0 10px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.ai-tools-unavailable-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
}

/* Tool page title */
.tool-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--text);
}

.tool-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 16px 0;
}

/* IO area with Copy / Clear bar */
.io-area {
  margin-bottom: 12px;
}

.io-area .io-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.io-area .io-label {
  font-size: 12px;
  color: var(--text-muted);
}

.io-area .io-actions {
  display: flex;
  gap: 6px;
}

.io-area .io-actions .btn {
  padding: 2px 8px;
  font-size: 11px;
}

.io-area .io-content {
  width: 100%;
  min-height: 80px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
}

.io-area .io-content.pre {
  white-space: pre-wrap;
  word-break: break-all;
  resize: none;
  min-height: 100px;
}
