/* ==========================================================================
   InvoiceGen Pro — Invoice Sheet & Templates Styles
   Supports 4 Templates: Professional, Modern, Classic, Minimal
   Full Print & PDF Optimization
   ========================================================================== */

:root {
  --invoice-accent: #2563EB;
  --invoice-accent-light: #EFF6FF;
  --invoice-accent-text: #FFFFFF;
}

/* ==========================================================================
   Invoice Paper Dimensions (A4 Ratio Standard)
   ========================================================================== */
.invoice-sheet {
  width: 100%;
  max-width: 800px;
  min-height: 1050px;
  background-color: #FFFFFF !important;
  color: #1E293B !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  padding: 48px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.45;
  transition: all 0.2s ease;
}

/* Base Invoice Typography & Common Elements */
.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.inv-brand {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 55%;
}

.inv-logo-img {
  max-height: 65px;
  max-width: 200px;
  object-fit: contain;
  object-position: left;
  display: block;
}

.inv-company-name {
  font-size: 20px;
  font-weight: 800;
  color: #0F172A;
  line-height: 1.2;
}

.inv-company-details, .inv-customer-details {
  font-size: 12px;
  color: #475569;
  line-height: 1.45;
}

.inv-meta {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.inv-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--invoice-accent);
  margin-bottom: 6px;
}

.inv-number {
  font-size: 15px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 4px;
}

.inv-badge-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.inv-dates-grid {
  font-size: 12px;
  color: #64748B;
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 12px;
  text-align: right;
}

.inv-dates-grid strong {
  color: #1E293B;
}

/* Bill To & Metadata Section */
.inv-details-section {
  display: flex;
  justify-content: space-between;
  padding: 16px 0;
  margin-bottom: 20px;
  border-top: 1px solid #E2E8F0;
  border-bottom: 1px solid #E2E8F0;
  gap: 20px;
}

.inv-details-col {
  flex: 1;
}

.inv-details-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--invoice-accent);
  margin-bottom: 6px;
}

.inv-customer-name {
  font-size: 15px;
  font-weight: 700;
  color: #0F172A;
  margin-bottom: 2px;
}

/* Products Table */
.inv-table-wrap {
  width: 100%;
  margin-bottom: 24px;
}

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

.inv-table th {
  padding: 10px 8px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid #CBD5E1;
}

.inv-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #E2E8F0;
  vertical-align: top;
}

.inv-col-item { width: 38%; }
.inv-col-qty { width: 10%; text-align: center; }
.inv-col-price { width: 14%; text-align: right; }
.inv-col-disc { width: 12%; text-align: right; }
.inv-col-tax { width: 10%; text-align: right; }
.inv-col-total { width: 16%; text-align: right; font-weight: 700; }

.inv-item-title {
  font-weight: 600;
  color: #0F172A;
}

.inv-item-desc {
  font-size: 11px;
  color: #64748B;
  margin-top: 2px;
}

/* Bottom Calculation Summary & Payment Info */
.inv-bottom-section {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  margin-bottom: 24px;
}

.inv-payment-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 14px;
  font-size: 12px;
}

.inv-payment-title {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--invoice-accent);
  margin-bottom: 8px;
}

.inv-payment-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.inv-notes-box {
  margin-top: 12px;
  font-size: 11.5px;
  color: #475569;
}

.inv-notes-title {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  color: #334155;
  margin-bottom: 3px;
}

/* Calculation Breakdown */
.inv-summary-table {
  width: 100%;
  font-size: 12.5px;
}

.inv-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  color: #475569;
}

.inv-summary-row.bold {
  font-weight: 700;
  color: #0F172A;
}

.inv-summary-row.grand-total {
  border-top: 2px solid var(--invoice-accent);
  border-bottom: 2px solid var(--invoice-accent);
  padding: 8px 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--invoice-accent);
  margin: 6px 0;
}

.inv-summary-row.due {
  color: #DC2626;
  font-weight: 700;
  font-size: 13.5px;
  padding-top: 4px;
}

/* Footer / Terms */
.inv-footer {
  border-top: 1px solid #E2E8F0;
  padding-top: 14px;
  font-size: 11px;
  color: #64748B;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inv-terms-title {
  font-weight: 700;
  color: #334155;
  margin-bottom: 2px;
}

.inv-thankyou {
  text-align: center;
  font-weight: 600;
  color: var(--invoice-accent);
  margin-top: 8px;
  font-size: 12px;
}

/* ==========================================================================
   TEMPLATE 1: PROFESSIONAL (Standard corporate with solid header band)
   ========================================================================== */
.template-professional {
  border-top: 8px solid var(--invoice-accent);
}

.template-professional .inv-table th {
  background-color: var(--invoice-accent);
  color: var(--invoice-accent-text);
  border-bottom: none;
}

.template-professional .inv-details-section {
  background: #F8FAFC;
  padding: 14px 18px;
  border-radius: 6px;
  border: 1px solid #E2E8F0;
}

/* ==========================================================================
   TEMPLATE 2: MODERN (Sleek, bold headings, pill status, minimal lines)
   ========================================================================== */
.template-modern {
  border-left: 6px solid var(--invoice-accent);
}

.template-modern .inv-title {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.template-modern .inv-table th {
  background-color: var(--invoice-accent-light);
  color: var(--invoice-accent);
  border-bottom: 2px solid var(--invoice-accent);
}

.template-modern .inv-summary-row.grand-total {
  background: var(--invoice-accent-light);
  padding: 10px 12px;
  border-radius: 6px;
  border: none;
}

.template-modern .inv-payment-box {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
}

/* ==========================================================================
   TEMPLATE 3: CLASSIC (Traditional shopkeeper format, double borders, formal)
   ========================================================================== */
.template-classic {
  border: 2px solid #334155;
  padding: 40px;
}

.template-classic .inv-title {
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 26px;
  border-bottom: 2px solid var(--invoice-accent);
  padding-bottom: 4px;
}

.template-classic .inv-table th {
  border-top: 2px solid #0F172A;
  border-bottom: 2px solid #0F172A;
  background: transparent;
  color: #0F172A;
}

.template-classic .inv-table td {
  border-bottom: 1px dotted #94A3B8;
}

.template-classic .inv-summary-row.grand-total {
  border-top: 1px solid #0F172A;
  border-bottom: 3px double #0F172A;
  color: #0F172A;
}

/* ==========================================================================
   TEMPLATE 4: MINIMAL (Ultra clean, light whitespace, hairline dividers)
   ========================================================================== */
.template-minimal {
  box-shadow: none;
  border: 1px solid #E2E8F0;
  padding: 44px;
}

.template-minimal .inv-title {
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.15em;
  color: #0F172A;
}

.template-minimal .inv-table th {
  font-weight: 600;
  color: #94A3B8;
  border-bottom: 1px solid #CBD5E1;
  background: transparent;
}

.template-minimal .inv-table td {
  border-bottom: 1px solid #F1F5F9;
}

.template-minimal .inv-details-section {
  border-top: none;
  border-bottom: 1px solid #F1F5F9;
  padding: 10px 0 20px;
}

.template-minimal .inv-summary-row.grand-total {
  border-top: 1px solid #0F172A;
  border-bottom: 1px solid #0F172A;
  color: #0F172A;
}

.template-minimal .inv-payment-box {
  background: transparent;
  border: 1px dashed #CBD5E1;
}

/* ==========================================================================
   Print Stylesheet (@media print)
   Hides web UI, forces exact A4 layout, prevents page cuts
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  html, body {
    background: #FFFFFF !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 12pt;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Hide all website chrome, headers, editors, navigation, ads, modals */
  .site-header,
  .hero-compact,
  .quick-toolbar,
  .customization-box,
  .editor-card,
  .preview-toolbar,
  .ad-container,
  .content-section,
  .site-footer,
  .modal-backdrop,
  .toast-container,
  .view-toggle-tabs,
  .skip-link {
    display: none !important;
  }

  /* Reset workspace layout to full width */
  .generator-workspace {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .preview-sticky-wrap {
    position: static !important;
    top: 0 !important;
  }

  .invoice-preview-viewport {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    overflow: visible !important;
    max-height: none !important;
    display: block !important;
  }

  .invoice-sheet {
    max-width: 100% !important;
    width: 100% !important;
    min-height: auto !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    page-break-after: avoid;
  }

  .inv-table {
    page-break-inside: auto;
  }

  .inv-table tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  .inv-bottom-section {
    page-break-inside: avoid;
  }

  .inv-footer {
    page-break-inside: avoid;
  }
}
