/* ═══════════════════════════════════════════════════════════
   ReceiptCraft — style.css
   Aesthetic : Sharp geometric · Deep teal · Crisp white
   Fonts     : Syne (display headings) + Instrument Sans (body)
   Palette   : Teal primary, near-black surface, white cards
═══════════════════════════════════════════════════════════ */

/* ── CSS VARIABLES ──────────────────────────────────────── */
:root {
  /* Teal palette */
  --teal:        #0d9488;   /* primary accent */
  --teal-light:  #14b8a6;
  --teal-deep:   #0a7870;
  --teal-wash:   #e6faf8;   /* tint background */
  --teal-mid:    #99e6de;

  /* Surfaces */
  --page-bg:     #f0f4f3;   /* cool off-white page */
  --card-bg:     #ffffff;
  --card-alt:    #f7fafa;
  --hero-bg:     #0b2e2b;   /* very dark teal */

  /* Text */
  --ink:         #0d1f1e;
  --ink-mid:     #2f4f4c;
  --ink-muted:   #6b8f8c;

  /* Borders */
  --border:      #d4e6e4;
  --border-dark: #b0cbc9;

  /* States */
  --danger:      #e53e3e;
  --danger-wash: #fff5f5;

  /* Geometry */
  --radius:      12px;
  --radius-sm:   7px;
  --radius-xs:   4px;
  --shadow-card: 0 1px 3px rgba(13,31,30,.06), 0 4px 20px rgba(13,31,30,.06);
  --shadow-lift: 0 8px 40px rgba(13,148,136,.18);

  /* Typography */
  --font-display: 'Syne', sans-serif;
  --font-body:    'Instrument Sans', system-ui, sans-serif;

  --max-w: 880px;
}

/* ── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--page-bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* ── BACKGROUND DECORATIONS ─────────────────────────────── */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(13,148,136,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13,148,136,.04) 1px, transparent 1px);
  background-size: 40px 40px;
}

.bg-blob {
  position: fixed;
  top: -200px;
  right: -200px;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(13,148,136,.10) 0%, transparent 70%);
  z-index: 0;
  pointer-events: none;
}

/* ── TOPBAR ─────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--hero-bg);
  border-bottom: 2px solid var(--teal);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 24px rgba(0,0,0,.3);
}

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

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

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--teal);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.3px;
}

.brand-sub {
  font-size: 12px;
  color: var(--teal-mid);
  letter-spacing: .3px;
  border-left: 1px solid rgba(255,255,255,.12);
  padding-left: 18px;
  font-weight: 300;
}

/* ── HERO STRIP ─────────────────────────────────────────── */
.hero-strip {
  background: var(--hero-bg);
  padding: 48px 24px 52px;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.hero-strip::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 32px;
  background: var(--page-bg);
  clip-path: ellipse(55% 100% at 50% 100%);
}

.hero-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  letter-spacing: -.5px;
  margin-bottom: 14px;
}

.hero-title em {
  font-style: normal;
  color: var(--teal-light);
  position: relative;
}

/* animated underline on hero em */
.hero-title em::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 100%;
  height: 3px;
  background: var(--teal);
  border-radius: 2px;
  animation: growUnder .8s .3s ease both;
  transform-origin: left;
}

@keyframes growUnder {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.hero-desc {
  font-size: 15px;
  color: rgba(255,255,255,.55);
  max-width: 480px;
  font-weight: 300;
}

/* ── MAIN CONTAINER ─────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 40px 24px 70px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  z-index: 1;
}

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

/* top accent line per card */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), transparent);
  border-radius: var(--radius) var(--radius) 0 0;
}

/* stagger card animations */
#sec-company  { animation-delay: .04s; }
#sec-receipt  { animation-delay: .08s; }
#sec-customer { animation-delay: .12s; }
#sec-items    { animation-delay: .16s; }
#sec-totals   { animation-delay: .20s; }
#sec-bank     { animation-delay: .24s; }

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

/* ── SECTION HEADER ─────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.step-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.section-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.2px;
}

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

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px 18px;
}

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

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

.field label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--ink-muted);
}

.req { color: var(--teal); }

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

.field 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='%236b8f8c' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13,148,136,.14);
  background: #fff;
}

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

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

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

.items-table thead tr {
  background: var(--hero-bg);
}

.items-table th {
  padding: 11px 10px;
  text-align: left;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--teal-mid);
  white-space: nowrap;
}

.th-sno    { width: 44px;  text-align: center; }
.th-qty    { width: 68px;  text-align: center; }
.th-unit   { width: 74px; }
.th-price  { width: 110px; text-align: right; }
.th-amount { width: 110px; text-align: right; }
.th-del    { width: 38px; }

.items-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.items-table tbody tr:last-child { border-bottom: none; }
.items-table tbody tr:hover { background: var(--teal-wash); }

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

.td-sno    { text-align: center; color: var(--ink-muted); font-size: 12px; }
.td-qty    { text-align: center; }
.td-price  { text-align: right; }
.td-amount {
  text-align: right;
  font-weight: 600;
  color: var(--teal-deep);
  font-variant-numeric: tabular-nums;
}

/* 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: 1.5px solid transparent;
  border-radius: var(--radius-xs);
  padding: 5px 8px;
  width: 100%;
  outline: none;
  transition: border-color .14s, background .14s;
}
.items-table td input:focus,
.items-table td select:focus {
  border-color: var(--teal);
  background: var(--teal-wash);
}
.items-table td input.in-qty,
.items-table td input.in-price { text-align: right; }
.items-table td input.in-qty   { text-align: center; }

/* remove button */
.btn-del {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  background: none;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--border-dark);
  cursor: pointer;
  transition: color .14s, background .14s;
  font-size: 15px;
  line-height: 1;
}
.btn-del:hover {
  color: var(--danger);
  background: var(--danger-wash);
}

/* add row button */
.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--teal-deep);
  background: var(--teal-wash);
  border: 1.5px dashed var(--teal);
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  cursor: pointer;
  transition: background .18s, border-color .18s, transform .1s;
  letter-spacing: .2px;
}
.btn-add:hover {
  background: #c8f5ef;
  transform: translateY(-1px);
}
.btn-add:active { transform: translateY(0); }

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

.tax-inputs {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.summary-panel {
  background: var(--hero-bg);
  border-radius: var(--radius-sm);
  padding: 20px 22px;
  border: 1px solid rgba(13,148,136,.25);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
}

.summary-label { color: rgba(255,255,255,.55); font-weight: 400; }
.summary-value { color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; }

.summary-divider {
  height: 1px;
  background: rgba(255,255,255,.1);
  margin: 4px 0;
}

.grand-row { padding-top: 12px; }
.grand-row .summary-label {
  font-family: var(--font-display);
  font-size: 15px;
  color: rgba(255,255,255,.85);
  font-weight: 700;
}
.grand-value {
  font-family: var(--font-display);
  font-size: 22px !important;
  color: var(--teal-light) !important;
}

.words-badge {
  margin-top: 14px;
  padding: 10px 14px;
  background: rgba(13,148,136,.15);
  border: 1px solid rgba(13,148,136,.3);
  border-radius: var(--radius-xs);
  font-size: 11.5px;
  color: var(--teal-mid);
  font-style: italic;
  line-height: 1.5;
}

/* ── CTA BUTTON ─────────────────────────────────────────── */
.cta-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
}

.btn-generate {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: var(--teal);
  border: none;
  border-radius: var(--radius);
  padding: 17px 44px;
  cursor: pointer;
  letter-spacing: .2px;
  transition: background .22s, transform .15s, box-shadow .22s;
  box-shadow: 0 4px 20px rgba(13,148,136,.35);
  position: relative;
  overflow: hidden;
}

.btn-generate::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.12) 0%, transparent 60%);
  pointer-events: none;
}

.btn-generate:hover {
  background: var(--teal-deep);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(13,148,136,.45);
}
.btn-generate:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(13,148,136,.3);
}

.btn-icon { flex-shrink: 0; }

.cta-hint {
  font-size: 12px;
  color: var(--ink-muted);
  letter-spacing: .2px;
}

/* ── FOOTER ─────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--ink-muted);
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 700px) {
  .brand-sub { display: none; }

  .hero-strip { padding: 36px 20px 44px; }
  .hero-title { font-size: 30px; }

  .container { padding: 24px 14px 56px; gap: 14px; }
  .card      { padding: 20px 18px; }

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

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

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

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