/* ═══════════════════════════════════════════════════════════
   QuoteForge — style.css
   Aesthetic: Refined editorial / luxury business tool
   Fonts: Playfair Display (headings) + DM Sans (body)
   Palette: Deep slate, warm amber accent, ivory backgrounds
═══════════════════════════════════════════════════════════ */

/* ── CSS VARIABLES ──────────────────────────────────────── */
:root {
  --bg:           #f5f3ef;          /* warm ivory page bg */
  --surface:      #ffffff;          /* card surface */
  --surface-alt:  #faf9f7;          /* subtle alternate */

  --ink:          #1c1a17;          /* primary text */
  --ink-mid:      #4a4640;          /* secondary text */
  --ink-light:    #8c867c;          /* muted / labels */

  --accent:       #c8902a;          /* amber gold */
  --accent-soft:  #f0e4c8;          /* amber tint */
  --accent-dark:  #9e6f18;          /* amber deep */

  --border:       #e0dbd3;          /* card borders */
  --border-dark:  #c9c3b9;

  --danger:       #c0392b;
  --danger-soft:  #fdecea;

  --radius:       10px;
  --radius-sm:    6px;
  --shadow:       0 2px 16px rgba(28,26,23,.07);
  --shadow-lg:    0 8px 40px rgba(28,26,23,.12);

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', -apple-system, sans-serif;

  --max-w:        860px;
}

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

html { scroll-behavior: smooth; }

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

/* ── TOP BAR ────────────────────────────────────────────── */
.topbar {
  background: var(--ink);
  border-bottom: 3px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,.25);
}

.topbar-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 22px;
  color: #fff;
  letter-spacing: .5px;
}

.brand-tagline {
  font-size: 12px;
  color: #888;
  letter-spacing: .3px;
  border-left: 1px solid #333;
  padding-left: 18px;
  font-weight: 300;
}

/* ── MAIN CONTAINER ─────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 36px 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── CARDS ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: fadeUp .4s ease both;
}

.card::before {
  /* left accent bar */
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--accent);
  border-radius: var(--radius) 0 0 var(--radius);
}

@keyframes fadeUp {
  from { opacity:0; transform: translateY(12px); }
  to   { opacity:1; transform: translateY(0); }
}

/* staggered card delays */
#sec-company  { animation-delay: .05s; }
#sec-quoteinfo{ animation-delay: .10s; }
#sec-client   { animation-delay: .15s; }
#sec-items    { animation-delay: .20s; }
#sec-totals   { animation-delay: .25s; }
#sec-bank     { animation-delay: .30s; }

.card-label {
  position: absolute;
  top: 20px;
  right: 24px;
  font-family: var(--font-display);
  font-size: 48px;
  color: var(--border);
  line-height: 1;
  user-select: none;
  pointer-events: none;
}

.card-title {
  font-family: var(--font-display);
  font-size: 19px;
  color: var(--ink);
  margin-bottom: 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ── GRID LAYOUTS ───────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
}

.field-full { grid-column: 1 / -1; }

/* ── FORM FIELDS ────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--ink-light);
}

.field input,
.field textarea,
.field select {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: #fff;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--border-dark);
}

/* ── ITEMS TABLE ────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.items-table thead tr {
  background: var(--ink);
  color: #fff;
}

.items-table th {
  padding: 11px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .7px;
  white-space: nowrap;
}

.items-table th.col-sno    { width: 50px;  text-align: center; }
.items-table th.col-desc   { min-width: 180px; }
.items-table th.col-qty    { width: 70px;  text-align: center; }
.items-table th.col-unit   { width: 80px; }
.items-table th.col-rate   { width: 100px; text-align: right; }
.items-table th.col-amount { width: 110px; text-align: right; }
.items-table th.col-action { width: 40px; }

.items-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}

.items-table tbody tr:last-child { border-bottom: none; }
.items-table tbody tr:hover { background: var(--surface-alt); }

.items-table td {
  padding: 8px 10px;
  vertical-align: middle;
}

.items-table td.sno-cell { text-align: center; color: var(--ink-light); font-size: 12px; }
.items-table td.amount-cell { text-align: right; font-weight: 600; color: var(--accent-dark); }
.items-table td.rate-cell { text-align: right; }
.items-table td.qty-cell { text-align: center; }

/* inline inputs inside table */
.items-table td input,
.items-table td select {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 5px 7px;
  width: 100%;
  outline: none;
  transition: border-color .15s, background .15s;
}

.items-table td input:focus,
.items-table td select:focus {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.items-table td input.qty-input  { text-align: center; }
.items-table td input.rate-input { text-align: right; }
.items-table td input.desc-input { min-width: 140px; }

/* remove row button */
.btn-remove-row {
  background: none;
  border: none;
  color: var(--border-dark);
  font-size: 17px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color .15s, background .15s;
  line-height: 1;
}

.btn-remove-row:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

/* add row button */
.btn-add-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 1.5px dashed var(--accent);
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
  letter-spacing: .3px;
}

.btn-add-row:hover {
  background: #e8d4a0;
  border-color: var(--accent-dark);
}

/* ── TOTALS SECTION ─────────────────────────────────────── */
.totals-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
  align-items: start;
}

.totals-right {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--ink-mid);
}

.total-row:last-of-type { border-bottom: none; }

.total-row.grand {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ink);
  margin-top: 6px;
  padding-top: 14px;
  border-top: 2px solid var(--accent);
  border-bottom: none;
}

.total-row.grand span:last-child {
  color: var(--accent-dark);
}

.amount-words {
  margin-top: 12px;
  font-size: 12px;
  font-style: italic;
  color: var(--ink-light);
  line-height: 1.5;
}

/* ── BANK / TERMS ───────────────────────────────────────── */
.sub-heading {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--ink-mid);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── GENERATE BUTTON ────────────────────────────────────── */
.generate-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px 0 4px;
}

.btn-generate {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: var(--ink);
  border: none;
  border-radius: var(--radius);
  padding: 16px 40px;
  cursor: pointer;
  letter-spacing: .4px;
  position: relative;
  overflow: hidden;
  transition: background .25s, transform .15s, box-shadow .25s;
  box-shadow: 0 4px 20px rgba(28,26,23,.25);
}

.btn-generate::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 50%, rgba(200,144,42,.25));
  pointer-events: none;
}

.btn-generate:hover {
  background: #2d2a24;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(28,26,23,.35);
}

.btn-generate:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(28,26,23,.2);
}

.btn-icon {
  font-size: 18px;
  color: var(--accent);
}

.generate-hint {
  font-size: 12px;
  color: var(--ink-light);
  letter-spacing: .3px;
}

/* ── FOOTER ─────────────────────────────────────────────── */
.app-footer {
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--ink-light);
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .topbar-inner { flex-direction: column; align-items: flex-start; gap: 6px; }
  .brand-tagline { border-left: none; padding-left: 0; }

  .container { padding: 20px 14px 50px; gap: 14px; }
  .card { padding: 20px 18px; }
  .card-label { font-size: 36px; top: 14px; right: 14px; }

  .grid-2 { grid-template-columns: 1fr; }
  .totals-grid { grid-template-columns: 1fr; }

  .items-table th.col-unit,
  .items-table td:nth-child(4) { display: none; } /* hide unit col on tiny screens */

  .btn-generate { padding: 14px 28px; font-size: 15px; }
}
