/* =====================================================
   REPORTS PAGE STYLES
   ===================================================== */

/* Selection form */
.field-group {
  margin-bottom: 16px;
}
.field-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}
.form-select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 15px;
  color: #333;
  background: white;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.form-select:focus {
  outline: none;
  border-color: #7B1FA2;
  box-shadow: 0 0 0 3px rgba(123,31,162,0.10);
}
.form-select:disabled {
  background-color: #f5f5f5;
  color: #999;
}
.form-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: #333;
  background: white;
  resize: vertical;
  min-height: 60px;
  box-sizing: border-box;
}
.form-textarea:focus {
  outline: none;
  border-color: #7B1FA2;
  box-shadow: 0 0 0 3px rgba(123,31,162,0.10);
}
.form-textarea::placeholder {
  color: #aaa;
}


.generate-btn {
  width: 100%;
  background: #7B1FA2;
  color: white;
  border: none;
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s;
}
.generate-btn:hover:not(:disabled) { background: #6A1B9A; }
.generate-btn:disabled { background: #b0b0b0; cursor: not-allowed; }

/* Progress */
.progress-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}
.progress-msg {
  color: #555;
  font-size: 15px;
}

/* Report actions bar */
.report-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.action-btn {
  background: #7B1FA2;
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.action-btn:hover { background: #6A1B9A; }
.action-btn.secondary {
  background: white;
  color: #7B1FA2;
  border: 1px solid #7B1FA2;
}
.action-btn.secondary:hover { background: #f3e5f5; }

/* Report container */
.report-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 40px;
  line-height: 1.6;
  color: #333;
}

/* Report header */
.report-header {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 3px solid #7B1FA2;
}
.report-header h1 {
  font-size: 22px;
  color: #333;
  margin: 0 0 4px;
}
.report-header .report-subtitle {
  font-size: 16px;
  font-weight: 500;
  color: #666;
  margin: 4px 0 2px;
}
.report-header .facility-name {
  font-size: 28px;
  font-weight: 700;
  color: #7B1FA2;
  margin: 0;
}

/* Metadata table */
.meta-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 28px;
}
.meta-table td {
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  font-size: 14px;
}
.meta-table td:first-child {
  font-weight: 600;
  color: #555;
  width: 180px;
  background: #fafafa;
}

/* Section headers */
.report-section-title {
  font-size: 18px;
  font-weight: 700;
  color: #333;
  margin: 32px 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e0e0e0;
}

/* Introduction paragraph */
.report-intro {
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 28px;
}

/* Primary facility photo */
.facility-photo-section {
  text-align: center;
  margin-bottom: 28px;
}
.facility-photo-section img {
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  display: inline-block;
}
.facility-photo-caption {
  font-size: 13px;
  color: #666;
  margin: 8px 0 0;
  font-style: italic;
}

/* Cost summary table */
.cost-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 28px;
}
.cost-table th {
  background: #7B1FA2;
  color: white;
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
}
.cost-table td {
  padding: 9px 14px;
  border-bottom: 1px solid #e0e0e0;
  font-size: 14px;
}
.cost-table tr:last-child td {
  border-bottom: 2px solid #7B1FA2;
}
.cost-table .cost-total td {
  font-weight: 700;
  background: #f3e5f5;
  border-top: 2px solid #7B1FA2;
}
.cost-table .cost-value {
  text-align: right;
  font-family: 'Courier New', monospace;
}

/* System overview table */
.system-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 28px;
}
.system-table th {
  background: #f5f5f5;
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #e0e0e0;
}
.system-table td {
  padding: 9px 14px;
  border-bottom: 1px solid #eee;
  font-size: 14px;
  vertical-align: top;
}
.sys-info-details {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #e0e0e0;
  font-size: 12px;
  color: #666;
  line-height: 1.5;
}
.sys-info-item {
  display: block;
  margin-bottom: 4px;
}
.sys-info-item strong {
  color: #555;
}
.sys-info-photos {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.sys-info-photo {
  width: 140px;
  height: 100px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
}

/* Deficiency section */
.def-system-header {
  font-size: 15px;
  font-weight: 700;
  color: #7B1FA2;
  margin: 24px 0 8px;
  padding: 6px 0;
  border-bottom: 1px solid #e0e0e0;
}

.def-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}
.def-table th {
  background: #fafafa;
  padding: 8px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  border-bottom: 1px solid #e0e0e0;
}
.def-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  font-size: 13px;
  vertical-align: top;
}
.def-table .photo-cell {
  width: 120px;
}
.def-table .photo-cell img {
  width: 100%;
  border-radius: 4px;
  display: block;
}
.def-table .photo-cell .no-photo {
  width: 100%;
  height: 80px;
  background: #f5f5f5;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bbb;
  font-size: 12px;
}
.def-table .narrative-cell {
  line-height: 1.6;
}
.def-table .narrative-cell .def-type {
  font-weight: 600;
  color: #333;
  display: block;
  margin-bottom: 4px;
}
.def-table .narrative-cell .def-severity {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 6px;
}
.def-severity.major    { background: #ffebee; color: #c62828; }
.def-severity.moderate { background: #fff3e0; color: #e65100; }
.def-severity.minor    { background: #f5f5f5; color: #666; }
.def-table .cost-cell {
  width: 110px;
  text-align: right;
  font-family: 'Courier New', monospace;
  font-weight: 600;
}

/* Error display */
.error-card {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}
.error-card h3 { margin: 0 0 8px; font-size: 15px; }
.error-card p { margin: 0; font-size: 14px; }

/* MPS Export inline buttons */
.field-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.field-row .form-select {
  flex: 1;
}
.mps-btn {
  background: #FF9800;
  color: white;
  border: none;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.mps-btn:hover:not(:disabled) { background: #F57C00; }
.mps-btn:disabled { background: #ccc; cursor: not-allowed; }

/* ==================== PRINT STYLES ==================== */
@media print {
  body {
    background: white;
    padding: 0;
    margin: 0;
  }
  .nav-link,
  .subtitle,
  .report-actions,
  #selectCard,
  #progressCard {
    display: none !important;
  }
  h1 { display: none; }
  .container { max-width: 100%; }
  .report-container {
    box-shadow: none;
    padding: 0;
  }
  .report-header {
    border-bottom-color: #333;
  }
  .report-header .report-subtitle {
    color: #555;
  }
  .report-header .facility-name {
    color: #333;
  }
  .cost-table th {
    background: #333;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .facility-photo-section {
    page-break-inside: avoid;
  }
  .facility-photo-section img {
    max-height: 300px;
  }
  .def-table .photo-cell img {
    max-width: 100px;
  }
  .def-system-header {
    color: #333;
  }
  .report-section-title {
    page-break-after: avoid;
  }
  .def-table {
    page-break-inside: avoid;
  }
  .def-table tr {
    page-break-inside: avoid;
  }
  .sys-info-photo {
    width: 100px;
    height: 70px;
  }
}
