/* ===================================================
   INVOICE GENERATOR — full stylesheet
   =================================================== */

/* ===== Shared base ===== */
.container {
  max-width: 1200px;
  margin: 40px auto 70px auto;
  padding: 0 20px;
}

.tool-card {
  max-width: 1160px;
  margin: 0 auto;
  padding: 30px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  border: 1px solid #e6e9f2;
}

.card-title {
  margin-bottom: 20px;
}

.settings-box {
  background: #f5f7fb;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid #e0e5ef;
}

.form-group,
.input-group {
  margin-bottom: 18px;
}

textarea,
input,
select {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 14px;
  box-sizing: border-box;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.form-row>div {
  flex: 1 1 160px;
  min-width: 0;
}

.primary-btn {
  background: #2f5bea;
  color: #fff;
  border: none;
  padding: 12px 26px;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.secondary-btn {
  margin-top: 10px;
  background: #fff;
  border: 1px solid #2f5bea;
  color: #2f5bea;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
}

.center {
  text-align: center;
  margin-top: 20px;
}

.hidden {
  display: none;
}

/* SEO SECTION */
.seo-card {
  max-width: 900px;
  margin: 35px auto 0 auto;
  padding: 30px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  border: 1px solid #e6e9f2;
}

.seo-title {
  font-size: 36px;
  margin-bottom: 24px;
  color: #0b1b42;
}

.seo-content {
  background: #f5f7fb;
  padding: 25px;
  border-radius: 12px;
  border: 1px solid #e0e5ef;
}

.seo-content h3 {
  margin-top: 20px;
  margin-bottom: 12px;
  color: #0b1b42;
}

.seo-content h3:first-child {
  margin-top: 0;
}

.seo-content p,
.seo-content li {
  line-height: 1.8;
  color: #333;
  font-size: 16px;
}

.seo-content ol,
.seo-content ul {
  padding-left: 20px;
}

/* ===================================================
   INVOICE-SPECIFIC STYLES
   =================================================== */

/* ===== Layout — single column, always ===== */
.invoice-layout {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

@media (min-width: 901px) {
  .invoice-layout {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
  }
}

/*highlighting for fix reference*/


.form-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.box-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  color: #0b1b42;
}

.small-btn {
  padding: 8px 18px;
  font-size: 13px;
}

.link-btn {
  background: none;
  border: none;
  color: #2f5bea;
  cursor: pointer;
  font-size: 13px;
  padding: 4px 0;
  text-decoration: underline;
}

.link-btn:hover {
  opacity: 0.8;
}

/* ===== Line Items (form) ===== */
.line-items-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.line-item-row {
  display: grid;
  grid-template-columns: 2fr 0.7fr 1fr 0.8fr auto;
  gap: 8px;
  align-items: center;
}

.line-item-row input {
  width: 100%;
  margin-bottom: 0;
}

.remove-line-btn {
  background: #fff;
  border: 1px solid #e0e5ef;
  border-radius: 8px;
  color: #c0392b;
  cursor: pointer;
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1;
}

.remove-line-btn:hover {
  background: #fbeaea;
  border-color: #e5b8b8;
}

@media (max-width: 560px) {
  .line-item-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "desc desc"
      "qty price"
      "disc remove";
  }
}

/* ===== Preview Panel ===== */
.preview-panel {
  min-width: 0;
}

.preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.preview-toolbar .secondary-btn {
  margin-top: 0;
}

.saved-invoices-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: #f5f7fb;
  border: 1px solid #e0e5ef;
  border-radius: 12px;
  font-size: 13px;
}

.saved-invoices-bar label {
  color: #555;
  font-weight: 500;
  white-space: nowrap;
}

.saved-invoices-bar .select,
.saved-invoices-bar select {
  flex: 1;
  min-width: 160px;
  width: auto;
  margin-bottom: 0;
}

/* ===== "Paper" preview — fixed A4-proportioned sheet, scaled to fit ===== */


.invoice-preview {
  width: 100%;
  max-width: 794px;
  margin: 0 auto;
  box-sizing: border-box;
  background: #ffffff;
  color: #222;
  border-radius: 8px;
  padding: 40px 44px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  border: 1px solid #e6e9f2;
  font-size: 14px;
  line-height: 1.6;
}

.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.inv-logo {
  max-height: 64px;
  max-width: 180px;
  object-fit: contain;
}

.inv-title-wrap {
  text-align: right;
}

.inv-title {
  margin: 0;
  font-size: 26px;
  letter-spacing: 2px;
  color: #0b1b42;
}

.inv-number {
  margin: 4px 0 0;
  color: #667;
  font-size: 13px;
}

.inv-meta-grid {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 1px solid #e6e9f2;
}

.inv-parties {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
}

.inv-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8891a5;
  margin-bottom: 4px;
}

.inv-name {
  margin: 0 0 4px;
  font-weight: 600;
  color: #0b1b42;
}

.inv-text {
  margin: 0;
  color: #555;
  white-space: pre-line;
  font-size: 13px;
}

.inv-dates {
  display: flex;
  gap: 24px;
  text-align: right;
}

.inv-dates p {
  margin: 0;
  font-weight: 600;
  color: #0b1b42;
}

.inv-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.inv-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8891a5;
  padding: 8px 6px;
  border-bottom: 2px solid #e0e5ef;
}

.inv-table td {
  padding: 12px 6px;
  border-bottom: 1px solid #eef1f7;
  font-size: 13px;
  color: #333;
}

.inv-table th:not(:first-child),
.inv-table td:not(:first-child) {
  text-align: right;
}

.inv-totals {
  margin-left: auto;
  max-width: 280px;
  margin-bottom: 28px;
  background: #f5f7fb;
  border: 1px solid #e0e5ef;
  border-radius: 12px;
  padding: 14px 18px;
}

.inv-totals-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  color: #555;
}

.inv-grand-total {
  border-top: 2px solid #0b1b42;
  margin-top: 6px;
  padding-top: 12px;
  font-size: 16px;
  font-weight: 700;
  color: #0b1b42;
}

.inv-footer {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  border-top: 1px solid #e6e9f2;
  padding-top: 16px;
}

.inv-footer:empty,
.inv-footer:has(> .hidden:only-child) {
  display: none;
}

.inv-footer>div {
  flex: 1;
  min-width: 200px;
}

.inv-footer p {
  margin: 0;
  color: #555;
  font-size: 13px;
  white-space: pre-line;
}

/* ===== Templates ===== */
.template-classic {
  font-family: Georgia, 'Times New Roman', serif;
}

.template-modern {
  font-family: inherit;
  border-top: 6px solid #2f5bea;
}

.template-modern .inv-title {
  color: #2f5bea;
}

.template-modern .inv-grand-total {
  color: #2f5bea;
  border-top-color: #2f5bea;
}

.template-minimal {
  font-family: inherit;
  box-shadow: none;
}

.template-minimal .inv-totals {
  background: none;
  border: none;
  padding: 14px 0;
}

.template-minimal .inv-table th {
  border-bottom: 1px solid #ccc;
}

/* ===== How To section ===== */
.howto-card {
  max-width: 900px;
  margin: 35px auto 0 auto;
  padding: 30px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  border: 1px solid #e6e9f2;
}

.howto-list {
  background: #f5f7fb;
  padding: 20px 20px 20px 40px;
  border-radius: 12px;
  border: 1px solid #e0e5ef;
}

.howto-list li {
  line-height: 1.8;
  color: #333;
  font-size: 15px;
  margin-bottom: 6px;
}

/* ===== SEO collapsible details ===== */
.seo-details {
  margin-top: 10px;
}

.seo-details summary {
  cursor: pointer;
  font-weight: 600;
  padding: 12px 0;
  color: #2f5bea;
  list-style: none;
}

.seo-details summary::-webkit-details-marker {
  display: none;
}

.seo-details summary::before {
  content: "+ ";
}

.seo-details[open] summary::before {
  content: "− ";
}

.seo-details .seo-content {
  margin-top: 8px;
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
  .seo-title {
    font-size: 28px;
  }

  .container {
    margin-top: 25px;
  }

  .box-title {
    font-size: 14px;
  }
}



/* ===== Mobile tabs ===== */
@media (max-width: 600px) {
  .invoice-preview {
    padding: 20px;
    font-size: 13px;
  }
}

@media (max-width: 900px) {
  .preview-toolbar {
    position: sticky;
    top: 54px;
    background: #fff;
    z-index: 9;
    padding-bottom: 10px;
  }
}

/* ===== Print ===== */
#printArea {
  display: none;
}

@media print {
  @page {
    size: A4;
    margin: 15mm;
  }

  body>*:not(#printArea) {
    display: none !important;
  }

  #printArea {
    display: block !important;
  }

  .print-clone {
    width: 100% !important;
    min-height: auto !important;
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}