/* ===== DevCraft Technologies — Receipt Generator CSS ===== */

/* ── Tokens (same as invoice/quotation) ─────────────────────── */
:root {
  --brand:       #00c896;
  --brand-dark:  #009e77;
  --brand-dim:   #00c89622;
  --brand-border:#00c89633;
  --bg-page:     #0d0d0d;
  --bg-panel:    #111318;
  --bg-input:    #0a0c10;
  --bg-row:      #0f1217;
  --text-white:  #f0f0f0;
  --text-muted:  #888;
  --text-label:  #aaa;
  --doc-bg:      #ffffff;
  --doc-text:    #111111;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Inter", sans-serif;
  background: var(--bg-page);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 60px 20px 30px;
}

#app {
  display: flex;
  flex-direction: column;
  gap: 30px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

/* ===== FORM PANEL ===== */
#form-panel {
  background: var(--bg-panel);
  border: 1px solid var(--brand-border);
  border-radius: 14px;
  padding: 32px;
  width: 100%;
  color: var(--text-white);
}

.form-header h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.5rem;
  color: var(--brand);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.form-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.form-section {
  margin-bottom: 26px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--brand-dim);
}

.form-section:last-child { border-bottom: none; margin-bottom: 0; }

.form-section h3 {
  color: var(--brand);
  font-size: 0.72rem;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  margin-bottom: 16px;
  font-weight: 700;
  font-family: "Space Grotesk", sans-serif;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.form-group label {
  color: var(--text-label);
  font-size: 0.72rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
  background: var(--bg-input);
  border: 1px solid var(--brand-border);
  border-radius: 7px;
  color: var(--text-white);
  padding: 10px 14px;
  font-size: 0.92rem;
  font-family: "Inter", sans-serif;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--brand); }

.form-group select option { background: var(--bg-input); }
.form-group textarea { resize: vertical; }

/* Item rows */
#item-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.item-row {
  display: grid;
  grid-template-columns: 1fr 140px auto;
  gap: 8px;
  align-items: end;
  background: var(--bg-row);
  border: 1px solid var(--brand-border);
  border-radius: 9px;
  padding: 12px;
}

.col-wrap { display: flex; flex-direction: column; gap: 4px; }

.col-wrap label {
  color: var(--text-muted);
  font-size: 0.68rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.col-wrap input {
  background: var(--bg-input);
  border: 1px solid var(--brand-border);
  border-radius: 5px;
  color: var(--text-white);
  padding: 8px 10px;
  font-size: 0.88rem;
  font-family: "Inter", sans-serif;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

.col-wrap input:focus { border-color: var(--brand); }

.btn-remove-row {
  background: #ff444422;
  border: 1px solid #ff444444;
  color: #ff6666;
  border-radius: 5px;
  width: 32px;
  height: 32px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: end;
}

.btn-remove-row:hover { background: #ff444444; }

#btn-add-row,
.btn-add-sub {
  background: transparent;
  border: 1px dashed var(--brand-border);
  color: var(--brand);
  border-radius: 7px;
  padding: 9px 18px;
  font-size: 0.88rem;
  font-family: "Inter", sans-serif;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

#btn-add-row:hover,
.btn-add-sub:hover { background: var(--brand-dim); border-color: var(--brand); }

.ref-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.ref-row input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--brand-border);
  border-radius: 6px;
  color: var(--text-white);
  padding: 10px 14px;
  font-size: 0.92rem;
  font-family: "Inter", sans-serif;
  outline: none;
}

.ref-row input:focus { border-color: var(--brand); }

.ref-row .btn-remove-row {
  width: 32px;
  height: 38px;
  align-self: center;
}

/* Buttons */
.btn-row { display: flex; gap: 12px; margin-bottom: 14px; }

#btn-download {
  flex: 1;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #000;
  border: none;
  border-radius: 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

#btn-download:hover { transform: translateY(-1px); box-shadow: 0 4px 20px #00c89655; }

#btn-print {
  flex: 1;
  padding: 12px 20px;
  background: var(--bg-row);
  border: 1px solid var(--brand-border);
  color: var(--text-white);
  border-radius: 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#btn-print:hover { background: var(--brand-dim); }

.nav-links { display: flex; justify-content: space-between; margin-top: 10px; }

.nav-links a {
  color: var(--text-muted);
  font-size: 0.82rem;
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--brand); }

/* ===== PREVIEW PANEL ===== */
#preview-panel { width: 100%; }

.preview-label {
  color: var(--brand);
  font-size: 0.72rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 12px;
  text-align: center;
  font-weight: 600;
  font-family: "Space Grotesk", sans-serif;
}

/* ===== RECEIPT DOCUMENT ===== */
#receipt {
  background: var(--doc-bg);
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  font-family: "Inter", sans-serif;
  color: var(--doc-text);
  overflow: hidden;
}

#receipt-doc { position: relative; }

/* HEADER */
.rec-header {
  background: #0d1117;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 36px;
  overflow: hidden;
  min-height: 100px;
  border-bottom: 3px solid var(--brand);
}

.rec-header-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
  position: relative;
}

.rec-logo-text {
  font-family: "Space Grotesk", sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.5px;
  line-height: 1;
}

.rec-logo-text span { color: var(--brand); margin-left: 6px; }

.rec-company-tagline {
  color: rgba(255,255,255,0.55);
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  font-style: italic;
}

.rec-header-right {
  text-align: right;
  z-index: 2;
  position: relative;
}

.rec-doc-type {
  font-family: "Space Grotesk", sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: 5px;
  line-height: 1;
}

.rec-doc-number {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.6);
  letter-spacing: 1px;
  margin-top: 4px;
}

.rec-header-diagonal {
  position: absolute;
  right: 0; top: 0;
  width: 180px; height: 100%;
  background: rgba(0, 200, 150, 0.07);
  clip-path: polygon(40% 0, 100% 0, 100% 100%, 0% 100%);
  z-index: 1;
}

/* META: RECEIVED FROM + DATES */
.rec-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px 36px 18px;
  border-bottom: 1px solid #e8e8e8;
  gap: 20px;
}

.rec-meta-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--brand);
  text-transform: uppercase;
  margin-bottom: 6px;
  font-family: "Space Grotesk", sans-serif;
}

.rec-client-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #111;
  margin-bottom: 3px;
  font-family: "Space Grotesk", sans-serif;
}

.rec-client-detail { font-size: 0.9rem; color: #555; line-height: 1.7; }

.rec-dates {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
}

.rec-date-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
}

.rec-date-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #999;
  font-family: "Space Grotesk", sans-serif;
}

.rec-date-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #111;
  min-width: 120px;
  text-align: right;
}

/* TABLE */
.rec-table-wrap { padding: 0 36px; }

.rec-table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }

.rec-table thead tr { background: #0d1117; color: #fff; }

.rec-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-family: "Space Grotesk", sans-serif;
}

.rec-table tbody tr { border-bottom: 1px solid #f0f0f0; }
.rec-table tbody tr:nth-child(even) { background: #f9f9f9; }

.rec-table tbody td { padding: 11px 12px; color: #333; font-size: 1rem; }

.col-no {
  width: 40px;
  text-align: center;
  font-weight: 700;
  color: #009e77;
}

.col-amount {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  width: 160px;
}

/* TOTALS */
.rec-totals {
  padding: 16px 36px;
  display: flex;
  justify-content: flex-end;
  border-top: 2px solid #f0f0f0;
}

.rec-totals-inner { width: 300px; }

.rec-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.88rem;
  color: #444;
}

.rec-total-row span:first-child {
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: "Space Grotesk", sans-serif;
}

.rec-total-row span:last-child {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.rec-total-row.grand {
  background: #0d1117;
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  margin-top: 8px;
  border: none;
  font-size: 1.1rem;
  font-weight: 700;
}

.rec-total-row.grand span:first-child { color: var(--brand) !important; }
.rec-total-row.grand span:last-child { color: #fff !important; font-size: 1rem; }

/* AMOUNT IN WORDS */
.rec-words-bar {
  margin: 0 36px 0;
  padding: 10px 16px;
  background: #f5fffe;
  border-left: 4px solid var(--brand);
  border-bottom: 1px solid #e0f5ef;
}

.rec-words-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #009e77;
  margin-right: 8px;
  font-family: "Space Grotesk", sans-serif;
}

.rec-words-bar span:last-child {
  font-size: 0.88rem;
  color: #333;
  font-style: italic;
}

/* BALANCE ROW */
.rec-balance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 36px 0;
  padding: 8px 16px;
  background: #fff8e1;
  border: 1px solid #f0c14b;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #333;
}

/* NOTES */
.rec-notes-section { margin: 14px 36px 0; }

.rec-notes-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #009e77;
  margin-bottom: 4px;
  font-family: "Space Grotesk", sans-serif;
}

.rec-notes-text { font-size: 0.9rem; color: #555; line-height: 1.6; }

/* SIGNATURE + FOOTER */
.rec-sig-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 16px 36px 20px;
  border-top: 1px solid #eee;
  margin-top: 14px;
  gap: 20px;
}

.rec-sig-block { display: flex; flex-direction: column; gap: 4px; min-width: 180px; }

.rec-sig-line {
  border-bottom: 1.5px solid #111;
  width: 180px;
  margin-bottom: 6px;
}

.rec-sig-name {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: #111;
}

.rec-sig-title { font-size: 0.7rem; color: #888; letter-spacing: 1px; text-transform: uppercase; }

.rec-footer-contact-bar {
  display: flex;
  justify-content: space-between;
  padding: 8px 36px;
  font-size: 0.82rem;
  color: #666;
  border-top: 1px solid #eee;
  gap: 12px;
}

/* FOOTER BAR */
.rec-footer-bar {
  background: #0d1117;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 36px;
  gap: 12px;
}

.rec-footer-bar-left,
.rec-footer-bar-right {
  width: 50px;
  height: 4px;
  background: var(--brand);
  border-radius: 2px;
}

.rec-footer-tel {
  color: rgba(255,255,255,0.75);
  font-size: 0.84rem;
  letter-spacing: 0.5px;
  font-weight: 500;
}

/* ===== COMPANY PROFILE (identical to quotation/invoice) ===== */
#company-profile {
  background: #fff;
  padding: 40px 36px 36px;
  border-top: 3px solid var(--brand);
}

.cp-header { text-align: center; margin-bottom: 28px; }

.cp-badge {
  display: inline-block;
  background: #f0fff9;
  border: 1px solid #00c89666;
  color: #009e77;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 5px 16px;
  border-radius: 20px;
  margin-bottom: 14px;
  text-transform: uppercase;
  font-family: "Space Grotesk", sans-serif;
}

.cp-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.7rem;
  color: #111;
  font-weight: 700;
}

.cp-intro {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
  padding-bottom: 26px;
  border-bottom: 1px solid #e8e8e8;
}

.cp-intro p { font-size: 0.92rem; color: #444; line-height: 1.85; }
.cp-intro strong { color: #111; font-weight: 600; }

.cp-features-header {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #009e77;
  margin-bottom: 18px;
  text-align: center;
  font-family: "Space Grotesk", sans-serif;
}

.cp-features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}

.cp-feature {
  background: #f8f8f8;
  border: 1px solid #ebebeb;
  border-radius: 10px;
  padding: 16px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.cp-feature:hover { border-color: #00c89666; }

.cp-feature-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #111;
  margin-bottom: 5px;
  font-family: "Space Grotesk", sans-serif;
}

.cp-feature-desc { font-size: 0.78rem; color: #555; line-height: 1.6; }

.cp-why-section {
  background: #0d1117;
  border-radius: 12px;
  padding: 24px 28px;
}

.cp-why-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 18px;
  font-family: "Space Grotesk", sans-serif;
}

.cp-why-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.cp-why-item { display: flex; gap: 14px; align-items: flex-start; }

.cp-why-num {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--brand);
  line-height: 1;
  flex-shrink: 0;
  min-width: 28px;
}

.cp-why-text { font-size: 0.82rem; color: rgba(255,255,255,0.7); line-height: 1.6; }

/* ===== PRINT ===== */
@media print {
  .top-nav, #form-panel, .preview-label, .nav-links { display: none !important; }
  body { background: none; padding: 0; }
  @page { size: A4 portrait; margin: 6mm; }
  #app { display: block; }
  #preview-panel { width: 100%; padding: 0; margin: 0; }
  #receipt { width: 100%; max-width: 100%; box-shadow: none; zoom: 0.88; margin: 0; }
  .cp-feature, .cp-why-item { break-inside: avoid !important; page-break-inside: avoid !important; }
  #company-profile { break-before: page !important; page-break-before: always !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  body { padding: 10px 8px; }
  #form-panel { padding: 18px 16px; }

  .item-row { grid-template-columns: 1fr 1fr; gap: 12px; }
  .item-row .btn-remove-row { grid-column: span 2; width: 100%; margin-top: 6px; }

  .btn-row { flex-direction: column; }
  .btn-row button { width: 100% !important; }

  .rec-meta { flex-direction: column; gap: 15px; }
  .rec-dates { text-align: left; min-width: unset; width: 100%; }
  .rec-date-row { justify-content: space-between; }
  .rec-totals-inner { width: 100%; }

  .rec-table-wrap { overflow-x: auto; }
  .rec-words-bar, .rec-balance-row, .rec-notes-section { margin-left: 8px; margin-right: 8px; }
  .rec-sig-footer, .rec-footer-contact-bar { flex-direction: column; gap: 10px; align-items: flex-start; }

  input, select, textarea { font-size: 16px !important; }

  .cp-features-grid, .cp-why-grid { grid-template-columns: 1fr; }
  #company-profile { padding: 24px 16px; }
  .cp-title { font-size: 1.3rem; }
}