/* ═══════════════════════════════════════
   THEME VARIABLES
═══════════════════════════════════════ */
:root {
  --bg-color:      #e6fffb;
  --bg-pattern:    linear-gradient(135deg, rgba(34,85,42,0.34) 0%, rgba(34,211,238,0.24) 100%),
                   radial-gradient(ellipse at 60% 0%, rgba(34,85,42,0.28) 0%, transparent 65%),
                   radial-gradient(ellipse at 10% 90%, rgba(34,211,238,0.18) 0%, transparent 55%);
  --panel-bg:      rgba(255,255,255,0.55);
  --input-bg:      #fff;
  --accent-color:  #f1c40f;
  --text-color:    #2c3e50;
  --tab-border:    #27ae60;
  --tab-inactive:  rgba(44,62,80,0.07);
  --divider:       rgba(44,62,80,0.12);
}

body.theme-burnin {
  --bg-color:      #111111;
  --bg-pattern:    radial-gradient(ellipse at 50% 110%, rgba(230,126,34,0.35) 0%, transparent 60%),
                   radial-gradient(ellipse at 90% 10%, rgba(46,204,113,0.08) 0%, transparent 50%);
  --panel-bg:      rgba(30,30,30,0.80);
  --input-bg:      #2a2a2a;
  --accent-color:  #2ecc71;
  --text-color:    #ecf0f1;
  --tab-border:    #e67e22;
  --tab-inactive:  rgba(255,255,255,0.05);
  --divider:       rgba(255,255,255,0.08);
}

body.theme-babylon {
  --bg-color:      #1a2535;
  --bg-pattern:    radial-gradient(ellipse at 80% 20%, rgba(192,57,43,0.25) 0%, transparent 55%),
                   radial-gradient(ellipse at 20% 80%, rgba(52,73,94,0.5)   0%, transparent 60%);
  --panel-bg:      rgba(20,30,45,0.75);
  --input-bg:      #243040;
  --accent-color:  #c0392b;
  --text-color:    #ecf0f1;
  --tab-border:    #c0392b;
  --tab-inactive:  rgba(255,255,255,0.04);
  --divider:       rgba(255,255,255,0.08);
}

/* ═══════════════════════════════════════
   BASE
═══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background-color: var(--bg-color);
  background-image: var(--bg-pattern);
  background-attachment: fixed;
  color: var(--text-color);
  font-family: system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  transition: background-color 0.5s ease, color 0.4s ease;
}

/* ═══════════════════════════════════════
   HEADER
═══════════════════════════════════════ */
.color-bar {
  height: 8px;
  background: linear-gradient(to right,
    #e74c3c 33.33%,
    #f1c40f 33.33%, #f1c40f 66.66%,
    #27ae60 66.66%
  );
}

.main-header {
  text-align: center;
  padding: 36px 20px 30px;
}

.main-header h1 {
  font-size: 3rem;
  letter-spacing: 5px;
  text-transform: uppercase;
  background: linear-gradient(to right, #e74c3c, #f1c40f, #27ae60);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-style: italic;
  font-weight: 300;
  margin-top: 8px;
  opacity: 0.7;
  font-size: 0.95rem;
}

/* ═══════════════════════════════════════
   LAYOUT
═══════════════════════════════════════ */
.main-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ═══════════════════════════════════════
   FOLDER TABS
═══════════════════════════════════════ */
.tab-bar {
  display: flex;
   align-items: stretch;
  gap: 4px;
  margin-top: 20px;
   width: 100%;
}

.tab-btn {
  position: relative;
   flex: 1 1 30%;
   min-height: 52px;
   display: flex;
   align-items: center;
   justify-content: center;
   padding: 9px 16px;
  border: 2px solid var(--tab-border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: var(--tab-inactive);
  color: var(--text-color);
  font-size: 0.85rem;
  font-weight: 600;
   text-align: center;
  cursor: pointer;
  opacity: 0.55;
  margin-bottom: -2px;
  transition: opacity 0.2s, transform 0.15s, background 0.4s, border-color 0.4s;
  outline: none;
}

.tab-btn:hover {
  opacity: 0.8;
  transform: translateY(-2px);
}

.tab-btn.active {
  background: var(--panel-bg);
  opacity: 1;
  z-index: 2;
  transform: translateY(0);
}

/* Accent stripe on active tab */
.tab-btn.active::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--tab-border);
  border-radius: 6px 6px 0 0;
}

/* Mask bottom edge so active tab blends into panel */
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -3px; left: 0; right: 0;
  height: 5px;
  background: var(--panel-bg);
  z-index: 3;
}

/* ═══════════════════════════════════════
   CONTROLS PANEL
═══════════════════════════════════════ */
.controls-panel {
  background: var(--panel-bg);
  border: 2px solid var(--tab-border);
  border-radius: 0 8px 8px 8px;
  padding: 20px 24px;
  margin-bottom: 18px;
  backdrop-filter: blur(6px);
  transition: background 0.4s, border-color 0.4s;
  position: relative;
  z-index: 1;
}

/* ── Mode sections ── */
.paragraph-config-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.paragraph-section {
  padding: 16px;
  border: 1px solid var(--divider);
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  transition: background 0.4s, border-color 0.4s;
}

.paragraph-title-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  margin-bottom: 14px;
}

.para-toggle {
  width: 17px;
  height: 17px;
  accent-color: var(--tab-border);
  cursor: pointer;
  flex-shrink: 0;
}

.paragraph-title {
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent-color);
  transition: color 0.4s;
}

/* ── Fields within a section ── */
.paragraph-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.paragraph-fields.is-disabled {
  opacity: 0.35;
  pointer-events: none;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 360px;
}

.field-row label,
.field-row > span {
  font-size: 0.88rem;
  opacity: 0.9;
}

.hint {
  font-size: 0.75rem;
  opacity: 0.55;
  font-style: italic;
  margin-left: 4px;
}

.field-row input[type="number"] {
  width: 54px;
  padding: 4px 6px;
  text-align: center;
  background: var(--input-bg);
  color: var(--text-color);
  border: 1px solid var(--tab-border);
  border-radius: 4px;
  font-size: 0.9rem;
  transition: background 0.4s, border-color 0.4s, color 0.4s;
}

.field-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--tab-border);
  cursor: pointer;
}

.field-row select {
  padding: 4px 8px;
  background: var(--input-bg);
  color: var(--text-color);
  border: 1px solid var(--tab-border);
  border-radius: 4px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.4s, border-color 0.4s, color 0.4s;
}

.header-level-row.is-disabled {
  opacity: 0.45;
}

.header-level-row select:disabled {
  cursor: not-allowed;
}

.generate-row {
  margin-top: 18px;
}

@media (max-width: 640px) {
  .paragraph-config-list {
    grid-template-columns: 1fr;
  }

  .field-row {
    max-width: none;
  }
}

/* ── Primary button ── */
.primary-btn {
  background-color: var(--tab-border);
  color: #fff;
  border: none;
  padding: 11px 28px;
  border-radius: 5px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.3s, transform 0.1s;
}

.primary-btn:hover  { filter: brightness(1.1); }
.primary-btn:active { transform: scale(0.97); }

/* ═══════════════════════════════════════
   OUTPUT TERMINAL BOX
═══════════════════════════════════════ */
.output-container {
  background: #1e1e1e;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  border: 1px solid #333;
}

.output-header {
  background: #2d2d2d;
  padding: 10px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dot { height: 12px; width: 12px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.red  { background: #ff5f56; }
.gold { background: #ffbd2e; }
.green{ background: #27c93f; }

.output-area {
  padding: 20px;
  color: #d4d4d4;
  font-family: 'Fira Code', 'Courier New', monospace;
  line-height: 1.7;
  max-height: 420px;
  overflow-y: auto;
  min-height: 80px;
}

.output-area p {
  margin-bottom: 20px;
}

.output-area p:last-child {
  margin-bottom: 0;
}

.output-spacer {
  height: 16px;
}

.output-area .placeholder { opacity: 0.4; font-style: italic; }

.output-area h1, .output-area h2, .output-area h3,
.output-area h4, .output-area h5, .output-area h6 {
  color: var(--accent-color, #f1c40f);
  margin: 0 0 14px;
}

.copy-btn {
  background: #444;
  color: #fff;
  border: none;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.2s;
}
.copy-btn:hover   { background: #666; }
.copy-btn.success { background: #27ae60; }