/* ==========================================================================
   InvoiceFine Web - Invoice Maker & Print Layout Styles
   ========================================================================== */

.invoice-app-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

.invoice-editor-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.invoice-preview-card {
  position: sticky;
  top: calc(var(--nav-height) + 24px);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.invoice-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
  gap: 12px;
}

.mode-selector {
  display: flex;
  background: var(--bg-surface-variant);
  border-radius: var(--radius-full);
  padding: 4px;
}

.mode-btn {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mode-btn.active {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: var(--shadow-sm);
}

/* Form Sections */
.form-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.item-row {
  display: grid;
  grid-template-columns: 2.5fr 1fr 1.2fr 1fr 1fr 40px;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border-light);
}

.item-header {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.btn-remove-item {
  background: var(--danger-soft);
  color: var(--danger);
  border: none;
  border-radius: var(--radius-sm);
  width: 36px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-remove-item:hover {
  background: var(--danger);
  color: #FFFFFF;
}

/* Printable Paper Preview (A4 Size Replica) */
.paper-preview-container {
  background: #E5E5E8;
  padding: 20px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  max-height: 720px;
  overflow-y: auto;
}

.invoice-paper {
  background: #FFFFFF;
  color: #19191B;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 32px;
  border-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  font-size: 12px;
  line-height: 1.4;
  font-family: 'Inter', sans-serif;
}

/* Thermal Bill Style Mode */
.invoice-paper.thermal-mode {
  max-width: 320px;
  padding: 16px;
  font-family: monospace, 'Courier New', Courier;
  font-size: 11px;
}

.invoice-paper.thermal-mode .inv-brand-name {
  font-size: 16px;
  text-align: center;
}

.inv-header-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 2px solid #D93632;
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.inv-brand-name {
  font-size: 20px;
  font-weight: 800;
  color: #D93632;
  font-family: 'Outfit', sans-serif;
}

.inv-title {
  font-size: 18px;
  font-weight: 800;
  color: #19191B;
  text-align: right;
  text-transform: uppercase;
}

.inv-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.inv-box {
  background: #F8F8F9;
  border: 1px solid #E5E5E8;
  border-radius: 6px;
  padding: 10px 12px;
}

.inv-box-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #74747C;
  margin-bottom: 4px;
}

.inv-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.inv-table th {
  background: #F1F1F3;
  color: #19191B;
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  padding: 8px 6px;
  border-top: 1px solid #D7D7DB;
  border-bottom: 1px solid #D7D7DB;
}

.inv-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #F1F1F3;
}

.inv-total-section {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: 12px;
}

.inv-total-table {
  width: 240px;
  border-collapse: collapse;
}

.inv-total-table td {
  padding: 4px 6px;
}

.inv-grand-total {
  font-size: 14px;
  font-weight: 800;
  color: #D93632;
  border-top: 2px solid #19191B;
  border-bottom: 2px solid #19191B;
}

.inv-footer {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid #E5E5E8;
  font-size: 10px;
  color: #74747C;
  text-align: center;
}

/* Print Only Styles */
@media print {
  body * {
    visibility: hidden;
  }

  .invoice-paper, .invoice-paper * {
    visibility: visible;
  }

  .invoice-paper {
    position: absolute;
    left: 0;
    top: 0;
    width: 100% !important;
    max-width: 100% !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .navbar, .footer, .invoice-editor-card, .invoice-toolbar, .btn {
    display: none !important;
  }
}

@media (max-width: 1024px) {
  .invoice-app-wrapper {
    grid-template-columns: 1fr;
  }
  
  .invoice-preview-card {
    position: static;
  }

  .item-row {
    grid-template-columns: 1fr 1fr;
  }
}
