/* ==========================================================================
   Featuron Engineering - Tax Invoice Report Styling
   A4 Portrait Dimensions & Print Calibration
   ========================================================================== */

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

body {
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 11px;
  color: #1a202c;
  background: #e2e8f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  min-height: 100vh;
}

/* Floating Toolbar */
.tools {
  width: 210mm;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}

.tools button, .tools a {
  background: #047A3D;
  color: #fff;
  border: none;
  padding: 7px 14px;
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: background 0.15s ease;
}

.tools button:hover, .tools a:hover {
  background: #036130;
}

.tools .btn-secondary {
  background: #475569;
}
.tools .btn-secondary:hover {
  background: #334155;
}

/* A4 Printable Sheet */
.page {
  width: 210mm;
  min-height: 297mm;
  background: #fff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 10mm 12mm;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.content-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #047A3D;
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.logo {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 38px;
  font-weight: 800;
  color: #047A3D;
  line-height: 0.9;
  letter-spacing: -0.5px;
}

.logo .dot {
  color: #6FB426;
}

.tagline {
  font-family: 'Poppins', sans-serif;
  font-size: 8px;
  font-weight: 600;
  color: #4a5568;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 2px;
}

.tech {
  font-family: 'Poppins', sans-serif;
  font-size: 6.5px;
  font-weight: 700;
  color: #718096;
  text-align: center;
  line-height: 1.25;
  letter-spacing: 1px;
}

.contact {
  font-size: 9px;
  font-weight: 500;
  text-align: right;
  line-height: 1.35;
  color: #2d3748;
}

.contact-line {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.contact-line input {
  font-family: inherit;
  font-size: 9px;
  font-weight: 600;
  border: none;
  background: transparent;
  text-align: right;
  width: 140px;
}

.icon {
  width: 11px;
  height: 11px;
  fill: #047A3D;
  flex-shrink: 0;
}

/* Banner */
.banner-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #047A3D;
  color: #fff;
  padding: 3px 10px;
  margin-bottom: 6px;
}

.banner-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.banner-badge {
  font-size: 9px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: uppercase;
}

/* Document Meta */
.meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 4px;
  margin-bottom: 8px;
  font-size: 10px;
}

.meta input {
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  border: none;
  border-bottom: 1px dashed #cbd5e1;
  padding: 1px 3px;
  background: transparent;
}

/* Date picker component */
.date-field {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.date-display {
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  border: none;
  border-bottom: 1px dashed #cbd5e1;
  background: transparent;
  width: 75px;
}

.date-picker-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.calendar-button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 1px 2px;
  display: inline-flex;
  align-items: center;
}

.calendar-button svg {
  width: 12px;
  height: 12px;
  fill: #047A3D;
}

/* Grid Boxes */
.grid2 {
  display: grid;
  grid-template-columns: 1.18fr 0.82fr;
  gap: 8px;
  margin-bottom: 8px;
}

.box {
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 6px 8px;
}

.box h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #047A3D;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 3px;
}

.field-row {
  display: flex;
  align-items: center;
  margin-bottom: 3px;
  font-size: 10px;
}

.field-row label {
  width: 95px;
  font-weight: 600;
  color: #475569;
  flex-shrink: 0;
}

.field-row input, .field-row textarea {
  flex: 1;
  font-family: inherit;
  font-size: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  padding: 2px 5px;
  color: #1e293b;
  background: #f8fafc;
}

.field-row input:focus, .field-row textarea:focus {
  background: #fff;
  border-color: #047A3D;
  outline: none;
}

/* Mandatory GSTIN Highlight for Tax Invoicing */
.field-row-gstin {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 4px;
  padding: 3px 6px;
  margin: 4px 0;
}

.field-row-gstin label {
  color: #92400e;
  font-weight: 800;
}

.badge-mandatory {
  font-size: 8px;
  background: #dc2626;
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-left: 2px;
}

.gstin-input {
  font-weight: 700 !important;
  color: #78350f !important;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Items Table */
.items-section {
  margin-bottom: 8px;
}

.items-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.items-header-bar h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #047A3D;
  text-transform: uppercase;
}

.btn-add-item {
  background: #047A3D;
  color: #fff;
  border: none;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
}

table.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9.5px;
}

table.inv-table th {
  background: #047A3D;
  color: #fff;
  font-weight: 700;
  padding: 4px 6px;
  border: 1px solid #047A3D;
  text-align: left;
}

table.inv-table td {
  border: 1px solid #cbd5e1;
  padding: 3px 5px;
  vertical-align: middle;
}

table.inv-table tr:nth-child(even) {
  background: #f8fafc;
}

table.inv-table input {
  width: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 9.5px;
  color: #1e293b;
  padding: 1px;
}

table.inv-table input.num-val {
  text-align: right;
  font-weight: 600;
}

.btn-del-row {
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 12px;
  padding: 0 4px;
}

/* Banking & Financial Summary Split */
.summary-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 8px;
  margin-bottom: 8px;
}

.bank-box {
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 9.5px;
}

.bank-box h4 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #047A3D;
  text-transform: uppercase;
  margin-bottom: 4px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 2px;
}

.bank-row {
  display: flex;
  margin-bottom: 3px;
  align-items: center;
}

.bank-row label {
  width: 85px;
  font-weight: 600;
  color: #475569;
  flex-shrink: 0;
}

.bank-row input {
  flex: 1;
  font-family: inherit;
  font-size: 9.5px;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  padding: 2px 4px;
  background: #f8fafc;
}

.calc-box {
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 6px 8px;
  background: #f8fafc;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  padding: 2px 0;
  border-bottom: 1px dashed #e2e8f0;
}

.calc-row:last-child {
  border-bottom: none;
}

.calc-label {
  font-weight: 600;
  color: #475569;
}

.calc-val {
  font-weight: 700;
  color: #0f172a;
  text-align: right;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 10px;
  width: 90px;
}

.calc-total-row {
  background: #e6f4ea;
  margin: 3px -8px -6px -8px;
  padding: 6px 8px;
  border-radius: 0 0 4px 4px;
  border-top: 1px solid #047A3D;
}

.calc-total-row .calc-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: #047A3D;
  text-transform: uppercase;
}

.calc-total-row .calc-val {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  font-weight: 800;
  color: #047A3D;
}

/* Amount in Words Bar */
.words-bar {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-left: 3px solid #047A3D;
  padding: 4px 8px;
  margin-bottom: 8px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 10px;
}

.words-bar label {
  font-weight: 700;
  color: #047A3D;
  white-space: nowrap;
}

.words-bar input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  color: #0f172a;
  font-style: italic;
}

/* Signatures */
.sig-row {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  margin-bottom: 6px;
}

.sig-box {
  width: 45%;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 6px 8px;
  text-align: center;
}

.sig-title {
  font-size: 10px;
  font-weight: 700;
  color: #047A3D;
  text-transform: uppercase;
  margin-bottom: 25px;
}

.sig-line {
  border-top: 1px solid #94a3b8;
  margin: 0 20px 4px 20px;
}

.sig-name {
  font-size: 9.5px;
  font-weight: 600;
  border: none;
  background: transparent;
  text-align: center;
  width: 100%;
}

/* Footer: Exact Parity with Service Report */
.footer {
  border-top: 1px solid #cbd5e1;
  padding-top: 4px;
  margin-top: auto;
  font-size: 8px;
  color: #475569;
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.footer-row .flogo {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 800;
  color: #047A3D;
}

.footer-row .flogo .dot {
  color: #6FB426;
}

.footer-row input {
  font-family: inherit;
  font-size: 8px;
  border: none;
  background: transparent;
  color: #1e293b;
  font-weight: 600;
}

.footer-address {
  width: 280px;
  text-align: center;
}

/* Print Optimization */
@media print {
  body {
    background: #fff;
    padding: 0;
  }
  .tools {
    display: none !important;
  }
  .page {
    border: none;
    box-shadow: none;
    padding: 8mm 10mm;
    min-height: 297mm;
    page-break-after: avoid;
  }
  input, textarea, select {
    border: none !important;
    background: transparent !important;
  }
  .btn-add-item, .btn-del-row, .calendar-button {
    display: none !important;
  }
  th.col-action, td.col-action {
    display: none !important;
  }
}
