/* ═══════════════════════════════════════════════════════════════════════════
   iCalcDesk Rent Receipt Generator — style.css
   Brand-matched to icalcdesk.com · rent.icalcdesk.com
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  --teal:         #0d9488;
  --teal-dark:    #0f766e;
  --teal-light:   #f0fdf4;
  --teal-border:  #99f6e4;
  --navy:         #0f172a;
  --navy-mid:     #1e293b;
  --slate:        #475569;
  --muted:        #64748b;
  --light:        #94a3b8;
  --border:       #e2e8f0;
  --border-light: #f1f5f9;
  --bg:           #f8fafc;
  --surface:      #ffffff;
  --danger:       #ef4444;
  --danger-bg:    #fef2f2;
  --danger-border:#fecaca;
  --warning:      #d97706;
  --warning-bg:   #fffbeb;
  --warning-border:#fde68a;
  --success:      #16a34a;
  --success-bg:   #f0fdf4;
  --success-border:#bbf7d0;
  --paid-green:   #15803d;

  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    14px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:       0 4px 16px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.05);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.1), 0 2px 8px rgba(0,0,0,.06);

  --font:         'Inter', system-ui, -apple-system, sans-serif;
  --font-receipt: 'DM Serif Display', Georgia, serif;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--navy-mid);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 16px;
}
.logo-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-link img { height: 26px; width: auto; }
.logo-link span {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.header-badge {
  font-size: 11px;
  background: var(--teal-light);
  color: var(--teal-dark);
  border: 1px solid var(--teal-border);
  border-radius: 20px;
  padding: 2px 8px;
  font-weight: 500;
  white-space: nowrap;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}
.header-nav a {
  font-size: 13px;
  color: var(--slate);
  text-decoration: none;
  transition: color .15s;
}
.header-nav a:hover { color: var(--teal); }

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 36px 24px 28px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 10px;
}
.hero h1 em {
  font-style: normal;
  color: var(--teal);
}
.hero p {
  font-size: 15px;
  color: var(--slate);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.6;
}
.hero-tags {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.hero-tag {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
}

/* ── Main grid ───────────────────────────────────────────────────────────── */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 48px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

/* ── Form panel ─────────────────────────────────────────────────────────── */
.form-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
}
.panel-icon {
  width: 32px; height: 32px;
  background: var(--teal-light);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.form-body { padding: 20px 24px 24px; }

/* ── Form fields ─────────────────────────────────────────────────────────── */
.form-row { margin-bottom: 16px; }
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.form-row label,
.form-row-2 .form-row label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--navy-mid);
  margin-bottom: 6px;
}
.label-optional {
  font-size: 11px;
  font-weight: 400;
  color: var(--light);
  margin-left: 4px;
}
.label-required {
  color: var(--danger);
  margin-left: 2px;
}
.form-row input,
.form-row select,
.form-row textarea,
.form-row-2 input,
.form-row-2 select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--navy-mid);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus,
.form-row-2 input:focus,
.form-row-2 select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13,148,136,.1);
}
.form-row input.error,
.form-row-2 input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,.08);
}
.form-row textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: '▾';
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  font-size: 12px;
}
.field-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.4;
}
.field-error {
  font-size: 11px;
  color: var(--danger);
  margin-top: 5px;
  display: none;
}
.field-error.visible { display: block; }

/* ── PAN field states ────────────────────────────────────────────────────── */
.pan-warning {
  display: none;
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--warning);
  margin-top: 6px;
  line-height: 1.4;
}
.pan-warning.visible { display: block; }
.pan-ok {
  display: none;
  font-size: 11px;
  color: var(--success);
  margin-top: 5px;
}
.pan-ok.visible { display: block; }

/* ── City toggle ─────────────────────────────────────────────────────────── */
.city-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.city-toggle input[type="radio"] { display: none; }
.city-toggle label {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--slate);
  background: var(--surface);
  cursor: pointer;
  transition: background .15s, color .15s;
  border: none;
  margin: 0;
}
.city-toggle label:first-of-type { border-right: 1px solid var(--border); }
.city-toggle input[type="radio"]:checked + label {
  background: var(--teal);
  color: #fff;
  font-weight: 500;
}
.city-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.4;
}

/* ── Conditional payment fields ──────────────────────────────────────────── */
.payment-extra { display: none; margin-top: 12px; }
.payment-extra.visible { display: block; }

/* ── Email section ───────────────────────────────────────────────────────── */
.section-divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 20px 0 16px;
}
.section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--light);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 14px;
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.checkbox-row input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--teal);
  cursor: pointer;
  flex-shrink: 0;
}
.checkbox-row label {
  font-size: 13px;
  color: var(--slate);
  cursor: pointer;
}

/* ── Batch section ───────────────────────────────────────────────────────── */
.batch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.batch-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--slate);
  background: var(--surface);
  transition: all .15s;
}
.batch-btn:hover, .batch-btn.active {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-light);
}
.batch-btn.active { font-weight: 600; }

/* ── Action buttons ──────────────────────────────────────────────────────── */
.actions { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .01em;
  transition: background .15s, transform .1s;
}
.btn-primary:hover { background: var(--teal-dark); }
.btn-primary:active { transform: scale(.99); }
.btn-primary:disabled { background: var(--border); color: var(--light); cursor: not-allowed; }
.btn-secondary {
  width: 100%;
  padding: 11px;
  background: var(--surface);
  color: var(--teal);
  border: 1px solid var(--teal);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: background .15s;
}
.btn-secondary:hover { background: var(--teal-light); }
.btn-print {
  width: 100%;
  padding: 10px;
  background: var(--surface);
  color: var(--slate);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: background .15s;
}
.btn-print:hover { background: var(--bg); }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  transform: translateY(80px);
  opacity: 0;
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
  max-width: 320px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.toast.error   { background: var(--danger-bg);  color: var(--danger);  border: 1px solid var(--danger-border); }
.toast.info    { background: var(--teal-light);  color: var(--teal-dark); border: 1px solid var(--teal-border); }

/* ── Preview panel ───────────────────────────────────────────────────────── */
.preview-panel {
  position: sticky;
  top: 72px;
}
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.preview-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
}
.preview-note {
  font-size: 12px;
  color: var(--muted);
}

/* ── Receipt document ────────────────────────────────────────────────────── */
.receipt-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
}
.receipt-watermark {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 64px;
  font-weight: 800;
  color: rgba(13,148,136,.06);
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
  font-family: var(--font);
  letter-spacing: .1em;
  user-select: none;
}

/* Receipt header */
.receipt-doc-header {
  background: var(--navy);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.receipt-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.receipt-brand img { height: 22px; filter: brightness(0) invert(1); }
.receipt-brand span {
  font-size: 13px;
  color: rgba(255,255,255,.7);
  font-weight: 400;
}
.receipt-title-block { text-align: right; }
.receipt-title {
  font-family: var(--font-receipt);
  font-size: 20px;
  color: #fff;
  letter-spacing: .02em;
}
.receipt-no {
  font-size: 11px;
  color: rgba(255,255,255,.6);
  margin-top: 2px;
  font-family: 'Courier New', monospace;
}

/* Receipt body */
.receipt-body { padding: 24px; position: relative; z-index: 2; }

.receipt-row {
  display: flex;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-light);
  align-items: flex-start;
}
.receipt-row:last-child { border-bottom: none; }
.receipt-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--light);
  text-transform: uppercase;
  letter-spacing: .05em;
  min-width: 120px;
  flex-shrink: 0;
  padding-top: 1px;
}
.receipt-value {
  font-size: 13px;
  color: var(--navy-mid);
  line-height: 1.4;
  flex: 1;
}
.receipt-value.big {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -.01em;
}
.receipt-value.words {
  font-size: 12px;
  font-style: italic;
  color: var(--slate);
  display: block;
  margin-top: 2px;
  font-weight: 400;
}
.receipt-pan { display: none; }
.receipt-pan.visible { display: flex; }

/* Receipt footer */
.receipt-footer {
  margin: 0 24px 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.paid-stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--paid-green);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-family: var(--font-receipt);
  font-size: 22px;
  color: var(--paid-green);
  transform: rotate(-8deg);
  letter-spacing: .1em;
  opacity: .85;
  flex-shrink: 0;
}
.sig-block { text-align: right; }
.sig-line {
  width: 140px;
  border-bottom: 1px solid var(--navy-mid);
  margin-bottom: 4px;
  height: 28px;
}
.sig-name {
  font-size: 11px;
  color: var(--slate);
  font-weight: 500;
}
.sig-label {
  font-size: 10px;
  color: var(--light);
}

/* Receipt bottom bar */
.receipt-bottom {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 10px 24px;
  margin-top: 16px;
}
.receipt-it-note {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
}
.receipt-disclaimer {
  font-size: 10px;
  color: var(--light);
  margin-top: 4px;
}
.receipt-timestamp {
  font-size: 10px;
  color: var(--light);
  font-family: 'Courier New', monospace;
  margin-top: 3px;
}

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,.6);
  padding: 28px 24px;
  text-align: center;
}
.footer-inner { max-width: 720px; margin: 0 auto; }
.footer-inner h3 {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,.9);
  margin-bottom: 8px;
}
.footer-inner p {
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 12px;
}
.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
  font-size: 12px;
}
.footer-links a {
  color: rgba(255,255,255,.5);
  text-decoration: none;
  transition: color .15s;
}
.footer-links a:hover { color: var(--teal); }
.footer-copy {
  margin-top: 16px;
  font-size: 12px;
  color: rgba(255,255,255,.3);
}

/* ── Print styles ─────────────────────────────────────────────────────────── */
@media print {
  .site-header, .site-footer, .form-panel, .hero,
  .preview-header, .receipt-watermark, .actions { display: none !important; }
  .main { display: block; padding: 0; }
  .preview-panel { position: static; }
  .receipt-wrap { border: none; box-shadow: none; border-radius: 0; }
  body { background: #fff; }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .main {
    grid-template-columns: 1fr;
  }
  .preview-panel { position: static; }
}

@media (max-width: 600px) {
  .header-nav { display: none; }
  .hero { padding: 24px 16px 20px; }
  .main { padding: 16px 14px 40px; gap: 16px; }
  .form-body { padding: 16px; }
  .form-row-2 { grid-template-columns: 1fr; gap: 0; }
  .form-row-2 .form-row { margin-bottom: 14px; }
  .receipt-body { padding: 16px; }
  .receipt-doc-header { padding: 14px 16px; }
  .receipt-footer { padding: 12px 0 0; margin: 0 16px 0; }
  .receipt-bottom { padding: 10px 16px; }
  .paid-stamp { font-size: 18px; padding: 4px 10px; }
  .receipt-title { font-size: 16px; }
  .receipt-label { min-width: 90px; font-size: 10px; }
  .toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
  .batch-row { gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
