@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #0f172a;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--gray-800);
  background-color: #f1f5f9;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

.hidden {
  display: none !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--gray-100);
}
::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* Screen Preview Container */
.preview-stage {
  background-color: #475569;
  padding: 16px;
  border-radius: 12px;
  overflow: auto;
  max-height: calc(100vh - 140px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* A4 Sheet Dimensions on Screen (210mm x 297mm) */
.invoice-paper-preview {
  width: 210mm;
  min-height: 297mm;
  max-width: 210mm;
  padding: 8mm 8mm;
  margin: 0 auto;
  background: white;
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.3), 0 5px 15px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
  font-size: 10px;
  line-height: 1.3;
  color: #0f172a;
  position: relative;
  transform-origin: top center;
  transition: transform 0.2s ease;
}

/* Table styling for GST rules */
.gst-table {
  width: 100%;
  border-collapse: collapse;
}

.gst-table th, .gst-table td {
  border: 1px solid #94a3b8;
  padding: 3px 4px;
  vertical-align: middle;
}

.gst-table th {
  background-color: #f1f5f9;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
  font-size: 9.5px;
}

.gst-box-border {
  border: 1.5px solid #334155;
}

.gst-box-header {
  background-color: #f1f5f9;
  font-weight: 700;
  padding: 2px 6px;
  border-bottom: 1.5px solid #334155;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Badge colors */
.badge-b2b {
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}
.badge-b2c {
  background-color: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #e9d5ff;
}

/* Strict A4 Print Formatting */
@media print {
  @page {
    size: A4 portrait;
    margin: 5mm;
  }
  
  html, body {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
    font-size: 9.5px !important;
  }
  
  /* Hide all non-printable chrome */
  .no-print, header, nav, .tab-btn, .toolbar, #loginView, #invoicesView, #companiesView, #customersView, #productsView, #gstr1View, #viewInvoiceModal, #companyModal, #customerModal, #productModal {
    display: none !important;
  }
  
  main {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  #generatorView {
    display: block !important;
  }

  .grid {
    display: block !important;
  }

  .xl\:col-span-6 {
    width: 100% !important;
    max-width: 100% !important;
  }

  .sticky {
    position: static !important;
  }

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

  .invoice-paper-preview {
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
    transform: none !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
  }

  .gst-box-border {
    border: 1.2px solid #000 !important;
  }

  .gst-table th, .gst-table td {
    border: 1px solid #475569 !important;
    padding: 2.5px 3.5px !important;
  }

  /* Force background color rendering in print */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}
