/* ========== Modern Invoice UI (Clean) ========== */
:root {
  --bg: #0b1220;
  --paper: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.12);
  --line-strong: rgba(15, 23, 42, 0.20);

  --brand: #2563eb;
  --brand-2: #7c3aed;

  --radius: 14px;
  --shadow: 0 10px 30px rgba(2, 6, 23, 0.16);
  --shadow-soft: 0 8px 18px rgba(2, 6, 23, 0.10);
}

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Calibri", sans-serif;
}

html,
body {
  background:
    radial-gradient(1100px 650px at 20% 0%, rgba(37, 99, 235, 0.22), transparent 60%),
    radial-gradient(900px 600px at 90% 10%, rgba(124, 58, 237, 0.18), transparent 55%),
    linear-gradient(180deg, #070b14, var(--bg));
  color: var(--ink);
}

.app-header {
  position: sticky;
  margin-bottom: 18px;
  top: 0;
  z-index: 999;
  backdrop-filter: blur(10px);
  background: rgba(6, 10, 24, 0.55);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 26px;
  display: flex;
  align-items: center;
  border-radius: 16px;
  box-sizing: border-box;
  justify-content: space-between;
  gap: 16px;
}

.nav-left {
  display: flex;
  align-items: center;
  font-weight: 700;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-link,
.nav-link:visited {
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  transition: 0.15s ease;
  font-weight: 500;
}

.nav-link:hover {
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.nav-active {
  color: #ffffff;
  background: rgba(120, 110, 255, 0.18);
  border-color: rgba(120, 110, 255, 0.35);
}

.nav-logout {
  appearance: none;
  border: 6px none;
  padding: 10px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;

  color: #fff;
  background: linear-gradient(135deg, #6f7bff 0%, #5865f2 55%, #4b5bff 100%);

  box-shadow:
    0 10px 22px rgba(88, 101, 242, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);

  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.nav-logout:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow:
    0 14px 28px rgba(88, 101, 242, 0.40),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.nav-logout:active {
  transform: translateY(0);
  filter: brightness(0.98);
  box-shadow:
    0 8px 16px rgba(88, 101, 242, 0.30),
    inset 0 2px 8px rgba(0, 0, 0, 0.18);
}

.nav-logout:focus-visible {
  outline: 3px solid rgba(111, 123, 255, 0.45);
  outline-offset: 3px;
}

/* gap below navbar */
.app-header {
  margin-bottom: 18px;
}


/* App container */
.main-container {
  width: min(1100px, calc(100% - 32px));
  margin: 22px auto;
  background: var(--paper);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Top strip */
.header {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.10), rgba(124, 58, 237, 0.08));
  border-bottom: 1px solid var(--line);
}

/* Title */
.title {
  padding: 14px 18px;
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: 16px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.02), transparent);
}

.title p {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.title p::before,
.title p::after {
  content: "";
  width: 46px;
  height: 2px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 999px;
  opacity: 0.9;
}

/* Input styling */
.input-1 {
  border: 1px solid transparent !important;
  outline: none;
  width: fit-content;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--ink);
  background: rgba(2, 6, 23, 0.03);
  transition: 160ms ease;
  min-height: 38px;
}

.input-1:hover {
  background: rgba(2, 6, 23, 0.05);
}

.input-1:focus {
  background: #fff;
  border-color: rgba(37, 99, 235, 0.45) !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

/* Party spacing helpers */
.party-name,
.party-address {
  margin-bottom: 10px;
  gap: 10px;
  padding: 0 10px;
  align-items: center;
  display: flex;
}

/* Textarea */
.address-textarea {
  width: 70%;
  font-size: 14px;
  font-weight: 500;
  min-height: 45px;
  padding: 10px;
  resize: none;
  overflow: hidden;
  line-height: 1.4;
}

/* Field layouts */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.field-label {
  font-size: 14px;
  margin-bottom: 1px;
}

.field-input {
  width: 100%;
  line-height: 0.5;
}

/* Dates */
.date-row {
  display: grid;
  grid-template-columns: 130px auto;
  align-items: center;
  column-gap: 8px;
}

.date-label {
  font-size: 14px;
  white-space: nowrap;
  line-height: 0.5;
  margin-bottom: 10px;
}

.date-input {
  width: 100%;
  font-weight: normal;
  margin-bottom: 10px;
}

/* Invoice no/date blocks */
.top-field {
  display: flex;
  flex-direction: column;
}

.top-label {
  font-weight: 800;
  font-size: 18px;
  line-height: 0.9;
  margin-bottom: 10px;
}

.top-input {
  width: 100%;
  height: 6px;
  padding: 10px 14px;
  margin-bottom: 10px;
}

.top-input[type="date"] {
  height: 6px;
}

/* Items section */
.items-section {
  padding: 14px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Table */
#itemsTable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

#itemsTable thead th {
  position: sticky;
  top: 0;
  z-index: 1;

  padding: 12px 10px !important;
  font-size: 12px;
  font-weight: 700;

  text-transform: uppercase;
  letter-spacing: 0.10em;

  /* OLD LOOK: bright header text */
  color: rgba(255, 255, 255, 0.92) !important;
  opacity: 1 !important;

  /* Dark header background like old */
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.55), rgba(2, 6, 23, 0.35)) !important;

  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;

  /* crispness */
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45) !important;
}

#itemsTable td {
  padding: 10px !important;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

#itemsTable tbody tr:nth-child(even) {
  background: rgba(2, 6, 23, 0.015);
}

#itemsTable tbody tr:hover {
  background: rgba(37, 99, 235, 0.06);
}

#itemsTable tbody tr:last-child td {
  border-bottom: none;
}

#itemsTable .input-1 {
  width: 100%;
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(15, 23, 42, 0.10) !important;
}

#itemsTable .input-1:focus {
  border-color: rgba(37, 99, 235, 0.50) !important;
}

.gross {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* Add Item button: real button, not 2008 Excel energy */
#addRowBtn {
  align-self: flex-start;
  border: 0;
  padding: 10px 14px !important;
  border-radius: 12px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.20);
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

#addRowBtn:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.26);
}

#addRowBtn:active {
  transform: translateY(0px);
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.18);
}

/* Totals emphasis */
#totalAmount,
#cgst,
#sgst,
#igst,
#totalGST,
#grandTotal {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

#gstWords,
#amountWords {
  color: rgba(15, 23, 42, 0.88);
  font-size: 14px;
  line-height: 1.4;
}

/* inline border normalization */
div[style*="border: 1px solid"] {
  border-color: var(--line-strong) !important;
}

/* ===== Force Dark Mode (no toggle) ===== */
html[data-theme="dark"] {
  --bg: #070b14;
  --paper: #0b1220;
  --ink: #e5e7eb;
  --muted: #94a3b8;
  --line: rgba(226, 232, 240, 0.12);
  --line-strong: rgba(226, 232, 240, 0.20);
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 10px 22px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] body {
  color: var(--ink);
}

html[data-theme="dark"] .input-1,
html[data-theme="dark"] textarea,
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="date"] {
  background: #0b1220 !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
}

html[data-theme="dark"] .input-1::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

html[data-theme="dark"] .input-1:focus,
html[data-theme="dark"] textarea:focus {
  background: #0b1220 !important;
  border-color: #60a5fa !important;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.35);
}

html[data-theme="dark"] #gstWords,
html[data-theme="dark"] #amountWords {
  color: #ffffff !important;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  padding: 8px 10px;
  border-radius: 8px;
}

html[data-theme="dark"] strong {
  color: #ffffff;
}

/* ===== PRINT (Single, Clean) ===== */
@media print {
  @page {
    size: A4;
    margin: 10mm;
  }

  html,
  body {
    background: #fff !important;
    color: #000 !important;
  }

  /* Remove app feel */
  .main-container {
    width: 100% !important;
    margin: 0 !important;
    border: 2px solid #000 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
    padding: 8mm !important;
    background: #fff !important;
    color: #000 !important;
  }

  /* No gradients/filters in print */
  *,
  *::before,
  *::after {
    background: #fff !important;
    background-image: none !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
    backdrop-filter: none !important;
  }

  /* Title + header separators */
  .header {
    background: #fff !important;
    border-bottom: 2px solid #000 !important;
    padding: 10px 0 6mm !important;
    margin-bottom: 5mm !important;
  }

  .title {
    background: #fff !important;
    border-bottom: 2px solid #000 !important;
    padding: 6mm 0 !important;
  }

  .title p::before,
  .title p::after {
    background: #000 !important;
    opacity: 1 !important;
  }

  /* Table becomes strict black grid */
  #itemsTable {
    border: 1px solid #000 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  #itemsTable thead th {
    background: #fff !important;
    color: #000 !important;
    border-bottom: 1px solid #000 !important;
  }

  #itemsTable td {
    border-bottom: 1px solid #000 !important;
  }

  #itemsTable th,
  #itemsTable td {
    border-left: 1px solid #000 !important;
  }

  #itemsTable th:first-child,
  #itemsTable td:first-child {
    border-left: none !important;
  }

  /* Hide UI-only controls */
  #addRowBtn,
  #savePdfBtn,
  button,
  .action-col,
  th:last-child,
  td:last-child {
    display: none !important;
  }

  /* Print helper classes used by your JS */
  .print-colon {
    display: none !important;
  }

  .print-label::after {
    content: " :" !important;
    font-weight: 700 !important;
    margin-left: 4px !important;
  }

  .print-field {
    display: grid !important;
    grid-template-columns: 110px 1fr !important;
    align-items: center !important;
    column-gap: 10px !important;
    margin: 3px 0 !important;
  }

  .print-value {
    display: inline-block !important;
    border-bottom: 1px solid #000 !important;
    padding: 1px 0 !important;
    min-height: 14px !important;
  }

  /* Prevent page breaks inside main chunks */
  .header,
  .title,
  #itemsTable,
  .items-section {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
}

/* Rollback the Add button section (remove big bar/strip look) */
.items-section {
  padding: 14px 18px 16px !important;
  gap: 8px !important;
}

.items-section::before,
.items-section::after {
  display: none !important;
}

/* If you had a separate wrapper around the button */
.add-row-wrap,
.add-btn-wrap,
.button-row,
.btn-row {
  background: transparent !important;
  padding: 0 !important;
  margin: 8px 0 0 0 !important;
  border: none !important;
  box-shadow: none !important;
}

/* Optional: style the PDF button in normal view */
.btn-pdf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border: none;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(90deg, #17a34a, #22c55e);
  box-shadow: 0 12px 28px rgba(34, 197, 94, 0.25);
  margin-left: 10px;
}

/* Match Abstract: add a top gap above the navbar */
body{
  padding-top: 14px;   /* change 14px to whatever gap you want */
}
