/* Modern Soft UI - Google Loved (Responsive & Accessible) */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --focus-ring: rgba(37, 99, 235, 0.15);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    /* FIX: Removed 'padding: 20px' to prevent layout shrinking and side gaps */
}

/* * FIX: Added a standard main container class you can use to wrap your tools.
 * It matches your header's max-width (1200px) so everything aligns perfectly.
 */
.tool-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 24px;
}

/* Header Section inside Tools */
.header-section {
    text-align: center;
    margin-bottom: 25px;
}

.header-section h1 {
    font-size: 34px;
    font-weight: 900;
    background: linear-gradient(90deg, #1e3a8a, #4f46e5, #0ea5e9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #1e3a8a; /* fallback */
    margin-bottom: 10px;
}

.subtitle {
    font-size: 15px;
    color: #475569;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Form Sections (Soft Cards) */
.form-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s ease;
}
.form-section:hover {
    box-shadow: var(--shadow-md);
}
.form-section h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    font-weight: 600;
}
.form-section h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: var(--primary);
    margin-right: 12px;
    border-radius: 4px;
}

/* Grids for Layout */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.item-inputs { display: flex; flex-direction: column; gap: 12px; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }

/* Inputs & Form Controls */
label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: #f8fafc;
    color: var(--text-main);
    transition: all 0.2s ease;
    min-height: 44px; /* Mobile touch target size */
}
input:hover, select:hover, textarea:hover {
    background: var(--card-bg);
    border-color: #cbd5e1;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    background: var(--card-bg);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--focus-ring);
}
textarea { resize: vertical; min-height: 80px; }

/* Invoice Header Area */
.invoice-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 24px;
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}
.invoice-number-input { display: flex; gap: 10px; }
#refreshInvoiceNumber {
    background: #f1f5f9; color: var(--text-main); border: 1px solid var(--border-color);
    border-radius: 8px; width: 44px; font-size: 18px; cursor: pointer; transition: 0.2s;
}
#refreshInvoiceNumber:hover { background: #e2e8f0; }

/* Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin: 15px 0;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* Default (Mobile first) */
#itemsTable {
    width: 100%;
    border-collapse: collapse;
}

/* Mobile fix (scroll allow) */
@media (max-width: 768px) {
    #itemsTable {
        min-width: 900px;  /* scroll enable */
    }
}

/* Desktop fix */
@media (min-width: 769px) {
    #itemsTable {
        table-layout: fixed; /* only desktop */
    }
}

/* Headers */
#itemsTable th {
    background: #f1f5f9;
    padding: 12px;
    text-align: left;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

/* Cells */
#itemsTable td {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

/* Inputs */
#itemsTable input {
    width: 100%;
    padding: 8px;
    min-height: 36px;
    box-sizing: border-box;
}

/* Button */
.remove-row {
    background: #fee2e2;
    color: #ef4444;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    border: none;
}

/* Totals Section */
.total-breakdown {
    background: #f8fafc; padding: 24px; border-radius: var(--radius); border: 1px solid var(--border-color);
}
.total-line {
    display: flex; justify-content: space-between; padding: 10px 0;
    color: var(--text-muted); font-size: 14px;
}
.total-line span:last-child { color: var(--text-main); font-weight: 600; }
.grand-total {
    font-size: 18px; font-weight: 800; color: var(--primary);
    border-top: 2px dashed #cbd5e1; margin-top: 12px; padding-top: 16px;
}
.grand-total span:last-child { color: var(--primary); font-size: 22px; }

/* Signature Options */
.signature-options { display: flex; gap: 15px; align-items: flex-start; flex-wrap: wrap; }
.signature-text { flex: 2; min-width: 200px; }
.signature-upload { flex: 1; min-width: 150px; }

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 12px 24px; border: none; border-radius: 8px; font-size: 15px; font-weight: 600;
    cursor: pointer; transition: all 0.2s; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
}
.btn-primary { background: var(--primary); color: white; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2); width: 100%; max-width: 300px; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3); }
.btn-secondary { background: #f1f5f9; color: var(--text-main); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: #e2e8f0; }
.actions { display: flex; justify-content: center; margin-top: 30px; margin-bottom: 40px; }

/* Responsive Adjustments */
@media (max-width: 768px) {
    .grid-2, .grid-3, .invoice-header, .summary-grid { grid-template-columns: 1fr; gap: 20px; }
    .invoice-header { padding: 15px; }
    .form-section { padding: 15px; }
    .btn-primary { max-width: 100%; }
}

.faq-container {
    margin-top: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.faq-item {
    border-bottom: 1px solid #eee;
    margin-bottom: 10px;
}
.faq-question {
    width: 100%;
    padding: 15px;
    background: #f9f9f9;
    border: none;
    outline: none;
    text-align: left;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
    border-radius: 8px;
}
.faq-question:hover {
    background: #f0f0f0;
}
.faq-icon {
    font-size: 20px;
    color: #007bff;
    margin-left: 10px;
}
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background-color: #fff;
}
.faq-answer p {
    padding: 15px;
    margin: 0;
    color: #666;
    line-height: 1.6;
}
.faq-item.active .faq-answer {
    max-height: 500px;
}
.faq-item.active .faq-question {
    background: #eef6ff;
}

/* FIX: Updated max-width from 1100px to 1200px to match Header width. 
 * Reduced top/bottom margin from 80px to 40px to fix massive spacing above and below.
 */
.invseo-wrap{
  max-width: 1200px;
  margin: 40px auto; 
  padding: 0 24px;
  font-family: 'Segoe UI', Roboto, sans-serif;
  color: #1e293b;
  line-height: 1.7;
}

/* HERO */
.invseo-hero{
  background: linear-gradient(to right, #f8fafc, #eff6ff);
  padding: 40px 25px;
  border-radius: 25px;
  border: 1px solid #e2e8f0;
  text-align: center;
  margin-bottom: 50px;
}

.invseo-hero h2{
  font-size: 32px;
  font-weight: 900;
  margin-bottom: 15px;
}

.invseo-hero span{color:#2563eb;}

.invseo-hero p{
  font-size: 16px;
  color: #475569;
  max-width: 800px;
  margin: auto;
}

/* GRID */
.invseo-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 60px;
}

.invseo-card h3{
  font-size: 20px;
  font-weight: 800;
  color: #2563eb;
  margin-bottom: 10px;
}

.invseo-card p{
  font-size: 14px;
  color: #475569;
}

/* STANDARDS */
.invseo-standards{
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 30px;
  text-align: center;
  margin-bottom: 60px;
}

.invseo-flex{
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
}

.invseo-item{
  flex: 1 1 120px;
}

/* FAQ */
.invseo-faq h2{
  text-align: center;
  font-size: 26px;
  margin-bottom: 25px;
}

.invseo-faq-box{
  background: #f8fafc;
  padding: 20px;
  border-radius: 15px;
  border-left: 4px solid #2563eb;
  margin-bottom: 12px;
}

.invseo-faq-box p:first-child{
  font-weight: 700;
  margin-bottom: 6px;
}

/* BUTTON */
.invseo-btn{
  display: inline-block;
  padding: 12px 25px;
  background: #0f172a;
  color: #fff;
  border-radius: 30px;
  text-decoration: none;
  font-size: 14px;
}

/* FOOTER */
.invseo-footer{
  text-align: center;
  margin-top: 30px;
  border-top: 1px solid #e2e8f0;
  padding-top: 20px;
}

.invseo-footer span{
  display: inline-block;
  margin: 6px 10px;
  font-size: 13px;
  color: #64748b;
}

/* ✅ MOBILE FIX */
@media (max-width:768px){
  .invseo-hero h2{
    font-size: 24px;
  }
  .invseo-grid{
    grid-template-columns: 1fr;
  }
  .invseo-card h3{
    font-size: 18px;
  }
  .invseo-hero{
    padding: 25px 15px;
  }
}