/* Global Design Tokens & Variables */
:root {
  --primary-color: #f97316; /* Dynamic - changed by JS */
  --primary-hover: #ea580c;
  --primary-light: #ffedd5;
  
  --bg-canvas: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-input: #f1f5f9;
  
  --text-dark: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-focus: #cbd5e1;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-invoice: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Base resets */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-canvas);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* --- Layout Components --- */

/* App Header */
.app-header {
  height: 70px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background-color: var(--primary-light);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-normal);
}

.brand-icon i {
  width: 22px;
  height: 22px;
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.025em;
}

.brand-text span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Zoom Control styling */
.zoom-controls {
  display: flex;
  align-items: center;
  background-color: var(--bg-input);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  margin-right: 0.5rem;
}

.zoom-controls span {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0 0.75rem;
  min-width: 50px;
  text-align: center;
  color: var(--text-dark);
  user-select: none;
}

/* App Container */
.app-container {
  display: flex;
  flex: 1;
  height: calc(100vh - 70px);
  position: relative;
}

/* Left Sidebar (Input Panel) */
.sidebar {
  width: 450px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Right Canvas (Live Preview) */
.preview-canvas {
  flex: 1;
  overflow: auto;
  padding: 3rem 2rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background-color: #cbd5e1; /* Soft document layout background */
  position: relative;
  scroll-behavior: smooth;
}

.invoice-container-scale-wrapper {
  transform-origin: top center;
  transition: transform var(--transition-normal);
  display: flex;
  justify-content: center;
  width: 794px;
  height: 1123px;
  flex-shrink: 0;
}

/* --- Interactive Accordion (Details & Summary) --- */
.section-card {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition-normal);
}

.section-card[open] {
  box-shadow: var(--shadow-sm);
}

.section-header {
  list-style: none;
  padding: 1.15rem 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.section-header::-webkit-details-marker {
  display: none;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-dark);
}

.section-title i {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.chevron {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: transform var(--transition-normal);
}

.section-card[open] .chevron {
  transform: rotate(180deg);
}

.section-content {
  padding: 1.25rem;
  border-top: 1px solid var(--border-color);
  background-color: #fafbfb;
}

/* --- Form Controls --- */
.form-group {
  margin-top: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .form-group {
  flex: 1;
}

.input-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.form-input {
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-dark);
  padding: 0.65rem 0.85rem;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition-fast);
  width: 100%;
}

.form-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

textarea.form-input {
  resize: vertical;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  outline: none;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-full {
  width: 100%;
}

.btn-primary {
  background-color: var(--primary-color);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--bg-input);
  color: var(--text-dark);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--border-focus);
}

.btn-accent {
  background-color: var(--text-dark);
  color: #ffffff;
}

.btn-accent:hover {
  background-color: #1e293b;
}

.btn-danger {
  background-color: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

.btn-danger:hover {
  background-color: #fecaca;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-icon i {
  width: 18px;
  height: 18px;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

/* Logo Upload Container */
.logo-upload-box {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem 1rem;
  text-align: center;
  position: relative;
  cursor: pointer;
  background-color: #ffffff;
  transition: var(--transition-normal);
}

.logo-upload-box:hover {
  border-color: var(--primary-color);
  background-color: var(--primary-light);
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
}

.upload-placeholder i {
  width: 32px;
  height: 32px;
  color: var(--text-light);
}

.upload-placeholder p {
  font-size: 0.85rem;
  font-weight: 500;
}

.upload-placeholder span {
  font-size: 0.75rem;
  color: var(--text-light);
}

.hidden-file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.logo-preview-container {
  position: relative;
  width: 100%;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-preview-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.btn-remove-logo {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #ef4444;
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

.btn-remove-logo i {
  width: 14px;
  height: 14px;
}

.hidden {
  display: none !important;
}

/* Save button block */
.save-storage-container {
  margin-top: 1rem;
}

/* Accent Color Options */
.accent-picker-container {
  margin-top: 0.5rem;
}

.color-presets {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.color-preset {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.color-preset:hover {
  transform: scale(1.15);
}

.color-preset.active {
  border-color: #000000;
  box-shadow: 0 0 0 2px #ffffff inset;
}

.custom-color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.custom-color-wrapper {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border-color);
  position: relative;
}

#custom-accent-color {
  position: absolute;
  top: -4px;
  left: -4px;
  width: 40px;
  height: 40px;
  border: none;
  cursor: pointer;
  background: none;
}

/* Items input panel block items */
.items-inputs-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.item-input-row {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  background-color: #ffffff;
  position: relative;
  transition: var(--transition-normal);
}

.item-input-row:hover {
  border-color: var(--border-focus);
}

.item-input-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.item-index-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.btn-remove-item {
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-remove-item:hover {
  background-color: #fee2e2;
}

.btn-remove-item i {
  width: 16px;
  height: 16px;
}


/* --- A4 Page Styling (Live Preview) --- */
.invoice-page {
  background-color: #ffffff;
  width: 210mm;
  height: 297mm;
  padding: 20mm 15mm;
  box-shadow: var(--shadow-invoice);
  position: relative;
  display: flex;
  flex-direction: column;
  color: #1e293b;
  overflow: hidden;
  
  /* Layout variables for dynamic compaction */
  --invoice-logo-height: 70px;
  --invoice-item-padding: 0.95rem;
  --invoice-margin-bottom: 2rem;
  --invoice-head-margin-bottom: 1.5rem;
}

/* Typography styles within invoice */
.invoice-page h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}

.invoice-page h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

.invoice-page p {
  font-size: 0.85rem;
  line-height: 1.45;
  color: #475569;
}

.invoice-page .pre-wrap {
  white-space: pre-wrap;
  word-break: break-word;
}

.invoice-page .empty-placeholder {
  position: relative;
}

.invoice-page .empty-placeholder:empty::before {
  content: attr(data-placeholder);
  color: var(--text-light);
  font-style: italic;
  font-weight: 400;
}

/* Head */
.invoice-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--invoice-head-margin-bottom);
}

.head-left {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
  flex: 1;
}

.invoice-logo-container {
  max-width: 180px;
  height: var(--invoice-logo-height);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
}

.invoice-logo-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.logo-fallback {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
}

.company-details-view {
  flex: 1;
}

.details-text-group {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.accent-text {
  color: var(--primary-color) !important;
  font-weight: 600;
}

.head-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.invoice-title-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

.invoice-tag-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.invoice-tag {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--primary-color);
  line-height: 1;
}

.status-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.3rem 0.65rem;
  border-radius: 50px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
}

.status-badge.status-paid {
  background-color: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

.status-badge.status-due {
  background-color: #ffedd5;
  color: #c2410c;
  border-color: #fed7aa;
}

.status-badge.status-overdue {
  background-color: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.invoice-amount-badge {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 140px;
}

.badge-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.badge-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary-color);
  margin-top: 0.1rem;
}

.divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

/* Meta & Billing details layout */
.invoice-meta-section {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 2rem;
  margin-bottom: var(--invoice-margin-bottom);
}

.section-subheading {
  display: block;
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-light);
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.meta-bill-to h3 {
  margin-bottom: 0.4rem;
}

.meta-invoice-details {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.meta-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}

.meta-label {
  color: var(--text-muted);
  font-weight: 500;
}

.meta-val {
  font-weight: 600;
  color: var(--text-dark);
}

/* Items Table inside Invoice */
.invoice-table-container {
  flex: 1; /* Pushes the summary section to the bottom */
  margin-bottom: var(--invoice-margin-bottom);
}

.invoice-items-table {
  width: 100%;
  border-collapse: collapse;
}

.invoice-items-table th {
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
  background-color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: calc(var(--invoice-item-padding) * 0.8) 0.75rem;
}

.invoice-items-table th:first-child {
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
}

.invoice-items-table th:last-child {
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}

.invoice-items-table td {
  padding: var(--invoice-item-padding) 0.75rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

.col-item {
  text-align: left;
}

.col-qty {
  width: 80px;
}

.col-price {
  width: 110px;
}

.col-amount {
  width: 110px;
}

.text-right {
  text-align: right;
}

.item-name-preview {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-dark);
}

.item-desc-preview {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Invoice bottom notes & Totals */
.invoice-bottom-section {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
  margin-top: auto; /* Aligns to page bottom */
  padding-top: 1rem;
}

.notes-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.notes-container p {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.totals-table {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.15rem 0;
}

.total-row span:last-child {
  font-weight: 600;
  color: var(--text-dark);
}

.grand-total-row {
  border-top: 2px solid var(--primary-color);
  padding-top: 0.75rem;
  margin-top: 0.25rem;
  font-size: 1.1rem !important;
  color: var(--text-dark) !important;
}

.grand-total-row span {
  font-weight: 800 !important;
  color: var(--primary-color) !important;
}

.invoice-footer {
  margin-top: 2rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  text-align: center;
}

.thanks-message {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  font-style: italic;
}

/* Compact spacing classes */
.invoice-page.compact-sm {
  --invoice-logo-height: 55px;
  --invoice-item-padding: 0.7rem;
  --invoice-margin-bottom: 1.5rem;
  --invoice-head-margin-bottom: 1.1rem;
  font-size: 0.92em;
}

.invoice-page.compact-md {
  --invoice-logo-height: 48px;
  --invoice-item-padding: 0.45rem;
  --invoice-margin-bottom: 1.15rem;
  --invoice-head-margin-bottom: 0.85rem;
  font-size: 0.85em;
}

.invoice-page.compact-lg {
  --invoice-logo-height: 40px;
  --invoice-item-padding: 0.25rem;
  --invoice-margin-bottom: 0.75rem;
  --invoice-head-margin-bottom: 0.75rem;
  font-size: 0.75em;
}

/* Signature block styling */
.invoice-signature-row {
  display: flex;
  justify-content: flex-start;
  margin-top: 1rem;
  margin-bottom: 1.25rem;
}

.signature-box {
  width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.signature-line {
  width: 100%;
  border-top: 1px solid #94a3b8;
  margin-bottom: 0.4rem;
}

#view-signatory-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Background Pattern Presets & Layouts */
.pattern-presets {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.pattern-preset {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.45rem 0.2rem;
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  transition: var(--transition-fast);
}

.pattern-preset:hover {
  border-color: var(--border-focus);
  color: var(--text-dark);
}

.pattern-preset.active {
  background-color: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* Pattern classes for the A4 invoice preview */
.invoice-page.pattern-dots {
  background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
  background-size: 16px 16px;
}

.invoice-page.pattern-grid {
  background-image: linear-gradient(#e2e8f0 1px, transparent 1px),
                    linear-gradient(to right, #e2e8f0 1px, transparent 1px);
  background-size: 18px 18px;
}

.invoice-page.pattern-stripes {
  background-image: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 1.5px, transparent 1.5px, transparent 12px);
}

.invoice-page.pattern-waves {
  background-image: radial-gradient(circle at 100% 150%, transparent 24%, #f8fafc 24%, #f8fafc 28%, transparent 28%, transparent),
                    radial-gradient(circle at 0% 150%, transparent 24%, #f8fafc 24%, #f8fafc 28%, transparent 28%, transparent);
  background-size: 20px 20px;
}

/* --- Print Optimization --- */
@media print {
  /* Set standard A4 page dimensions */
  @page {
    size: A4;
    margin: 0;
  }
  
  html, body {
    width: 210mm;
    height: 297mm;
    background-color: #ffffff !important;
    overflow: hidden;
  }
  
  /* Hide non-printable app wrapper nodes */
  .app-header,
  .sidebar,
  #zoom-out-btn,
  #zoom-in-btn,
  #zoom-level {
    display: none !important;
  }
  
  /* Adjust app container to hold only the invoice */
  .app-container {
    height: auto;
    display: block;
  }
  
  .preview-canvas {
    background-color: transparent !important;
    padding: 0 !important;
    overflow: visible !important;
    display: block;
    width: 210mm;
    height: 297mm;
  }
  
  .invoice-container-scale-wrapper {
    transform: none !important; /* Force reset zoom scale */
    width: 210mm;
    height: 297mm;
  }
  
  .invoice-page {
    box-shadow: none !important;
    border: none !important;
    width: 210mm;
    height: 297mm;
    padding: 20mm 15mm !important;
    margin: 0 !important;
    overflow: hidden;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* --- Product Catalog Styling --- */
.catalog-list-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.catalog-list {
  max-height: 180px;
  overflow-y: auto;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.catalog-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.catalog-item:last-child {
  border-bottom: none;
}

.catalog-item:hover {
  background-color: var(--bg-input);
}

.btn-quick-add-product {
  background-color: var(--primary-light);
  color: var(--primary-color);
  border: none;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.btn-quick-add-product:hover {
  background-color: var(--primary-color);
  color: #ffffff;
}

.btn-quick-add-product i {
  width: 14px;
  height: 14px;
}

.catalog-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  text-align: left;
}

.catalog-item-name {
  font-weight: 600;
  color: var(--text-dark);
}

.catalog-item-price {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.btn-remove-catalog-item {
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-remove-catalog-item:hover {
  background-color: #fee2e2;
}

.btn-remove-catalog-item i {
  width: 14px;
  height: 14px;
}

.catalog-empty-msg {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--text-light);
  text-align: center;
  padding: 1.5rem 0;
}

/* Canvas Add Item Styles */
.canvas-add-item-row {
  margin-top: 0.75rem;
  display: flex;
  justify-content: flex-start;
}

.btn-canvas-add {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-color);
  background-color: transparent;
  border: 1px dashed var(--primary-color);
  border-radius: var(--radius-sm);
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-canvas-add:hover {
  background-color: var(--primary-light);
  border-style: solid;
}

.btn-canvas-add i {
  width: 14px;
  height: 14px;
}

/* Utility to hide elements during print capture */
@media print {
  .no-print {
    display: none !important;
  }
}

/* Canvas Dropdown Selector styling */
.canvas-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.25rem;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  width: 260px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: 0.35rem 0;
}

.canvas-dropdown.hidden {
  display: none;
}

.canvas-dropdown-item {
  background: transparent;
  border: none;
  text-align: left;
  padding: 0.55rem 0.85rem;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text-dark);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.canvas-dropdown-item:hover {
  background-color: var(--bg-input);
  color: var(--primary-color);
}

.canvas-dropdown-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 0.25rem 0;
}

.canvas-dropdown-search-wrapper {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border-color);
  background-color: #fafbfb;
  position: sticky;
  top: 0;
  z-index: 1;
}

.canvas-dropdown-search-input {
  width: 100%;
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  outline: none;
  background-color: #ffffff;
  transition: var(--transition-fast);
}

.canvas-dropdown-search-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.canvas-dropdown-items-container {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0.25rem 0;
}

/* Responsive Tablet & Mobile Media Queries */
@media (max-width: 1023px) {
  /* Stack the layout vertically */
  .app-container {
    flex-direction: column;
    height: auto;
    overflow-y: visible;
  }
  
  .sidebar {
    width: 100%;
    max-width: none;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1rem;
    overflow-y: visible;
  }
  
  .preview-canvas {
    width: 100%;
    padding: 2rem 0.5rem;
    background-color: #cbd5e1;
    overflow-x: hidden;
  }
  
  /* Stacking Header Content */
  .app-header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
    height: auto;
    padding: 1rem;
  }
  
  .header-actions {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
  }
  
  .zoom-controls {
    margin-right: 0;
    flex-grow: 1;
    justify-content: center;
  }
  
  .header-actions .btn {
    flex-grow: 1;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }
}

/* Developer Credit Styling */
.app-credit {
  margin-top: auto;
  padding: 1.5rem 0 0.5rem 0;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
}

.app-credit a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition-fast);
}

.app-credit a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Custom Currency Symbol Scaling */
.currency-symbol {
  font-size: 1.18em;
  margin-right: 0.05em;
  display: inline-block;
  vertical-align: baseline;
  font-weight: inherit;
}
