/* Pioneer Forest Load Calculator — TRACE Checksum Format */

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

body {
  font-family: "Segoe UI", -apple-system, sans-serif;
  font-size: 11px;
  color: #1a1a1a;
  background: #f5f5f5;
  line-height: 1.35;
}

.app-header {
  background: #1a1a1a;
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: baseline;
  gap: 16px;
}
.app-header h1 { font-size: 15px; font-weight: 600; }
.app-header .subtitle { font-size: 11px; color: rgba(255,255,255,0.6); }

#room-selector {
  background: #fff;
  padding: 8px 20px;
  border-bottom: 1px solid #ddd;
  display: flex;
  align-items: center;
  gap: 10px;
}
#room-selector label { font-weight: 600; font-size: 11px; }
#room-select {
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid #ccc;
  min-width: 280px;
}
#recalc-btn {
  font-size: 10px;
  padding: 4px 12px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  cursor: pointer;
}

.app-footer {
  padding: 8px 20px;
  font-size: 9px;
  color: #999;
  border-top: 1px solid #ddd;
  text-align: center;
}

/* ─── Room Checksum Card ─── */

.room-checksum {
  background: #fff;
  margin: 10px;
  padding: 14px 16px 10px;
  border: 1px solid #ccc;
  font-feature-settings: "tnum" 1;
}

.room-title {
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1px;
}
.room-subtitle {
  font-size: 10px;
  text-align: center;
  color: #666;
  margin-bottom: 6px;
}
.room-name {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

/* Grid: loads left, info right */
.checksum-grid {
  display: flex;
  gap: 12px;
}

.loads-section {
  flex: 3;
  min-width: 0;
}

.right-section {
  flex: 1.2;
  min-width: 0;
}

/* Peak headers */
.peak-headers {
  display: flex;
  gap: 2px;
  margin-bottom: 2px;
}
.peak-col-header {
  flex: 1;
  font-weight: 700;
  font-size: 10px;
  text-align: center;
  background: #f0f0f0;
  padding: 3px 4px;
  border: 1px solid #ccc;
}

.peak-info {
  display: flex;
  gap: 2px;
  font-size: 9px;
  color: #555;
  margin-bottom: 1px;
}
.peak-info > div {
  flex: 1;
  padding: 1px 4px;
}

/* Load table */
.load-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  margin-top: 4px;
}
.load-table th {
  font-size: 8px;
  font-weight: 600;
  text-align: left;
  padding: 2px 3px;
  border-bottom: 1px solid #999;
  white-space: nowrap;
  color: #555;
  vertical-align: bottom;
  line-height: 1.2;
}
.load-table td {
  padding: 1px 3px;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
}
.load-table .r, .load-table th.r { text-align: right; }

.load-table tr.section-label td {
  font-weight: 700;
  font-size: 9px;
  padding-top: 4px;
  border-bottom: none;
  color: #333;
}

.load-table tr.subtotal td {
  font-weight: 600;
  border-top: 1px solid #999;
  border-bottom: 1px solid #999;
  font-style: italic;
}

.load-table tr.grand-total td {
  font-weight: 700;
  border-top: 2px solid #333;
  border-bottom: 2px solid #333;
  font-size: 11px;
  padding-top: 3px;
  padding-bottom: 3px;
}

/* Right-side info blocks */
.info-block {
  margin-bottom: 8px;
}
.info-block h4 {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f0f0f0;
  padding: 2px 4px;
  border: 1px solid #ccc;
  margin-bottom: 2px;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9.5px;
}
.info-table th {
  font-size: 8px;
  font-weight: 600;
  text-align: left;
  padding: 1px 3px;
  border-bottom: 1px solid #bbb;
  color: #555;
}
.info-table td {
  padding: 1px 3px;
  border-bottom: 1px solid #eee;
}
.info-table .r, .info-table th.r { text-align: right; }

/* Coil selection */
.coil-section {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #ddd;
}
.coil-half {
  flex: 1;
}
.coil-half h4 {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.page-break {
  height: 0;
}

/* ─── Print Styles ─── */
@media print {
  body {
    background: #fff;
    font-size: 9.5px;
  }

  .app-header, #room-selector, .app-footer, #recalc-btn {
    display: none !important;
  }

  .room-checksum {
    margin: 0;
    padding: 8px 0;
    border: 1px solid #000;
    page-break-inside: avoid;
    page-break-after: always;
  }

  .page-break {
    page-break-after: always;
    height: 0;
  }

  @page {
    size: letter landscape;
    margin: 0.4in 0.3in;
  }

  .load-table { font-size: 9px; }
  .info-table { font-size: 8.5px; }
  .room-title { font-size: 12px; }
  .room-name { font-size: 11px; }

  .load-table td,
  .load-table th {
    padding: 1px 2px;
  }

  .info-table td,
  .info-table th {
    padding: 1px 2px;
  }

  .checksum-grid { gap: 8px; }
}
