/* config-tools.css
 * Styles for interactive tools embedded in documentation pages.
 * Load via front matter: extra_css: [config-tools]
 *
 * Sections:
 *   1. Config Validator  (.cv-*)
 *   2. Config Generator  (.cg-*)
 *   3. Guided Quick Start (.gqs-*)
 */

/* ============================================================
   1. Config Validator (docs/6-5-config-validator.md)
   ============================================================ */

.cv-container {
  margin: 1.5rem 0;
}

.cv-editor {
  display: flex;
  border: 1px solid #d0d5db;
  border-radius: 4px;
  background: var(--bg-light, #f8f9fa);
  overflow: hidden;
}

.cv-editor:focus-within {
  border-color: var(--terracotta, #883C36);
  box-shadow: 0 0 0 3px rgba(136, 60, 54, 0.1);
}

.cv-lines {
  padding: 16px 10px 16px 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-light, #AEB3BB);
  text-align: right;
  user-select: none;
  border-right: 1px solid #e9ecef;
  overflow: hidden;
  min-width: 44px;
  background: var(--bg-sidebar, #fafafa);
  white-space: pre;
}

.cv-textarea {
  flex: 1;
  min-height: 320px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  padding: 16px;
  border: none;
  background: transparent;
  resize: vertical;
  tab-size: 2;
  color: var(--text-dark, #333333);
  outline: none;
}

.cv-actions {
  margin-top: 12px;
}

.cv-button {
  display: inline-block;
  padding: 10px 28px;
  background: var(--terracotta, #883C36);
  color: white;
  border: none;
  border-radius: 50px;
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cv-button:hover {
  background: var(--dark-grey, #333333);
}

.cv-results {
  margin-top: 20px;
}

.cv-summary {
  margin-bottom: 12px;
  color: var(--text-medium, #6C7A89);
  font-size: 14px;
}

.cv-issue {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.5;
}

.cv-issue--error   { background: #fef2f2; border-left: 3px solid #dc2626; }
.cv-issue--warning { background: #fffbeb; border-left: 3px solid #d97706; }
.cv-issue--info    { background: #eff6ff; border-left: 3px solid #2563eb; }
.cv-issue--success { background: #f0fdf4; border-left: 3px solid #16a34a; }

.cv-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

.cv-badge--error   { background: #dc2626; color: white; }
.cv-badge--warning { background: #d97706; color: white; }
.cv-badge--info    { background: #2563eb; color: white; }
.cv-badge--success { background: #16a34a; color: white; }

.cv-line {
  color: var(--text-medium, #6C7A89);
  font-size: 12px;
  white-space: nowrap;
}

.cv-detail {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-medium, #6C7A89);
  font-family: 'IBM Plex Mono', monospace;
}

/* ============================================================
   2. Config Generator (docs/6-6-config-generator.md)
   ============================================================ */

.cg-container {
  max-width: 680px;
  margin: 0 auto;
}

.cg-section {
  margin-bottom: 2rem;
}

.cg-section h3 {
  color: var(--terracotta, #883C36);
  border-bottom: 1px solid #e0e0e0;
}

.cg-section-desc {
  color: var(--text-medium, #555);
  font-size: 0.92rem;
  text-transform: none !important;
}

.cg-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.cg-label {
  width: 140px;
  flex-shrink: 0;
  padding-top: 6px;
  font-size: 0.93rem;
  color: var(--text-dark, #333333);
  text-transform: none !important;
}

.cg-optional {
  font-size: 0.78rem;
  color: var(--text-light, #888);
  text-transform: none !important;
}

.cg-field {
  flex: 1;
}

.cg-hint {
  font-size: 0.8rem;
  color: var(--text-light, #888);
  text-transform: none !important;
}

.cg-input,
.cg-textarea-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #d0d5db;
  border-radius: 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.80rem;
  box-sizing: border-box;
}

.cg-select {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #d0d5db;
  border-radius: 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.80rem;
  box-sizing: border-box;
}

.cg-input:focus,
.cg-select:focus,
.cg-textarea-input:focus {
  border-color: var(--terracotta, #883C36);
  box-shadow: 0 0 0 3px rgba(136, 60, 54, 0.1);
  outline: none;
}

.cg-input--number {
  width: 70px;
  text-align: center;
}

.cg-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.cg-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.cg-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.cg-toggle .cg-track {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.cg-toggle .cg-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 0.15s;
}

.cg-toggle input:checked + .cg-track {
  background: var(--terracotta, #883C36);
}

.cg-toggle input:checked + .cg-track::after {
  transform: translateX(16px);
}

.cg-toggle-label {
  font-size: 0.93rem;
  cursor: pointer;
  text-transform: none !important;
}

.cg-toggle-hint {
  font-size: 0.8rem;
  text-transform: none !important;
}

.cg-toggle-info {
  flex: 1;
}

.cg-optional-fields {
  display: none;
  padding-left: 1rem;
  border-left: 2px solid #e0e0e0;
}

.cg-optional-fields.cg-visible {
  display: block;
}

.cg-actions {
  display: flex;
  gap: 1rem;
  margin: 1.5rem 0;
  align-items: center;
}

.cg-button {
  display: inline-block;
  padding: 10px 28px;
  background: var(--terracotta, #883C36);
  color: white;
  border: none;
  border-radius: 50px;
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cg-button:hover {
  background: var(--dark-grey, #333333);
}

.cg-copied {
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.3s;
  text-transform: none !important;
}

.cg-copied.cg-show {
  opacity: 1;
}

.cg-error-msg,
.cg-warn-msg {
  font-size: 0.78rem;
  margin-top: 3px;
  display: none;
  text-transform: none !important;
}

.cg-error-msg.cg-visible { display: block; }
.cg-warn-msg.cg-visible  { display: block; }
.cg-error-msg { color: #c0392b; }
.cg-warn-msg  { color: #b7621a; }

.cg-input--error,
.cg-textarea-input--error {
  border-color: #c0392b !important;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1) !important;
}

.cg-input--warn,
.cg-textarea-input--warn {
  border-color: #e67e22 !important;
  box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.08) !important;
}

.cg-output-wrapper {
  display: none;
}

.cg-output-wrapper.cg-visible {
  display: block;
}

.cg-output-heading {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Mode toggle (Create new / Edit existing) --- */

.cg-mode-toggle {
  display: inline-flex;
  border: 2px solid var(--terracotta, #883C36);
  border-radius: 50px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.cg-mode-btn {
  padding: 8px 22px;
  background: transparent;
  color: var(--terracotta, #883C36);
  border: none;
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cg-mode-btn:first-child {
  border-right: 2px solid var(--terracotta, #883C36);
}

.cg-mode-btn.cg-active {
  background: var(--terracotta, #883C36);
  color: white;
}

.cg-mode-btn:not(.cg-active):hover {
  background: rgba(136, 60, 54, 0.08);
}

/* --- Paste area (Edit existing mode) --- */

.cg-paste-area {
  display: none;
  margin-bottom: 1.5rem;
}

.cg-paste-area.cg-visible {
  display: block;
}

.cg-paste-area .cv-textarea {
  min-height: 200px;
}

.cg-load-actions {
  display: flex;
  gap: 1rem;
  margin-top: 10px;
  align-items: center;
}

.cg-load-feedback {
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.3s;
  text-transform: none !important;
}

.cg-load-feedback.cg-show {
  opacity: 1;
}

.cg-load-feedback.cg-load-success {
  color: #16a34a;
}

.cg-load-feedback.cg-load-error {
  color: #c0392b;
}

/* Output area — fixed-height overrides for the generator */
.cg-output-wrapper .cv-lines {
  height: 400px;
  padding: 16px 10px 16px 12px;
  box-sizing: border-box;
}

.cg-output-wrapper .cv-textarea {
  height: 400px;
  resize: none;
  white-space: pre;
  overflow: auto;
  box-sizing: border-box;
}

/* ============================================================
   3. Guided Quick Start (docs/2-1b-guided-quickstart.md)
   ============================================================ */

/* --- Field group container --- */
.gqs-field-group {
  background: #C6D0F8;
  border-radius: 25px;
  padding: 1.5rem 2rem;
  margin: 1.5rem 0;
  border-left: 4px solid #8B9AD8;
}

.gqs-field-group .cg-row:last-child {
  margin-bottom: 0;
}

.gqs-field-group .cg-label {
  color: #333333;
}

.gqs-field-group .cg-input,
.gqs-field-group .cg-select {
  background: #fff;
  border: 1px solid rgba(51, 51, 51, 0.12);
  border-radius: 8px;
}

.gqs-field-group .cg-input:focus,
.gqs-field-group .cg-select:focus {
  border-color: #883C36;
  box-shadow: 0 0 0 3px rgba(136, 60, 54, 0.15);
}

.gqs-field-group .cg-hint,
.gqs-field-group .cg-optional,
.gqs-field-group .cg-warn-msg {
  color: #333333;
}

/* --- Panel title --- */
.gqs-panel-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #333333;
  margin-bottom: 1.25rem;
  letter-spacing: 0.02em;
}

/* --- URL preview --- */
.gqs-url-preview {
  padding: 0.5rem 0 0;
  margin-top: 0.5rem;
}

.gqs-url-preview-separator {
  border-top: 1px solid rgba(51, 51, 51, 0.1);
  margin: 1rem 0 0.75rem;
}

.gqs-url-preview-label {
  font-size: 0.78rem;
  color: #555;
  margin-bottom: 0.2rem;
  text-transform: none !important;
}

.gqs-url-preview-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9rem;
  color: #555;
  word-break: break-all;
}

/* User-entered text stands out in the URL preview */
.gqs-user-text {
  color: #883C36;
  font-weight: 600;
}

.gqs-placeholder {
  color: #888;
  font-style: italic;
}

/* --- Actions row --- */
.gqs-actions {
  display: flex;
  gap: 0.75rem;
  margin: 1.25rem 0;
  align-items: center;
  flex-wrap: wrap;
}

/* --- Secondary (outlined) button variant --- */
.gqs-button--secondary {
  display: inline-block;
  padding: 8px 24px;
  background: transparent;
  color: #883C36;
  border: 2px solid #883C36;
  border-radius: 50px;
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.gqs-button--secondary:hover {
  background: #883C36;
  color: white;
}

/* --- Copied feedback --- */
.gqs-copied {
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.3s;
  color: #16a34a;
  text-transform: none !important;
}

.gqs-copied.gqs-show {
  opacity: 1;
}

/* --- Output area --- */
.gqs-output-wrapper {
  display: none;
  margin-top: 1rem;
}

.gqs-output-wrapper.gqs-visible {
  display: block;
}

.gqs-output-heading {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

/* Output editor — reuses cv-editor dimensions */
.gqs-output-wrapper .cv-lines {
  height: 400px;
  padding: 16px 10px 16px 12px;
  box-sizing: border-box;
}

.gqs-output-wrapper .cv-textarea {
  height: 400px;
  resize: none;
  white-space: pre;
  overflow: auto;
  box-sizing: border-box;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .gqs-field-group {
    padding: 1rem;
    border-radius: 16px;
  }

  .gqs-field-group .cg-row {
    flex-direction: column;
    gap: 0.25rem;
  }

  .gqs-field-group .cg-label {
    width: auto;
    padding-top: 0;
  }

  .gqs-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .gqs-actions .cg-button,
  .gqs-actions .gqs-button--secondary {
    text-align: center;
  }
}
