/* ==========================================================================
   WeighMaster Pro - Modern Styling & Authentic Dot Matrix Print System
   ========================================================================== */

:root {
  /* UI Color Palette */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-input: #0f172a;
  --border-color: #334155;
  --border-focus: #3b82f6;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --danger: #ef4444;

  /* Continuous Form Paper Palette */
  --paper-bg: #fcfbf7;
  --paper-shadow: rgba(0, 0, 0, 0.45);
  --paper-hole-bg: #1e293b;
  --paper-hole-border: #cbd5e1;
  --perf-line: #cbd5e1;
  --ink-color: #111111;
  --ink-faint: #2b2b2b;

  /* Typography */
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-dot-matrix: 'VT323', monospace;
  --font-courier: 'Courier Prime', Courier, monospace;
  --font-system-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-ui);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   App Layout
   -------------------------------------------------------------------------- */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Navigation Bar */
.top-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background-color: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
  color: white;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.35);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, #60a5fa, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Buttons System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.4);
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: #334155;
  color: var(--text-main);
  border-color: #475569;
}
.btn-secondary:hover {
  background-color: #475569;
}

.btn-outline {
  background-color: transparent;
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-outline:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: #64748b;
}

.btn-outline-danger {
  background-color: transparent;
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-outline-danger:hover {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.btn-xs {
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  border-radius: 4px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
.btn-icon:hover {
  background-color: #334155;
}

.btn-group {
  display: inline-flex;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}
.btn-group .btn {
  border-radius: 0;
  border: none;
  background: var(--bg-card);
  color: var(--text-muted);
}
.btn-group .btn.active {
  background-color: var(--primary);
  color: white;
}

.w-100 {
  width: 100%;
}

/* --------------------------------------------------------------------------
   Main Content Layout (Dual Pane)
   -------------------------------------------------------------------------- */
.main-content {
  display: grid;
  grid-template-columns: 480px 1fr;
  flex: 1;
  min-height: calc(100vh - 65px);
}

@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   LEFT COLUMN: Form Input Panel
   -------------------------------------------------------------------------- */
.form-panel {
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-height: calc(100vh - 65px);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.panel-header-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.panel-header-title h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}
.panel-header-title svg {
  color: var(--primary);
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-info {
  background-color: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.3);
}
.badge-primary {
  background-color: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Cards */
.form-card {
  background-color: #172033;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transition: border-color 0.2s;
}
.form-card:hover {
  border-color: #475569;
}
.form-card.highlight-card {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.1);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background-color: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
}

.card-step {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background-color: var(--primary);
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
}

.card-header h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.card-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.subcard {
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.subcard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Form Controls & Grids */
.form-row {
  display: flex;
  gap: 0.65rem;
}
.col-4 { flex: 4; }
.col-5 { flex: 5; }
.col-6 { flex: 6; }
.col-7 { flex: 7; }
.col-8 { flex: 8; }

.btn-align-bottom {
  display: flex;
  align-items: flex-end;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  font-family: inherit;
  font-size: 0.85rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  outline: none;
  transition: all 0.15s ease;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.text-uppercase {
  text-transform: uppercase;
}

.font-bold {
  font-weight: 700;
}

.input-unit-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-unit-wrapper .form-control {
  padding-right: 2rem;
}

.unit-tag {
  position: absolute;
  right: 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

/* Auto Net Weight Display Banner */
.net-weight-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(6, 182, 212, 0.15));
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 6px;
  padding: 0.75rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.net-weight-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #34d399;
}

.net-weight-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  font-family: var(--font-courier);
  letter-spacing: 0.05em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.net-weight-calc {
  font-size: 0.72rem;
  color: #94a3b8;
  font-family: var(--font-courier);
}

/* Signature Section */
.signature-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.signature-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.signature-header label {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.signature-controls {
  display: flex;
  gap: 0.4rem;
}

.canvas-wrapper {
  position: relative;
  background-color: #ffffff;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  width: 100%;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: crosshair;
}

#signature-canvas {
  width: 100%;
  height: 100%;
}

.canvas-placeholder {
  position: absolute;
  color: #94a3b8;
  font-size: 0.75rem;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   RIGHT COLUMN: Preview Panel & Continuous Paper
   -------------------------------------------------------------------------- */
.preview-panel {
  background-color: #0b0f19;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: calc(100vh - 65px);
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 1.25rem;
  background-color: rgba(30, 41, 59, 0.85);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 0.75rem;
  z-index: 10;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.form-select-sm {
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
}

.zoom-indicator {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 42px;
  text-align: center;
}

.preview-viewport {
  flex: 1;
  overflow: auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: radial-gradient(circle at center, #162033 0%, #0b0f19 100%);
}

/* --------------------------------------------------------------------------
   AUTHENTIC CONTINUOUS FORM PAPER (DOT MATRIX RECEIPT)
   -------------------------------------------------------------------------- */
.continuous-paper {
  position: relative;
  background-color: var(--paper-bg);
  color: var(--ink-color);
  width: 820px;
  min-height: 480px;
  box-shadow: 0 10px 30px var(--paper-shadow), 0 1px 3px rgba(0, 0, 0, 0.2);
  display: flex;
  border-radius: 2px;
  transform-origin: top center;
  transition: transform 0.15s ease-out;
}

/* Font Style Switching */
.font-vt323 {
  font-family: var(--font-dot-matrix);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}

.font-courier {
  font-family: var(--font-courier);
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.font-system {
  font-family: var(--font-system-mono);
  font-size: 0.92rem;
  letter-spacing: 0;
}

/* Left & Right Perforated Margin Strips (Tractor Feed) */
.tractor-margin {
  width: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  padding: 1.25rem 0;
  user-select: none;
  position: relative;
}

.tractor-left {
  border-right: 1px dashed var(--perf-line);
}

.tractor-right {
  border-left: 1px dashed var(--perf-line);
}

.tractor-hole {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: var(--paper-hole-bg);
  box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.8), 0 0 1px rgba(255, 255, 255, 0.4);
}

.tractor-slit {
  position: absolute;
  bottom: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 1px;
}

/* Clean Paper View (Tractor Margin Hidden) */
.clean-paper-mode .tractor-margin {
  display: none !important;
}
.clean-paper-mode {
  width: 720px;
  padding: 1.5rem;
}

/* --------------------------------------------------------------------------
   Ticket Body & Document Content
   -------------------------------------------------------------------------- */
.ticket-body {
  flex: 1;
  padding: 1.5rem 1.8rem;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Top Timestamp Row */
.ticket-top-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.4rem;
}

.ticket-top-right {
  font-weight: 600;
  color: var(--ink-faint);
}

/* Company Header */
.ticket-company-block {
  margin-bottom: 0.75rem;
  line-height: 1.25;
}

.company-name {
  font-size: 1.25em;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.company-sub {
  font-size: 0.95em;
  color: var(--ink-faint);
}

/* Center Title */
.ticket-title-wrapper {
  text-align: center;
  margin: 0.6rem 0 0.85rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ticket-title {
  font-size: 1.35em;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.ticket-title-underline {
  width: 160px;
  height: 1px;
  background-color: var(--ink-color);
  margin-top: 2px;
}

/* 2-Column Metadata Grid */
.ticket-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 2rem;
  row-gap: 0.2rem;
  margin-bottom: 0.75rem;
}

.meta-col {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.meta-row {
  display: flex;
  align-items: baseline;
  line-height: 1.3;
}

.meta-label {
  width: 140px;
  flex-shrink: 0;
}

.meta-colon {
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.meta-value {
  flex: 1;
  word-break: break-word;
}

.font-strong {
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Table & Document Content Refinements
   -------------------------------------------------------------------------- */
.ticket-table {
  width: 100%;
  border-collapse: collapse;
}

.ticket-table thead tr th {
  border-top: 3px double var(--ink-color);
  border-bottom: 1px solid var(--ink-color);
  padding: 0.35rem 0.5rem;
  font-weight: 700;
}

.ticket-table tbody tr td {
  padding: 0.3rem 0.5rem;
}

.ticket-table tbody tr:last-child td {
  border-bottom: 1px solid var(--ink-color);
}

.col-timbang {
  width: 14%;
  text-align: left;
}
.col-tanggal {
  width: 28%;
  text-align: center;
}
.col-jam {
  width: 26%;
  text-align: center;
}
.col-berat {
  width: 32%;
  text-align: right;
  font-weight: 700;
}

/* Summary Grid (Bottom Area) */
.ticket-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 2rem;
  margin-top: 0.5rem;
  margin-bottom: 1.25rem;
}

.summary-left {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 0.2rem;
}

.karung-line {
  display: flex;
  align-items: baseline;
}

.summary-right {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: flex-end;
}

/* Boxed Weight Display */
.net-weight-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
  width: 100%;
}

.net-title {
  font-weight: 600;
}

.boxed-value {
  border: 1px solid var(--ink-color);
  padding: 0.15rem 0.65rem;
  width: 190px;
  text-align: right;
  font-weight: 700;
  font-size: 1.15em;
  background-color: transparent;
}

/* Financial Lines */
.finance-block {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  align-items: flex-end;
  width: 100%;
}

.finance-row {
  display: flex;
  align-items: baseline;
  width: 220px;
  justify-content: space-between;
}

.finance-label {
  flex: 1;
  text-align: left;
}

.finance-colon {
  display: none;
}

.finance-val {
  width: 40px;
  text-align: right;
}

/* Total Boxed */
.total-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.4rem;
  width: 100%;
}

.total-label {
  font-weight: 600;
}

.total-colon {
  margin-right: 0.25rem;
}

.total-boxed-value {
  border: 1px solid var(--ink-color);
  padding: 0.2rem 0.65rem;
  width: 150px;
  min-height: 28px;
  text-align: right;
  font-weight: 700;
}

/* Signatures Row */
.ticket-signatures-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  margin-top: 1.5rem;
  text-align: center;
}

.sign-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sign-space {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.signature-stamp {
  max-height: 48px;
  max-width: 130px;
  object-fit: contain;
  filter: contrast(150%) brightness(80%);
}

.sign-title {
  font-weight: 600;
  font-size: 0.95em;
  letter-spacing: 0.05em;
}

/* --------------------------------------------------------------------------
   Modal / Drawer for Ticket History
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-dialog {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  width: 100%;
  max-width: 650px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}
.modal-title-wrap svg {
  color: var(--primary);
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}
.btn-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 380px;
  overflow-y: auto;
}

.history-item {
  background-color: #172033;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.15s ease;
}
.history-item:hover {
  border-color: var(--primary);
  background-color: #1e293b;
}

.history-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.history-item-no {
  font-weight: 700;
  color: #60a5fa;
  font-size: 0.9rem;
}

.history-item-details {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.history-item-net {
  font-weight: 700;
  color: #34d399;
  font-size: 0.95rem;
}

.history-item-actions {
  display: flex;
  gap: 0.4rem;
}

.history-empty-message {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.modal-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Toast System */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background-color: #1e293b;
  color: #ffffff;
  border: 1px solid var(--primary);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 200;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toolbar-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.toolbar-checkbox-label input[type="checkbox"] {
  accent-color: var(--primary);
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   PRINT STYLESHEET (@media print)
   Critical: When printing, hide all UI, buttons, borders, preview backgrounds.
   Scale and center the ticket on paper cleanly!
   -------------------------------------------------------------------------- */
@media print {
  @page {
    /* Standard continuous form half-letter or A5 landscape */
    size: auto;
    margin: 5mm 8mm;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 13pt;
  }

  /* Hide app navigation, input form panel, toolbar, history modal, toast */
  .top-navbar,
  .form-panel,
  .preview-toolbar,
  .modal-backdrop,
  .toast {
    display: none !important;
  }

  /* By default hide tractor holes during print on pre-punched paper, unless enabled */
  body:not(.print-with-holes) .tractor-margin {
    display: none !important;
  }

  body.print-with-holes .tractor-margin {
    display: flex !important;
    padding: 0 !important;
  }

  body.print-with-holes .tractor-hole {
    background-color: #ffffff !important;
    border: 1px solid #000000 !important;
    box-shadow: none !important;
  }

  .main-content {
    display: block !important;
    min-height: auto !important;
  }

  .preview-panel {
    background: transparent !important;
    height: auto !important;
    overflow: visible !important;
  }

  .preview-viewport {
    background: transparent !important;
    padding: 0 !important;
    overflow: visible !important;
    display: block !important;
  }

  .continuous-paper {
    box-shadow: none !important;
    background: #ffffff !important;
    color: #000000 !important;
    width: 100% !important;
    max-width: 100% !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .ticket-body {
    padding: 5mm !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Force sharp black borders and fonts */
  .company-name,
  .ticket-title,
  .font-strong,
  .col-berat,
  .boxed-value,
  .total-boxed-value,
  .sign-title {
    color: #000000 !important;
    font-weight: 700 !important;
  }

  .double-line-top,
  .ticket-table thead tr th {
    border-top: 3px double #000000 !important;
    border-bottom: 1px solid #000000 !important;
  }

  .single-line-bottom,
  .ticket-table tbody tr:last-child td {
    border-bottom: 1px solid #000000 !important;
  }

  .ticket-title-underline {
    background-color: #000000 !important;
  }

  .boxed-value,
  .total-boxed-value {
    border: 1px solid #000000 !important;
  }

  .signature-stamp {
    filter: grayscale(100%) contrast(200%) !important;
  }
}
