/* ─────────────────────────────────────────────────────────────────────────────
   PAA Content Generator — Style Sheet
   Dark theme: #0a0a0a bg / #1a1a1a cards / purple-blue gradient accents
   ───────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Syne:wght@600;700;800&family=Inter:wght@400;500;600&display=swap');

/* ── Variables ── */
:root {
  --bg:          #0a0a0a;
  --bg-elevated: #111111;
  --card:        #1a1a1a;
  --card-border: #2a2a2a;
  --surface:     #222222;
  --surface-2:   #2c2c2c;

  --text:        #f0f0f0;
  --text-muted:  #888888;
  --text-faint:  #555555;

  --grad-start:  #7c3aed;
  --grad-end:    #2563eb;
  --grad:        linear-gradient(135deg, var(--grad-start), var(--grad-end));
  --grad-subtle: linear-gradient(135deg, rgba(124,58,237,.12), rgba(37,99,235,.12));

  --accent:      #7c3aed;
  --accent-blue: #2563eb;
  --success:     #22c55e;
  --danger:      #ef4444;
  --warning:     #f59e0b;

  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   16px;
  --radius-xl:   24px;

  --shadow-sm:   0 1px 3px rgba(0,0,0,.4);
  --shadow:      0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:   0 8px 40px rgba(0,0,0,.6);

  --font-display: 'Syne', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'DM Mono', monospace;

  --transition:  all .18s ease;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* subtle grid bg */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(124,58,237,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,58,237,.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ── */
.wrapper {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}

/* ── Page Header ── */
.page-header {
  text-align: center;
  margin-bottom: 40px;
}

.page-header .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--grad-subtle);
  border: 1px solid rgba(124,58,237,.25);
  border-radius: 100px;
  padding: 4px 14px;
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #a78bfa;
  margin-bottom: 16px;
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 5vw, 38px);
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.15;
  margin-bottom: 10px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  font-family: var(--font-mono);
}

/* ── Step Indicator ── */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 32px;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
}

.step-item + .step-item::before {
  content: '';
  position: absolute;
  right: 100%;
  top: 15px;
  width: 40px;
  height: 1px;
  background: var(--card-border);
}

.step-item.done + .step-item::before,
.step-item.active + .step-item::before {
  background: var(--grad);
}

.step-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  background: var(--card);
  transition: var(--transition);
  margin: 0 20px;
}

.step-item.active .step-circle {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 16px rgba(124,58,237,.4);
}

.step-item.done .step-circle {
  background: rgba(34,197,94,.15);
  border-color: rgba(34,197,94,.3);
  color: var(--success);
}

.step-label {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-faint);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.step-item.active .step-label { color: #a78bfa; }
.step-item.done .step-label   { color: var(--success); }

/* ── Card ── */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title::before {
  content: '';
  width: 3px;
  height: 16px;
  background: var(--grad);
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Form ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

input, textarea {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
  width: 100%;
}

input:focus, textarea:focus {
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px rgba(124,58,237,.12);
}

input::placeholder, textarea::placeholder { color: var(--text-faint); }

textarea {
  resize: vertical;
  min-height: 80px;
  font-size: 13px;
  line-height: 1.5;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 4px 16px rgba(124,58,237,.3);
}

.btn-primary:hover {
  opacity: .9;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124,58,237,.4);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--card-border);
  padding: 7px 14px;
  font-size: 12px;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--surface-2);
  background: var(--surface);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 12px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-generate {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  margin-top: 20px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .02em;
}

.btn-download {
  background: rgba(34,197,94,.1);
  color: var(--success);
  border: 1px solid rgba(34,197,94,.2);
}

.btn-download:hover {
  background: rgba(34,197,94,.18);
  border-color: rgba(34,197,94,.4);
}

/* ── Tab Bar ── */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 6px 6px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex-shrink: 0;
  padding: 9px 20px;
  border-radius: var(--radius) var(--radius) 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  margin-bottom: -1px;
}

.tab:hover { color: var(--text); background: var(--surface); }

.tab.active {
  color: #a78bfa;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-bottom-color: var(--bg-elevated);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  width: 80%;
  height: 2px;
  background: var(--grad);
  border-radius: 2px 2px 0 0;
}

.tab-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  margin-left: 6px;
  vertical-align: middle;
  opacity: 0;
  transition: opacity .2s;
}

.tab.has-content .tab-dot { opacity: 1; }

/* ── Tab Panels ── */
.panels-wrapper {
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  min-height: 300px;
}

.panel {
  display: none;
  padding: 28px;
  animation: panel-in .18s ease;
}

.panel.active { display: block; }

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

/* ── Output Text Area ── */
.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.output-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.output-box {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.8;
  color: #d4d4d4;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 200px;
  max-height: 500px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--card-border) transparent;
}

.output-box::-webkit-scrollbar { width: 4px; }
.output-box::-webkit-scrollbar-thumb {
  background: var(--card-border);
  border-radius: 2px;
}

/* keyword highlight in output */
.output-box .kw { color: #a78bfa; }
.output-box .val { color: #86efac; }

/* ── Image Grid ── */
.image-grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.image-card {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}

.image-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
}

.image-card img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}

.image-card-footer {
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.image-card-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.image-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-faint);
  font-size: 13px;
  font-family: var(--font-mono);
}

/* ── Page Preview ── */
.page-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

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

.iframe-wrapper {
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.iframe-bar {
  background: var(--surface-2);
  border-bottom: 1px solid var(--card-border);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.iframe-dots {
  display: flex;
  gap: 5px;
}

.iframe-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.iframe-dot:nth-child(1) { background: #ef4444; }
.iframe-dot:nth-child(2) { background: #f59e0b; }
.iframe-dot:nth-child(3) { background: #22c55e; }

.iframe-url {
  flex: 1;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}

#pagePreview {
  width: 100%;
  height: 520px;
  border: none;
  display: block;
}

.page-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 400px;
  color: var(--text-faint);
  font-size: 13px;
  font-family: var(--font-mono);
  text-align: center;
}

/* ── Loading Spinner ── */
.spinner-wrap {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px 20px;
}

.spinner-wrap.visible { display: flex; }

.spinner {
  width: 36px;
  height: 36px;
  border: 2px solid rgba(124,58,237,.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.spinner-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: .04em;
}

.spinner-dots::after {
  content: '';
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}

/* inline spinner inside a button */
.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

/* ── Progress Bar ── */
.progress-bar-wrap {
  background: var(--surface);
  border-radius: 100px;
  height: 3px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--grad);
  border-radius: 100px;
  transition: width .4s ease;
}

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--card);
  border: 1px solid rgba(34,197,94,.3);
  color: var(--success);
  padding: 10px 22px;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .04em;
  opacity: 0;
  transition: all .25s ease;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Copy button copied state ── */
.btn-copied {
  color: var(--success) !important;
  border-color: rgba(34,197,94,.3) !important;
}

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--card-border);
  margin: 20px 0;
}

/* ── Error State ── */
.error-box {
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13px;
  color: #fca5a5;
  font-family: var(--font-mono);
  display: none;
}

.error-box.visible { display: block; }

/* ── Generate actions row ── */
.generate-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.copy-all-btn {
  display: none;
}

/* ── Cities tag input ── */
.tag-hint {
  font-size: 10px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .wrapper { padding: 24px 14px 60px; }

  .card { padding: 20px 16px; }

  .form-grid { grid-template-columns: 1fr; }

  .image-grid { grid-template-columns: 1fr 1fr; }

  .tabs { padding: 4px 4px 0; }

  .tab { padding: 8px 12px; font-size: 11px; }

  .panel { padding: 18px; }

  .page-preview-actions { flex-wrap: wrap; }

  #pagePreview { height: 360px; }

  .step-indicator { gap: 0; }

  .step-circle { margin: 0 10px; }
}

@media (max-width: 420px) {
  .image-grid { grid-template-columns: 1fr; }
}
