*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: #f5f5f7;
  color: #111827;
}

body {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.app-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  padding: 1.25rem 1.5rem;
  background: #111827;
  color: white;
}

.app-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

.app-header p {
  margin: 0;
  opacity: 0.85;
  font-size: 0.9rem;
}

.app-main {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.5rem;
}

@media (max-width: 960px) {
  .app-main {
    grid-template-columns: minmax(0, 1fr);
  }
}

.form-section {
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  padding: 1.25rem 1.25rem 1rem;
  align-self: flex-start;
}

.form-section h2 {
  margin: 0 0 1rem;
  font-size: 1.2rem;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem 1rem;
}

@media (min-width: 640px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.form-field {
  display: flex;
  flex-direction: column;
}

.form-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.25rem;
}

.required {
  color: #b91c1c;
  margin-left: 2px;
}

.form-field input {
  padding: 0.4rem 0.55rem;
  border-radius: 0.4rem;
  border: 1px solid #d1d5db;
  font-size: 0.85rem;
}

.form-field input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.3);
}

.readonly-field input {
  background-color: #f9fafb;
  color: #4b5563;
}

.hint-text {
  font-size: 0.72rem;
  color: #6b7280;
  margin-top: 0.15rem;
}

.error-text {
  font-size: 0.72rem;
  color: #b91c1c;
  margin-top: 0.15rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.form-actions button {
  border-radius: 999px;
  border: none;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  background: #e5e7eb;
  color: #111827;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease;
}

.form-actions button.primary {
  background: #2563eb;
  color: white;
}

.form-actions button.secondary {
  background: #f97316;
  color: white;
}

.form-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.18);
}

.form-actions button:active {
  transform: translateY(0);
  box-shadow: none;
}

.print-notes {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px dashed #e5e7eb;
}

.print-notes h3 {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
}

.print-notes ul {
  margin: 0.25rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.78rem;
  color: #4b5563;
}

.preview-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.preview-section h2 {
  margin: 0;
  font-size: 1.05rem;
}

.page-a4 {
  width: 210mm;
  height: 297mm;
  background: white;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  border-radius: 0.25rem;
  padding-top: 13mm; /* top margin */
  padding-left: 5mm; /* left margin */
  padding-right: 5mm;
  padding-bottom: 5mm;
  position: relative;
}

/* Label grid: 3 columns of 63.5mm width with 2.5mm gap */
.label-grid {
  display: grid;
  grid-template-columns: repeat(3, 64mm);
  grid-auto-rows: 34mm;
  column-gap: 2.5mm;
  row-gap: 0mm; /* labels touch vertically */
}

.label {
  border: 0.3pt solid #d1d5db;
  padding: 1mm 1.5mm 0.5mm;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 8pt;
  overflow: hidden;
}

.label-top {
  text-align: center;
}

.label-product-name {
  font-weight: 700;
  font-size: 18px;
  line-height: 1.1;
}

.label-prices {
  text-align: center;
  margin-top: 0.5mm;
}

.label-mrp {
  font-size: 14px;
  text-decoration: line-through;
  color: #6b7280;
}

.label-offer {
  font-size: 16px;
  font-weight: 700;
  margin-top: 0.25mm;
}

.offer-value {
  font-size: 20px;
}

.label-barcode {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 0.5mm;
}

.barcode-svg {
  width: 100%;
  height: 7mm;
}

.barcode-text {
  font-size: 9px;
  margin-top: 0.25mm;
}

.label-footer {
  margin-top: 0.25mm;
  font-size: 8px;
  line-height: 1.1;
  text-align: center;
}

.footer-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* PRINT STYLES */
@media print {
  body {
    margin: 0;
    background: white;
  }

  .no-print {
    display: none !important;
  }

  .app-header {
    display: none !important;
  }

  .app-main {
    padding: 0;
    display: block;
  }

  .form-section {
    display: none !important;
  }

  .preview-section {
    margin: 0;
  }

  .page-a4 {
    margin: 0;
    box-shadow: none;
    border-radius: 0;
  }
}

@page {
  size: A4 portrait;
  margin: 0;
}


