/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream: #F5F0E8;
  --ink: #1A1A18;
  --ink-soft: #4A4A46;
  --ink-muted: #8A8A82;
  --gold: #B8903A;
  --gold-light: #D4A84B;
  --gold-pale: #F0E6CC;
  --white: #FDFCFA;
  --border: rgba(26,26,24,0.12);
  --border-strong: rgba(26,26,24,0.25);
  --radius: 8px;
  --radius-lg: 14px;
  --shadow: 0 2px 20px rgba(26,26,24,0.08);
  --shadow-lg: 0 8px 40px rgba(26,26,24,0.12);
  font-family: 'DM Sans', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== HEADER ===== */
.header {
  padding: 14px 40px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  flex-shrink: 0;
}

.header-spacer { flex: 1; }

.logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.logo span { color: var(--gold); }

.header-sub {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 300;
}

/* ===== MAIN LAYOUT ===== */
.container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  flex: 1;
  height: calc(100vh - 53px); /* full height minus header */
  overflow: hidden;
}

/* ===== FORM PANEL ===== */
.form-panel {
  padding: 36px 40px 80px;
  overflow-y: auto;
  height: 100%;
  border-right: 1px solid var(--border);
  background: var(--white);
}

.panel-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 4px;
}

.panel-sub {
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 28px;
  font-weight: 300;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 28px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field.span-2 { grid-column: 1 / -1; }

label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.label-hint {
  font-weight: 300;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  color: var(--ink-muted);
}

input[type="number"],
input[type="text"],
select,
textarea {
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238A8A82' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184,144,58,0.12);
}

textarea { resize: vertical; line-height: 1.6; }

/* ===== PILL GROUPS ===== */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pill-group .pill {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-strong);
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 400;
}

.pill-group .pill:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.pill-group .pill.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

/* ===== CHECKBOXES ===== */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: all 0.12s;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  user-select: none;
}

.check-item:hover { background: var(--cream); border-color: var(--border); }

.check-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--gold);
  cursor: pointer;
  flex-shrink: 0;
  border: none;
  padding: 0;
  background: none;
  box-shadow: none;
}

.check-item input:focus { box-shadow: none; border: none; }

/* ===== GENERATE BUTTON ===== */
.generate-btn {
  width: 100%;
  padding: 16px;
  background: var(--ink);
  color: var(--white);
  border: none;
  border-radius: var(--radius-lg);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.2s, transform 0.1s;
}

.generate-btn:hover { background: #2a2a26; }
.generate-btn:active { transform: scale(0.99); }
.generate-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== OUTPUT PANEL ===== */
.output-panel {
  padding: 36px 40px 60px;
  overflow-y: auto;
  height: 100%;
  background: var(--cream);
  display: flex;
  flex-direction: column;
}

.output-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink-muted);
  gap: 16px;
}

.empty-icon {
  font-size: 36px;
  color: var(--gold-light);
  opacity: 0.5;
}

.output-empty p {
  font-size: 14px;
  line-height: 1.7;
  font-weight: 300;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 17px;
}

.output-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 22px;
}

.output-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  font-weight: 400;
}

.char-counter {
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}

/* ===== LISTING BLOCKS ===== */
.listing-block {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 4px;
  box-shadow: var(--shadow);
  position: relative;
}

.listing-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}

.listing-headline {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 12px;
  min-height: 26px;
}

.listing-text {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink);
  white-space: pre-wrap;
  min-height: 80px;
}

.listing-text.streaming::after {
  content: '▋';
  animation: blink 0.8s step-end infinite;
  color: var(--gold);
}

@keyframes blink { 50% { opacity: 0; } }

.copy-btn {
  margin-top: 14px;
  padding: 7px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.03em;
}

.copy-btn:hover { background: var(--ink); color: var(--white); border-color: var(--ink); }
.copy-btn.copied { background: var(--gold); color: var(--white); border-color: var(--gold); }

.listing-block + .listing-block {
  margin-top: 16px;
}


.regen-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.regen-btn {
  flex: 1;
  padding: 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s;
}

.regen-btn:hover { background: var(--ink); color: var(--white); border-color: var(--ink); }

/* ===== ERROR ===== */
.error-box {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 13px;
  color: #991B1B;
  line-height: 1.6;
  margin-top: 16px;
}

/* ===== SPINNER ===== */
.spinner {
  width: 18px;
  height: 18px;
  animation: spin 0.8s linear infinite;
  stroke: currentColor;
}

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

/* ===== FOOTER ===== */
.footer {
  padding: 14px 40px;
  border-top: 1px solid var(--border);
  background: var(--white);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-muted);
}

.upgrade-link {
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.upgrade-link:hover { text-decoration: underline; }

/* ===== UTILITIES ===== */
.hidden { display: none !important; }

/* ===== SECTION DIVIDERS ===== */
.section-divider {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.section-group-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}


::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .container { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .form-panel { border-right: none; border-bottom: 1px solid var(--border); padding: 24px 20px 60px; height: auto; }
  .output-panel { padding: 24px 20px; height: auto; }
  .header { padding: 14px 20px; }
  .footer { padding: 12px 20px; }
  .checkbox-grid { grid-template-columns: repeat(2, 1fr); }
}
