
/* ======== General Page Setup ======== */
body {
  font-family: "Arial", sans-serif;
  background: #fff;
  color: #000;
  margin: 0;
  padding: 20px;
}

#app {
  width: 800px;
  margin: auto;
  padding: 40px;
  border: 1px solid #000;
  background: #fff;
  box-sizing: border-box;
}

/* ======== Header Section ======== */
header {
  text-align: center;
  margin-bottom: 15px;
}

header img {
  display: block;
  margin: 0 auto 5px auto;
  width: 100px;
  height: auto;
}

header h2 {
  margin: 5px 0;
  font-size: 22px;
  font-weight: bold;
}

header p {
  margin: 3px 0;
  font-size: 14px;
}

/* ======== Invoice Meta ======== */
label {
  font-weight: bold;
  font-size: 14px;
  display: block;
  margin-top: 12px;
}

input[type="text"],
input[type="date"],
input[type="number"],
select {
  width: 100%;
  padding: 8px 10px;
  margin: 6px 0 10px 0;
  border: 1px solid #000;
  box-sizing: border-box;
  font-size: 14px;
  border-radius: 4px;
  background: #fff;
  line-height: 1.6;
  height: 38px;
}

/* ======== Table Styling ======== */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  margin-bottom: 10px;
  table-layout: fixed; /* force columns to follow widths below */
}

th, td {
  border: 1px solid #000;
  text-align: center;
  padding: 8px 6px;
  vertical-align: middle;
  box-sizing: border-box;
}

/* Input box inside table */
td input {
  width: 100%;
  border: none;
  outline: none;
  text-align: left;
  padding: 10px 12px;    /* extra padding to avoid text touching lines */
  box-sizing: border-box;
  font-size: 14px;
  line-height: 1.4;      /* helps with characters like y, p, g */
  height: 40px;
  background: #fff;
  display: flex;              /* ✅ enables vertical centering */
  align-items: center;        /* ✅ keeps text properly centered */
  vertical-align: middle;
}

/* ======== Explicit Column Widths (UPDATED) ======== */
#itemsTable th:nth-child(1),
#itemsTable td:nth-child(1) {
  width: 50% !important;  /* Description wider */
  min-width: 320px !important;
}

#itemsTable th:nth-child(2),
#itemsTable td:nth-child(2) {
  width: 15% !important;  /* Qty - readable */
  min-width: 80px !important;
}

#itemsTable th:nth-child(3),
#itemsTable td:nth-child(3) {
  width: 17% !important;  /* Unit price - readable */
  min-width: 90px !important;
}

#itemsTable th:nth-child(4),
#itemsTable td:nth-child(4) {
  width: 18% !important;  /* Total - readable */
  min-width: 100px !important;
}

/* Make sure header text looks bold and centered */
#itemsTable thead th {
  font-weight: 700;
  background: #f6f6f6;
}

/* ======== Make inner inputs not collapse when captured ======== */
.desc-input {
  padding-left: 12px !important;
  padding-right: 12px !important;
}

.qty-input,
.price-input,
.total-input {
  padding-left: 10px !important;
  padding-right: 10px !important;
  text-align: center;
}

/* ======== Buttons Section ======== */
#buttons {
  text-align: center;
  margin-top: 18px;
}

#buttons button {
  background: #000;
  color: #fff;
  border: none;
  padding: 8px 16px;
  margin: 6px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: 0.2s;
}

#buttons button:hover {
  background: #333;
}

/* ======== Download PDF Button ======== */
#downloadContainer {
  text-align: center;
  margin-top: 24px;
}

#downloadBtn {
  background: #008000;
  color: #fff;
  border: none;
  padding: 10px 22px;
  font-size: 15px;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.2s;
}

#downloadBtn:hover {
  background: #006b00;
}

/* ======== Grand Total ======== */
#grandTotalContainer {
  text-align: right;
  margin-top: 18px;
  font-size: 16px;
  font-weight: bold;
}

/* ======== Footer (QR & Info) ======== */
footer {
  text-align: center;
  margin-top: 22px;
  font-size: 13px;
}

footer img {
  margin-top: 8px;
  width: 100px;
  height: auto;
}

/* ======== Share Modal Styling ======== */
#shareModal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.4);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#shareModal div {
  background: #fff;
  padding: 25px 35px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

#shareModal h3 {
  margin-top: 0;
}

#shareModal button {
  margin: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  color: #fff;
  font-size: 14px;
}

#shareWhatsApp {
  background: #25D366;
}

#shareGmail {
  background: #EA4335;
}

#closeShare {
  background: #444;
}

/* ======== Print-friendly slight adjustments ======== */
@media print {
  #buttons, #downloadContainer, #shareModal { display: none !important; }
  body { margin: 0; padding: 0; }
  #app { border: none; width: 100%; padding: 0; }
}
