@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap");

body {
  font-family: "Inter", sans-serif;
  background: #f5f6fa;
  margin: 0;
  /* padding: 20px; */
  color: #333;
  height: 100%;
}
.container {
  display: flex;
  gap: 20px; /* consistent gap */
  align-items: flex-start;
  flex-wrap: nowrap; /* keep side-by-side */
  max-width: 100%;
  margin: auto;
  padding: 0 20px; /* small padding for edges */
  box-sizing: border-box;
}

.invoice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 25px;
}

.logo-area {
  flex: 0 0 180px; /* wider — adjust 140–220px based on your logo */
  height: 100px; /* taller — adjust to fit your logo nicely */
  /* background-color: #10b981;  */
  border-radius: 8px;
  overflow: hidden;
  display: flex; /* better centering */
  align-items: center;
  justify-content: center;
  padding: 8px; /* small inner padding — remove if you want zero space */
  box-sizing: border-box;
}

.logo-area .logo {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain; /* keeps full logo visible, no forced crop */
  display: block;
  margin: 0;
}
.panel {
  flex: 1 1 calc(60% - 10px); /* panel takes ~60% minus half gap */
  min-width: 300px; /* never shrink too small */
  background: #ffffffc1;
  padding: 25px 35px;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

h1,
h2,
h3 {
  margin: 0 0 10px 0;
  font-weight: 600;
  color: #353171;
}

label {
  /* display: block; */
  /* margin-bottom: 4px; */
  font-weight: 500;
  color: #555;
}

input,
textarea {
  width: 90%;
  padding: 10px;
  /* margin-bottom: 10px; */
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 14px;
}

input:focus,
textarea:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 6px rgba(79, 70, 229, 0.3);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 20px;
}

.btn {
  padding: 12px 18px;
  width: 30%;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-add {
  background: #10b981;
  color: #fff;
}

.btn-generate {
  background: #4f46e5;
  color: #fff;
  width: 100%;
}

#itemsListContainer table,
.invoice table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 14px;
}
#invoiceWrapper {
  flex: 0 0 calc(50% - 10px); /* invoice takes remaining width minus half gap */
  min-width: 400px; /* minimum invoice width */
  max-width: 700px; /* maximum invoice width */
  height: 100vh;
  background: #100c0c7a;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  position: sticky;
  top: 0; /* stay visible while scrolling */
}

#invoiceScroll {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  padding: 1rem 0;
  padding-bottom: 90px; /* SPACE FOR BUTTONS */
  min-height: 0;

  /* Hide scrollbar (all browsers) */
  scrollbar-width: none; /* Firefox */
}
#invoiceScroll::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.invoice {
  background: #ffffff;
  padding: 16px;
  border-radius: 8px;
  width: 85%;
  margin: 0 auto;

  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.08),
    0 6px 20px rgba(0, 0, 0, 0.06);
}
.invoice-preview {
  page-break-after: always;
  break-after: page;
  border: 5px solid #6cb7035b;
}

/* last one should not add extra blank page */
.invoice-preview:last-child {
  page-break-after: auto;
}
.invoice-actions {
  position: sticky;
  bottom: 0;

  display: flex;
  gap: 1rem;

  width: 100%; /* FULL WIDTH */
  background: #ece2e2c6; /* covers entire wrapper */

  padding: 1rem 1.5rem; /* ← THIS creates left/right space */
  box-sizing: border-box;

  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.invoice-actions .btn {
  flex: 1;
  padding: 1rem 2.5rem;
}

#itemsListContainer th,
#itemsListContainer td,
.invoice th,
.invoice td {
  border: 1px solid #ddd;
  padding: 8px 10px;
  text-align: center;
}

#itemsListContainer th,
.invoice th {
  background: #f3f3f3;
  font-weight: 600;
}

.btn-remove {
  background: #ef4444;
  color: #fff;
  height: 1.5rem;
  width: 1.5rem;
  align-items: center;
  padding: 1rem;
  display: flex;
  justify-content: center;
  /* border-radius: 50%; */
  text-align: center;
  font-size: 12px;
}
.btn-edit {
  background: #0bdcc7;
  color: #fff;
  height: 1.5rem;
  width: 1.5rem;
  align-items: center;
  padding: 1rem;
  display: flex;
  justify-content: center;
  /* border-radius: 50%; */
  text-align: center;
  font-size: 12px;
}
.parties {
  display: flex;
  justify-content: space-between;
  padding: 2rem;
}
.summary-extra {
  margin-top: 10px; /* space from table */
  text-align: right; /* align text to right */
  width: 100%; /* full width container, so alignment works naturally */
  font-size: 0.95em;
}
.summary-extra div {
  margin: 4px 0;
}
.grand {
  font-size: 1.2em;
  font-weight: bold;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #aaa;
}
.thank-you {
  text-align: center;
  font-style: italic;
  font-size: 1em;
  color: #444;
  margin-top: auto;
  padding: 2rem 0rem; /* push it to the bottom of the page */
}
/* Modal Styles */
.modal {
  display: none; /* Hidden by default */
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 1000; /* Ensures it appears on top of the content */
}

.modal.show {
  display: flex; /* When modal is shown */
}

.modal-content {
  background: #fff;
  padding: 25px 30px;
  border-radius: 12px;
  width: 360px;
  max-width: 90%;
  display: flex;
  flex-direction: column;
  gap: 15px;
  position: relative;
}

.modal-input-group label {
  font-weight: 600;
  color: #333;
}

.modal-input-group input {
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #ddd;
  font-size: 14px;
}

.close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 28px;
  cursor: pointer;
  color: #888;
}

.close:hover {
  color: #222;
}

@media (max-width: 900px) {
  .container {
    flex-direction: column;
    padding-right: 0; /* remove extra space */
  }

  #invoiceWrapper {
    position: relative; /* no longer fixed */
    width: 100%; /* full width */
    height: auto; /* adjust height automatically */
    background: transparent; /* optional for clean look */
    margin-top: 20px; /* space between panel and invoice */
    padding: 0;
    box-shadow: none;
  }

  #invoiceScroll {
    max-height: none; /* allow invoice to expand naturally */
    overflow: visible;
    padding-bottom: 20px;
  }
  .panel,
  #invoiceWrapper {
    width: 100%;
    min-width: auto;
  }
}
