/* ================================================================
   Client Proposal Generator — Styles
   NovaFox Labs · /tools/proposal/
================================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* ── Variables ──────────────────────────────────────────────── */
:root {
  --bg:        #0a0a0f;
  --surface:   rgba(255,255,255,0.025);
  --surface2:  rgba(255,255,255,0.04);
  --border:    rgba(255,255,255,0.08);
  --border2:   rgba(255,255,255,0.12);
  --accent:    #00ffaa;
  --accent2:   #00aaff;
  --purple:    #a78bfa;
  --text:      #e4e4e7;
  --subtle:    #a1a1aa;
  --muted:     #71717a;
  --dimmed:    #52525b;
  --error:     #f472b6;
  --radius:    12px;
  --radius-lg: 20px;
  --font-ui:   'DM Sans', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --font-head: 'Syne', sans-serif;
  --transition: 0.2s ease;
}

/* ── Layout ─────────────────────────────────────────────────── */
.proposal-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
  padding: 0 0 60px;
}

@media (max-width: 1100px) {
  .proposal-layout { grid-template-columns: 1fr; }
}

/* ── Sticky preview panel on desktop ───────────────────────── */
.preview-sticky {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.preview-sticky::-webkit-scrollbar { width: 4px; }
.preview-sticky::-webkit-scrollbar-track { background: transparent; }
.preview-sticky::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

/* ── Form Panel ─────────────────────────────────────────────── */
.form-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.form-section {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.form-section:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.form-section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-transform: uppercase;
  margin: 0 0 16px;
}

/* ── Form controls ──────────────────────────────────────────── */
.field-group { margin-bottom: 14px; }
.field-group:last-child { margin-bottom: 0; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

label.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.field-input,
.field-textarea,
.field-select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
}
.field-input:focus,
.field-textarea:focus,
.field-select:focus  { border-color: rgba(0,255,170,0.4); }

.field-textarea { resize: vertical; min-height: 80px; line-height: 1.6; }

.field-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2371717a'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

/* ── Dynamic list items ─────────────────────────────────────── */
.list-container { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }

.list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  transition: border-color var(--transition);
}
.list-item:hover { border-color: var(--border2); }

.list-item-text {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
}
.list-item-text::placeholder { color: var(--muted); }

.list-item-remove {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--dimmed);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), background var(--transition);
  font-size: 16px;
  line-height: 1;
  padding: 0;
}
.list-item-remove:hover { color: var(--error); background: rgba(244,114,182,0.08); }

/* milestone date field */
.list-item-date {
  flex-shrink: 0;
  width: 130px;
  background: none;
  border: none;
  border-left: 1px solid var(--border);
  padding-left: 10px;
  outline: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}
.list-item-date:focus { color: var(--text); }

.add-item-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(0,255,170,0.06);
  border: 1px dashed rgba(0,255,170,0.25);
  border-radius: var(--radius);
  padding: 8px 14px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.add-item-btn:hover { background: rgba(0,255,170,0.1); border-color: rgba(0,255,170,0.4); }

/* ── Action toolbar ─────────────────────────────────────────── */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: opacity var(--transition), transform 0.15s;
  white-space: nowrap;
}
.btn:hover { opacity: 0.85; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary  { background: var(--accent);  color: #0a0a0f; }
.btn-blue     { background: var(--accent2); color: #0a0a0f; }
.btn-ghost    { background: var(--surface2); color: var(--subtle); border: 1px solid var(--border); }
.btn-danger   { background: rgba(244,114,182,0.1); color: var(--error); border: 1px solid rgba(244,114,182,0.2); }

/* ── Toast ──────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 80px;
  right: 24px;
  z-index: 9999;
  background: rgba(15,15,22,0.97);
  border: 1px solid rgba(0,255,170,0.3);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 10px 18px;
  border-radius: var(--radius);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }

/* ── Preview Panel ──────────────────────────────────────────── */
.preview-panel {
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  color: #1a1a2e;
  font-family: 'DM Sans', sans-serif;
}

.preview-inner { padding: 40px; }

/* Preview header */
.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  gap: 20px;
  flex-wrap: wrap;
}

.preview-brand-name {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #0a0a0f;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}
.preview-brand-meta {
  font-size: 12px;
  color: #71717a;
  line-height: 1.7;
  white-space: pre-line;
}

.preview-doc-type {
  text-align: right;
}
.preview-doc-label {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: #0a0a0f;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 6px;
}
.preview-doc-meta {
  font-size: 12px;
  color: #71717a;
  text-align: right;
  line-height: 1.7;
}

/* Two-column meta row */
.preview-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
  padding: 20px;
  background: #f8f8fa;
  border-radius: 10px;
}
.preview-party-label {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: #a1a1aa;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.preview-party-name {
  font-size: 15px;
  font-weight: 700;
  color: #0a0a0f;
  margin-bottom: 2px;
}
.preview-party-meta {
  font-size: 12px;
  color: #71717a;
  line-height: 1.65;
  white-space: pre-line;
}

/* Divider */
.preview-divider {
  border: none;
  border-top: 1px solid #e5e5ea;
  margin: 22px 0;
}

/* Section blocks */
.preview-section { margin-bottom: 24px; }
.preview-section-title {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: #a1a1aa;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.preview-section-body {
  font-size: 13px;
  color: #3f3f46;
  line-height: 1.75;
  white-space: pre-line;
}

/* Scope / deliverables list */
.preview-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.preview-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: #3f3f46;
  line-height: 1.6;
}
.preview-list li::before {
  content: '▸';
  color: #00c87a;
  flex-shrink: 0;
  margin-top: 1px;
  font-size: 11px;
}

/* Milestones table */
.preview-milestones {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.preview-milestones th {
  text-align: left;
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: #a1a1aa;
  text-transform: uppercase;
  padding: 6px 10px;
  border-bottom: 1px solid #e5e5ea;
}
.preview-milestones td {
  padding: 8px 10px;
  color: #3f3f46;
  border-bottom: 1px solid #f4f4f5;
  vertical-align: top;
  line-height: 1.5;
}
.preview-milestones td:last-child {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: #71717a;
  white-space: nowrap;
}

/* Pricing box */
.preview-pricing {
  background: #f8f8fa;
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 24px;
}
.preview-pricing-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 13px;
  color: #52525b;
  border-bottom: 1px solid #e5e5ea;
}
.preview-pricing-row:last-child { border-bottom: none; }
.preview-pricing-row.total {
  padding-top: 10px;
  margin-top: 4px;
  font-weight: 700;
  color: #0a0a0f;
  font-size: 15px;
}
.preview-pricing-row.total span:last-child { color: #00a060; }

/* Acceptance block */
.preview-acceptance {
  margin-top: 28px;
  padding: 18px 20px;
  background: #f0fdf8;
  border: 1px solid #d1fae5;
  border-radius: 10px;
  font-size: 12px;
  color: #52525b;
  line-height: 1.75;
}
.preview-acceptance strong { color: #0a0a0f; }

/* Signature area */
.preview-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 32px;
}
.preview-sig-block {
  padding-top: 40px;
  border-top: 1px solid #1a1a2e;
  font-size: 12px;
  color: #71717a;
}
.preview-sig-name { font-weight: 700; color: #0a0a0f; }

/* Nav / mobile ──────────────────────────────────────────────── */
#mobile-menu { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; }
#mobile-menu.open { max-height: 520px; }

/* Print styles ─────────────────────────────────────────────── */
@media print {
  body { background: #fff !important; color: #000 !important; }
  nav, .toolbar, footer, #scroll-top, #toast { display: none !important; }
  .proposal-layout { display: block !important; }
  .form-panel { display: none !important; }
  .preview-sticky { position: static !important; max-height: none !important; overflow: visible !important; }
  .preview-panel { box-shadow: none !important; border-radius: 0 !important; }
  .preview-inner { padding: 20px !important; }
}
