/* ==========================================================================
   NEXUSNEST DUAL STYLESHEET: TAX INVOICE & DEDICATED PAYMENT RECEIPT
   ========================================================================== */

:root {
  --nn-green: #74a42b;
  --nn-green-dark: #557c1c;
  --nn-green-light: #f2f8eb;
  --nn-dark: #1e1e24;
  --nn-border: #23232c;
  --nn-border-light: #cbd5e1;
  --nn-gray-bg: #f8fafc;
  --nn-text: #0f172a;
  --nn-muted: #475569;
}

/* 794px = Standard A4 width at 96 DPI */
.invoice-paper {
  width: 794px;
  min-height: 1123px;
  background: #ffffff;
  color: var(--nn-text);
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0 auto;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.35);
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  font-size: 13.5px;
  line-height: 1.45;
  overflow: hidden;
  background-color: #ffffff;
}

/* --------------------------------------------------------------------------
   1. SHARED HEADER & BANNER
   -------------------------------------------------------------------------- */
.inv-top-banner {
  background-color: var(--nn-dark);
  color: #ffffff;
  text-align: center;
  padding: 26px 20px 20px 20px;
}

.inv-top-banner h1 {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.1;
  color: #ffffff;
}

.inv-top-banner .udyam-subtitle {
  font-size: 13.5px;
  font-weight: 700;
  color: #e2e8f0;
  margin-top: 6px;
  letter-spacing: 0.04em;
}

.inv-green-stripe {
  height: 12px;
  background-color: var(--nn-green);
  width: 100%;
}

.inv-body-container {
  padding: 28px 40px 20px 40px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* --------------------------------------------------------------------------
   2. INVOICE MODE: META STACK
   -------------------------------------------------------------------------- */
.inv-meta-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
  max-width: 440px;
}

.inv-meta-row {
  display: flex;
  flex-direction: column;
}

.inv-meta-line {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--nn-text);
  padding-bottom: 4px;
  white-space: nowrap;
}

.inv-meta-divider {
  height: 1.5px;
  background-color: #cbd5e1;
  width: 100%;
}

.inv-location-line {
  font-size: 13px;
  font-weight: 700;
  color: var(--nn-text);
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   3. ITEMS TABLE (SHARED)
   -------------------------------------------------------------------------- */
.inv-table-wrapper {
  margin-bottom: 22px;
  width: 100%;
}

.inv-table-exact {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: center;
}

.inv-table-exact thead th {
  background-color: var(--nn-green);
  color: #111111;
  font-size: 13px;
  font-weight: 800;
  padding: 11px 10px;
  border-top: 1.5px solid var(--nn-border);
  border-bottom: 1.5px solid var(--nn-border);
  border-right: 1.5px solid var(--nn-border);
  letter-spacing: 0.02em;
}

.inv-table-exact thead th:first-child {
  border-left: 1.5px solid var(--nn-border);
}

/* Minute space separating the header row from the content rows */
.inv-table-exact tbody::before {
  content: '';
  display: table-row;
  height: 5px;
}

.inv-table-exact tbody td {
  padding: 12px 10px;
  border-top: 1.5px solid var(--nn-border);
  border-bottom: 1.5px solid var(--nn-border);
  border-right: 1.5px solid var(--nn-border);
  font-size: 13px;
  font-weight: 700;
  color: #111111;
  background: #ffffff;
}

.inv-table-exact tbody td:first-child {
  border-left: 1.5px solid var(--nn-border);
}

.inv-table-exact tbody tr:not(:first-child) td {
  border-top: none;
}

/* Strict single line date */
.inv-table-exact .col-date, 
.inv-table-exact td.td-date {
  width: 140px;
  min-width: 135px;
  white-space: nowrap !important;
  text-align: center;
}

.inv-table-exact .col-desc { width: 40%; }
.inv-table-exact .td-desc { text-align: center; font-weight: 800; }
.inv-table-exact .col-price { width: 15%; }
.inv-table-exact .col-qty { width: 10%; }
.inv-table-exact .col-total { width: 18%; }

/* --------------------------------------------------------------------------
   4. MIDDLE SECTION: DETAILS VS TOTAL
   -------------------------------------------------------------------------- */
.inv-middle-section {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 24px;
  margin-bottom: 26px;
  align-items: start;
}

.inv-details-block {
  padding: 0;
  background: transparent;
}

.inv-details-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #111111;
  margin-bottom: 2px;
}

.inv-deliverables-text {
  font-size: 12.5px;
  font-weight: 600;
  color: #242424;
  white-space: pre-line;
  line-height: 1.55;
}

.inv-total-box-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inv-total-box-exact {
  width: 100%;
  background-color: var(--nn-gray-bg);
  border: 1.5px solid var(--nn-border);
  border-radius: 4px;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 800;
  color: #111111;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.inv-words-note {
  font-size: 11px;
  color: var(--nn-muted);
  font-style: italic;
  padding: 0 4px;
}

/* --------------------------------------------------------------------------
   5. BOTTOM SECTION (INVOICE MODE: BANK & QR)
   -------------------------------------------------------------------------- */
.inv-bottom-section-exact {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 26px;
  margin-top: auto;
  align-items: end;
  padding-bottom: 8px;
}

.inv-bottom-section-exact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-top: auto;
  align-items: end;
  padding-bottom: 6px;
}

.inv-bottom-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 8px;
}

.inv-brand-thankyou-group {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-bottom: 2px;
}

.inv-logo-badge {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.14);
  margin: 0 auto 5px auto;
  display: block;
}

.inv-thank-you-exact {
  font-size: 23px;
  font-weight: 800;
  color: #111111;
  letter-spacing: -0.02em;
  text-align: center;
  margin: 0;
}

.inv-contact-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  text-align: left;
}

.inv-contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: #111111;
}

.inv-contact-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: var(--nn-green);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.inv-contact-icon svg {
  width: 12px;
  height: 12px;
  fill: #ffffff;
}

.inv-bottom-right {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* Elevated Payment & Bank card (Invoice mode) */
.inv-payment-card-elevated {
  border: 1.5px solid var(--nn-border);
  border-radius: 6px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.inv-payment-card-header {
  background: var(--nn-dark);
  color: #ffffff;
  padding: 6px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.inv-payment-card-header .upi-tag {
  background: var(--nn-green);
  color: #ffffff;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10px;
}

.inv-payment-card-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.inv-qr-code-exact {
  width: 100px;
  height: 100px;
  object-fit: contain;
  background: #ffffff;
}

.inv-bank-table-exact {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  font-weight: 800;
}

.inv-bank-table-exact tr {
  border-top: 1px solid #e2e8f0;
}

.inv-bank-table-exact td {
  padding: 4px 6px;
  color: #111111;
  white-space: nowrap;
}

.inv-bank-table-exact td:first-child {
  width: 44%;
  color: var(--nn-muted);
}

.inv-legal-notice {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  padding: 10px 10px 4px 10px;
}

.inv-bottom-green-footer {
  height: 12px;
  background-color: var(--nn-green);
  width: 100%;
  margin-top: auto;
}

/* ==========================================================================
   MODE SWITCHING: INVOICE vs PAYMENT RECEIPT
   ========================================================================== */

/* Default (Invoice Mode) */
.receipt-only-view {
  display: none !important;
}
.invoice-only-view {
  display: flex !important;
}

/* Receipt Mode Overrides */
.invoice-paper.receipt-mode .receipt-only-view {
  display: block !important;
}
.invoice-paper.receipt-mode .receipt-master-card.receipt-only-view {
  display: block !important;
}
.invoice-paper.receipt-mode .inv-bottom-right.receipt-only-view {
  display: flex !important;
}
.invoice-paper.receipt-mode .invoice-only-view {
  display: none !important;
}

.invoice-paper.receipt-mode .receipt-stamp-pill {
  display: inline-flex !important;
}

.invoice-paper.receipt-mode .inv-top-banner {
  background: linear-gradient(135deg, #132415 0%, #1e1e24 100%);
  border-bottom: 2px solid var(--nn-green);
}

.receipt-stamp-pill {
  display: none;
  align-items: center;
  gap: 6px;
  background: rgba(116, 164, 43, 0.25);
  border: 1.5px solid var(--nn-green);
  color: #bbf7d0;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 14px;
  border-radius: 999px;
  margin-bottom: 6px;
}

/* Modern Payment Receipt Hero & Details Card */
.receipt-master-card {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 20px;
}

.receipt-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1.5px solid #e2e8f0;
  margin-bottom: 12px;
}

.receipt-badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--nn-green-dark);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.receipt-badge-status .dot-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--nn-green);
}

.receipt-paid-amount-tag {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
}

.receipt-paid-amount-tag span {
  color: var(--nn-green-dark);
  font-size: 15px;
}

.receipt-details-matrix {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.receipt-matrix-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.receipt-matrix-cell.span-2 {
  grid-column: span 2;
}

.receipt-matrix-cell .cell-label {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.receipt-matrix-cell .cell-value {
  font-size: 12px;
  font-weight: 800;
  color: #0f172a;
  word-break: break-word;
}

.receipt-matrix-cell .text-success {
  color: var(--nn-green-dark) !important;
}

/* Receipt Bottom Voucher Card */
.receipt-voucher-card {
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  justify-content: space-between;
}

.voucher-title {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--nn-green-dark);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 4px;
}

.voucher-rows {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10.5px;
}

.voucher-row {
  display: flex;
  justify-content: space-between;
  color: #334155;
}

.voucher-row strong {
  color: #0f172a;
  font-weight: 700;
}

.voucher-auth-box {
  background: var(--nn-green-light);
  border: 1.5px dashed var(--nn-green);
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.voucher-auth-box .auth-tick {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--nn-green);
  color: #ffffff;
  font-weight: 900;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.auth-stamp-heading {
  font-size: 9.5px;
  font-weight: 900;
  color: var(--nn-green-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auth-stamp-sub {
  font-size: 8px;
  font-weight: 600;
  color: #4b5563;
}

/* ==========================================================================
   PRINT SPECIFIC STYLES (Print ONLY #invoice-render-sheet with exact colors)
   ========================================================================== */
@media print {
  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  html, body {
    width: 210mm !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    overflow: visible !important;
  }

  /* Hide all dashboard navigation, editor, modals, and other tabs */
  .sidebar,
  .topbar,
  .editor-pane,
  .preview-toolbar,
  .toast-container,
  .modal-backdrop,
  .zoom-controls,
  #tab-invoices,
  #tab-clients,
  #tab-settings,
  #tab-database,
  .tab-content:not(#tab-studio) {
    display: none !important;
    visibility: hidden !important;
  }

  /* Reset layout constraints on studio pane */
  .app-container,
  .main-content,
  #tab-studio,
  .studio-grid,
  .preview-pane,
  .preview-viewport-outer,
  .preview-viewport-inner {
    display: block !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    transform: none !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
  }

  /* Target sheet */
  #invoice-render-sheet {
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    width: 210mm !important;
    min-height: 297mm !important;
    margin: 0 auto !important;
    padding: 0 !important;
    background-color: #ffffff !important;
    box-shadow: none !important;
    transform: none !important;
    page-break-inside: avoid !important;
    page-break-after: avoid !important;
  }

  @page {
    size: A4 portrait;
    margin: 0;
  }
}
