/**
 * pdf.css
 * Styling for the PDF output — light theme, professional layout.
 * This CSS is applied to the temporary HTML container used by html2pdf.js.
 */

/* ─── PDF Document Container ────────────────────────────────────────── */
#pdf-render-container {
  width: 190mm;
  margin: 0;
  padding: 0;
  background: #ffffff;
  box-sizing: border-box;
  box-sizing: border-box;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 99998;
}

#pdf-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000000;
  color: white;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-family: sans-serif;
  font-size: 16px;
  font-weight: bold;
}

.pdf-document {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 11px;
  line-height: 1.5;
  color: #1a1a1a;
  background: #ffffff;
  padding: 0;
  width: 100%;
  box-sizing: border-box;
}

/* ─── PDF Header ────────────────────────────────────────────────────── */
.pdf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 15px;
  border: 1px solid #0000cc; /* Blue border matching image */
  margin-bottom: 15px;
  background: white;
}

.pdf-header-text {
  flex: 1;
  text-align: center;
  padding-right: 15px;
}

.pdf-workshop-name {
  font-family: 'Times New Roman', Times, serif;
  font-size: 20px;
  font-weight: 800;
  color: #000;
  margin: 0 0 4px 0;
  letter-spacing: 0.5px;
}

.pdf-workshop-detail {
  font-size: 11px;
  color: #000;
  margin: 2px 0;
}

.pdf-header-logo {
  flex-shrink: 0;
}

.pdf-logo {
  width: 140px;
  height: auto;
  object-fit: contain;
}

/* ─── Title Bar ─────────────────────────────────────────────────────── */
.pdf-title-bar {
  background: #f97316;
  color: white;
  text-align: center;
  padding: 8px;
  margin-bottom: 15px;
}

.pdf-title-bar h2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  margin: 0;
}

/* ─── PDF Sections ──────────────────────────────────────────────────── */
.pdf-section {
  margin-bottom: 15px;
}

.pdf-section-title {
  font-size: 12px;
  font-weight: 700;
  color: #0a0f1a;
  padding: 6px 10px;
  background: #f1f5f9;
  border-left: 3px solid #f97316;
  margin-bottom: 8px;
}

/* ─── PDF Tables ────────────────────────────────────────────────────── */
.pdf-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 5px;
}

.pdf-table th,
.pdf-table td {
  padding: 5px 8px;
  text-align: left;
  font-size: 10px;
  border: 1px solid #e2e8f0;
}

.pdf-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #334155;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Customer table */
.pdf-customer-table .pdf-td-label {
  width: 140px;
  font-weight: 600;
  color: #475569;
  background: #f8fafc;
}

.pdf-customer-table .pdf-td-value {
  color: #1a1a1a;
}

/* Inspection table columns */
.pdf-th-code  { width: 35px; text-align: center; }
.pdf-th-item  { }
.pdf-th-status { width: 95px; text-align: center; }
.pdf-th-note  { width: 140px; }

.pdf-td-code {
  text-align: center;
  font-weight: 600;
  color: #f97316;
  font-size: 9px;
}

.pdf-td-item {
  font-size: 10px;
}

.pdf-td-status {
  text-align: center;
}

.pdf-td-note {
  font-size: 9px;
  color: #64748b;
}

/* ─── Status Badges ─────────────────────────────────────────────────── */
.pdf-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 600;
  text-align: center;
}

.pdf-badge-good {
  background: #dcfce7;
  color: #166534;
}

.pdf-badge-warning {
  background: #fef9c3;
  color: #854d0e;
}

.pdf-badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.pdf-badge-unchecked {
  background: #f3f4f6;
  color: #6b7280;
}

/* Row background hint */
.pdf-status-good td    { background: #f0fdf4; }
.pdf-status-warning td { background: #fefce8; }
.pdf-status-danger td  { background: #fef2f2; }

/* ─── Photos in PDF ─────────────────────────────────────────────────── */
.pdf-photo-row td {
  padding: 5px 8px;
  background: #fafafa;
}

.pdf-photos {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pdf-photo {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

/* ─── Stats Bar ─────────────────────────────────────────────────────── */
.pdf-stats-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.pdf-stat {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
}

.pdf-stat-good      { background: #dcfce7; color: #166534; }
.pdf-stat-warning   { background: #fef9c3; color: #854d0e; }
.pdf-stat-danger    { background: #fee2e2; color: #991b1b; }
.pdf-stat-unchecked { background: #f3f4f6; color: #6b7280; }

/* ─── Summary Blocks ────────────────────────────────────────────────── */
.pdf-summary-block {
  margin-bottom: 10px;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.pdf-summary-block strong {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 3px;
}

.pdf-summary-block p {
  font-size: 10px;
  color: #475569;
  white-space: pre-wrap;
  margin: 0;
}

/* ─── Footer / Signature ────────────────────────────────────────────── */
.pdf-footer {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #e2e8f0;
}

.pdf-signature-area {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 20px;
}

.pdf-signature-block {
  text-align: center;
  flex: 1;
}

.pdf-signature-block p {
  font-size: 10px;
  color: #475569;
  margin: 0;
}

.pdf-signature-line {
  width: 150px;
  height: 1px;
  background: #1a1a1a;
  margin: 50px auto 5px;
}

.pdf-signature-name {
  font-weight: 600;
  color: #1a1a1a !important;
}

.pdf-signature-role {
  font-size: 9px !important;
  color: #94a3b8 !important;
}

.pdf-footer-info {
  text-align: center;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.pdf-footer-info p {
  font-size: 9px;
  color: #94a3b8;
  margin: 2px 0;
}

.pdf-disclaimer {
  font-style: italic;
  font-size: 8px !important;
}

/* ─── Page Break Control ────────────────────────────────────────────── */
.pdf-header,
.pdf-customer-table,
.pdf-item-row,
.pdf-photo-row,
.pdf-summary-block,
.pdf-signature-area,
.pdf-footer {
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

.pdf-category-section,
.pdf-section {
  page-break-inside: auto !important;
  break-inside: auto !important;
}
