/* Base Styles */
* {
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
body {
  margin: 0;
  padding: 20px;
  background-color: #f4f4f9;
  color: #333;
}

/* Layout */
.app-container {
  display: flex;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}
.editor-section {
  flex: 1;
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  max-height: 95vh;
  overflow-y: auto;
}
.preview-section {
  flex: 1.5;
  background: white;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Form Inputs & Buttons */
input,
select,
textarea {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: white;
}
.input-group {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}
.input-group h3 {
  margin-top: 0;
}

button {
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}
.add-btn {
  background: #0056b3;
}
.add-btn:hover {
  background: #004494;
}
.print-btn {
  width: 100%;
  font-size: 16px;
  padding: 15px;
  background: #28a745;
  margin-top: 10px;
}
.print-btn:hover {
  background: #218838;
}

/* Ads heading before ad block */
.ad-heading {
  text-align: center;
}

/* Refresh Button Styling */
.refresh-btn {
  width: 100%;
  font-size: 16px;
  padding: 15px;
  background: #6c757d; /* Neutral Gray */
  margin-top: 10px;
}
.refresh-btn:hover {
  background: #5a6268;
}

/* Dynamic Item Rows */
.item-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
}
.item-row input {
  margin-bottom: 0;
}
.remove-btn {
  background: #dc3545;
  padding: 10px 12px;
}
.remove-btn:hover {
  background: #c82333;
}

/* Invoice Preview Styling */
.invoice-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 2px solid #333;
  padding-bottom: 20px;
  margin-bottom: 20px;
}
.from-details h1 {
  margin: 0;
  font-size: 24px;
}
.from-details p,
.to-details p {
  margin: 5px 0;
  color: #555;
  line-height: 1.5; /* Adds a bit of breathing room between lines */
}

/* This completely hides the row and its margins if you leave an input blank */
.from-details p:empty,
.to-details p:empty,
.invoice-title p:empty {
  display: none;
}
.invoice-title h2 {
  margin: 0;
  font-size: 32px;
  color: #0056b3;
  text-align: right;
}
.to-details {
  margin-bottom: 30px;
}
.bold {
  font-weight: bold;
  color: #333 !important;
}

/* Logo Styling */
#prev-logo {
  max-width: 150px;
  max-height: 80px;
  object-fit: contain;
  margin-bottom: 10px;
}

/* Invoice Table */
.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 30px;
}
.invoice-table th,
.invoice-table td {
  border-bottom: 1px solid #ddd;
  padding: 12px;
  text-align: left;
}
.invoice-table th {
  background-color: #f8f9fa;
}
.invoice-table th:last-child,
.invoice-table td:last-child {
  text-align: right;
}

/* Totals */
.invoice-summary {
  width: 300px;
  margin-left: auto;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}
.grand-total {
  font-size: 20px;
  font-weight: bold;
  border-bottom: none;
  border-top: 2px solid #333;
  margin-top: 10px;
  padding-top: 10px;
}

/* Text Pages specific layout */
.text-page-container {
  max-width: 800px;
  margin: 40px auto;
  background: white;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  line-height: 1.6;
}

/* Bottom Navigation Bar */
.site-footer {
  text-align: center;
  padding: 20px;
  margin-top: 40px;
  border-top: 1px solid #ddd;
  color: #555;
}
.site-footer nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 10px;
}
.site-footer a {
  text-decoration: none;
  color: #0056b3;
  font-weight: 500;
}
.site-footer a:hover {
  text-decoration: underline;
  color: #004494;
}

/* ========================================= */
/* ADVERTISEMENT CONTAINERS                  */
/* ========================================= */
.ad-banner {
  width: 100%;
  /* max-width: 1200px; */
  margin: 20px auto;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ========================================= */
/* SEO CONTENT & FAQ SECTION                 */
/* ========================================= */
.seo-content-section {
  max-width: 1200px;
  margin: 40px auto;
  background: white;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.seo-content-section h2 {
  text-align: center;
  color: #333;
  margin-bottom: 30px;
  font-size: 28px;
}

/* How It Works Grid */
.how-it-works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 50px;
}

.step-card {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 6px;
  border-top: 4px solid #0056b3;
}

.step-card h3 {
  margin-top: 0;
  color: #0056b3;
}

.step-card p {
  color: #555;
  line-height: 1.5;
  margin-bottom: 0;
}

/* Native HTML Accordion (FAQ) */
.faq-container details {
  background: #f8f9fa;
  padding: 15px 20px;
  border-radius: 6px;
  margin-bottom: 10px;
  border: 1px solid #eee;
  transition: background 0.2s ease;
}

.faq-container details:hover {
  background: #f1f3f5;
}

.faq-container summary {
  font-weight: bold;
  cursor: pointer;
  outline: none;
  color: #333;
  font-size: 16px;
  /* Removes the default triangle marker on some browsers to style it cleaner if desired, but keeping default is fine for now */
}

.faq-container details p {
  margin-top: 15px;
  margin-bottom: 0;
  color: #555;
  line-height: 1.6;
  border-top: 1px solid #ddd;
  padding-top: 15px;
}

/* ========================================= */
/* MOBILE RESPONSIVENESS                     */
/* ========================================= */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .preview-section {
    padding: 20px;
    overflow-x: auto;
  }
  .text-page-container {
    flex-direction: column;
    gap: 20px;
  }
}

/* ========================================= */
/* PRINT STYLES - CRUCIAL FOR PDF GENERATION */
/* ========================================= */
@page {
  margin: 0;
}
@media print {
  body {
    padding: 20mm;
    background: white;
  }
  .no-print {
    display: none !important;
  }
  .app-container {
    display: block;
    max-width: 100%;
    margin: 0;
  }
  .preview-section {
    box-shadow: none;
    padding: 0;
    margin: 0;
    width: 100%;
  }
}
