/* ── Header ── */
.header {
  height: 56px;
  background: var(--bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  flex-shrink: 0;
}
.header h1 { font-size: 18px; font-weight: 700; color: var(--t1); }
.close-btn {
  width: 36px; height: 36px; border-radius: 18px;
  background: var(--elev); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--t2); transition: background .2s;
}
.close-btn:hover { background: #2d3a56; }

/* ── Content Wrapper ── */
.content {
  background: var(--bg2);
  flex: 1;
  padding: 20px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-label {
  font-size: 10px; font-weight: 700;
  color: var(--t3); letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: -8px;
}

/* ── Language Row ── */
.lang-row { display: flex; gap: 8px; flex-wrap: wrap; }
.lang-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 12px; border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--elev);
  cursor: pointer; transition: all .2s;
  font-size: 12px; color: var(--t2);
  user-select: none;
}
.lang-pill .flag { font-size: 13px; }
.lang-pill.active {
  background: rgba(168, 85, 247, 0.16);
  border-color: rgba(168, 85, 247, 0.5);
  color: var(--purple);
  font-weight: 600;
}

/* ── Level Row ── */
.level-row { display: flex; gap: 8px; }
.level-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--elev);
  cursor: pointer; transition: all .2s;
  font-size: 12px; color: var(--t2);
  user-select: none;
}
.level-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.level-chip.active-beginner     { background: rgba(34,197,94,.15);  border-color: rgba(34,197,94,.45);  color: #22C55E; font-weight: 600; }
.level-chip.active-intermediate { background: rgba(250,204,21,.15); border-color: rgba(250,204,21,.45); color: #FACC15; font-weight: 600; }
.level-chip.active-advanced     { background: rgba(239,68,68,.15);  border-color: rgba(239,68,68,.45);  color: #EF4444; font-weight: 600; }

/* ── Style Grid ── */
.style-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.style-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 14px 12px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--border);
  cursor: pointer; transition: all .2s; user-select: none;
}
.style-card .icon-wrap {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--elev);
  display: flex; align-items: center; justify-content: center;
}
.style-card .icon-wrap i { width: 18px; height: 18px; color: var(--t2); }
.style-card span { font-size: 12px; color: var(--t2); }
.style-card.active { border-color: rgba(168, 85, 247, .4); }
.style-card.active .icon-wrap { background: rgba(168, 85, 247, .2); }
.style-card.active .icon-wrap i { color: var(--purple); }
.style-card.active span { color: var(--purple); font-weight: 600; }
/* Per-style accent colours */
.style-card[data-style="Story"].active                          { border-color: rgba(6,182,212,.4); }
.style-card[data-style="Story"].active .icon-wrap               { background: rgba(6,182,212,.2); }
.style-card[data-style="Story"].active .icon-wrap i,
.style-card[data-style="Story"].active span                     { color: var(--cyan); }
.style-card[data-style="News"].active                           { border-color: rgba(236,72,153,.4); }
.style-card[data-style="News"].active .icon-wrap                { background: rgba(236,72,153,.2); }
.style-card[data-style="News"].active .icon-wrap i,
.style-card[data-style="News"].active span                      { color: var(--pink); }
.style-card[data-style="Postcard"].active                       { border-color: rgba(34,197,94,.4); }
.style-card[data-style="Postcard"].active .icon-wrap            { background: rgba(34,197,94,.2); }
.style-card[data-style="Postcard"].active .icon-wrap i,
.style-card[data-style="Postcard"].active span                  { color: var(--green); }
.style-card[data-style="Podcast"].active                        { border-color: rgba(250,204,21,.4); }
.style-card[data-style="Podcast"].active .icon-wrap             { background: rgba(250,204,21,.2); }
.style-card[data-style="Podcast"].active .icon-wrap i,
.style-card[data-style="Podcast"].active span                   { color: var(--yellow); }

/* ── Prompt Input ── */
.prompt-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px;
  display: flex; flex-direction: column; gap: 0;
  transition: border-color .2s;
}
.prompt-box:focus-within { border-color: rgba(168, 85, 247, .5); }
.prompt-box textarea {
  background: transparent; border: none; outline: none;
  color: var(--t1); font-family: 'Inter', sans-serif;
  font-size: 13px; line-height: 1.6; resize: none;
  width: 100%; min-height: 72px;
}
.prompt-box textarea::placeholder { color: var(--t2); }
.prompt-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 10px;
  font-size: 11px; color: var(--t3);
}
.clear-btn {
  background: var(--elev); border: none; border-radius: 8px;
  padding: 4px 8px; color: var(--t2); font-size: 11px;
  cursor: pointer; font-family: 'Inter', sans-serif;
  transition: background .2s;
}
.clear-btn:hover { background: #2d3a56; }

/* ── Tone Row ── */
.tone-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tone-chip {
  padding: 8px 14px; border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--elev);
  font-size: 12px; color: var(--t2);
  cursor: pointer; transition: all .2s; user-select: none;
}
.tone-chip.active {
  background: rgba(168, 85, 247, .12);
  border-color: rgba(168, 85, 247, .4);
  color: var(--purple); font-weight: 600;
}

/* ── Generate Button ── */
.generate-btn {
  width: 100%; height: 54px; border-radius: 16px; border: none;
  background: var(--grad);
  color: #fff; font-size: 16px; font-weight: 700;
  font-family: 'Inter', sans-serif;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(168, 85, 247, .4);
  transition: opacity .2s, transform .1s;
}
.generate-btn:hover  { opacity: .92; }
.generate-btn:active { transform: scale(.98); }
.generate-btn i      { width: 20px; height: 20px; }
.generate-btn.loading { opacity: .7; cursor: not-allowed; }

/* ── Error Message ── */
.error-msg {
  padding: 12px 16px; border-radius: 12px;
  background: rgba(239, 68, 68, .12); border: 1px solid rgba(239, 68, 68, .35);
  color: #fca5a5; font-size: .85rem; line-height: 1.5; text-align: center;
}

/* ── Spinner ── */
.spinner {
  width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Preview Card ── */
.preview-card {
  background: var(--card);
  border: 1px solid rgba(168, 85, 247, .25);
  border-radius: 16px; padding: 16px;
  flex-direction: column; gap: 10px;
  display: none;
}
.preview-card.visible { display: flex; }
.preview-top { display: flex; justify-content: space-between; align-items: center; }
.ai-badge {
  display: flex; align-items: center; gap: 6px;
  background: rgba(168, 85, 247, .12);
  border-radius: 12px; padding: 5px 10px;
  font-size: 10px; font-weight: 600; color: var(--purple);
}
.ai-badge i { width: 12px; height: 12px; color: var(--purple); }
.preview-meta { display: flex; gap: 6px; }
.meta-chip { padding: 3px 8px; border-radius: 8px; font-size: 10px; font-weight: 600; }
.meta-lang  { background: var(--elev); color: var(--t2); }
.meta-level { background: rgba(250,204,21,.12); color: var(--yellow); }
.preview-text {
  font-size: 13px; line-height: 1.7; color: var(--t2);
  white-space: pre-line;
}
.preview-actions { display: flex; gap: 8px; }
.save-btn {
  flex: 0 0 auto; height: 44px; padding: 0 16px; border-radius: 12px;
  background: var(--elev); border: 1px solid var(--border);
  color: var(--t2); font-size: 13px; font-weight: 600;
  font-family: 'Inter', sans-serif;
  display: flex; align-items: center; gap: 7px;
  cursor: pointer; transition: all .2s; white-space: nowrap;
}
.save-btn i { width: 15px; height: 15px; }
.save-btn:hover { background: rgba(168,85,247,.12); border-color: rgba(168,85,247,.4); color: var(--purple); }
.save-btn.saved { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.4); color: var(--green); }
.save-btn:disabled { opacity: .55; cursor: not-allowed; }
.start-btn {
  flex: 1; height: 44px; border-radius: 12px; border: none;
  background: var(--grad);
  color: #fff; font-size: 14px; font-weight: 600;
  font-family: 'Inter', sans-serif;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; transition: opacity .2s;
  text-decoration: none;
}
.start-btn:hover { opacity: .9; }
.start-btn i { width: 16px; height: 16px; }
