/* ==========================================================================
   FEATURON - Service Request Form (SRF) Stylesheet
   Exact A4 Dimension Calibration Matching Service Report (210mm x 297mm)
   ========================================================================== */

@page {
  size: A4 portrait;
  margin: 4mm 6mm;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #e5e5e5;
  font-family: 'Barlow', Arial, sans-serif;
  color: #111;
  font-weight: 500;
  font-size: 11.5px;
  line-height: 1.15;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* Floating Action Toolbar (210mm matching page width) */
.tools {
  width: 210mm;
  margin: 10px auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.tools button, .tools a {
  background: #047A3D;
  color: #fff;
  border: none;
  padding: 7px 12px;
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  transition: background 0.15s;
}

.tools button:hover, .tools a:hover {
  background: #036130;
}

.tools .btn-secondary {
  background: #475569;
}
.tools .btn-secondary:hover {
  background: #334155;
}

.tools .btn-new {
  background: #0284c7;
}
.tools .btn-new:hover {
  background: #0369a1;
}

.tools .btn-convert {
  background: #7c3aed;
}
.tools .btn-convert:hover {
  background: #6d28d9;
}

.tools .btn-engineer-close {
  background: #047A3D;
}
.tools .btn-engineer-close:hover {
  background: #036130;
}

.tools .btn-danger {
  background: #dc2626;
}
.tools .btn-danger:hover {
  background: #b91c1c;
}

.tools .fetch-box {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.tools .fetch-input {
  border: none;
  padding: 6px 10px;
  font-size: 12px;
  font-family: 'Barlow', Arial, sans-serif;
  font-weight: 700;
  width: 140px;
  outline: none;
  color: #1e293b;
  text-transform: uppercase;
}
.tools .fetch-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
  text-transform: none;
}

.tools .btn-fetch {
  background: #0f172a;
  color: #fff;
  border: none;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 0;
  box-shadow: none;
}
.tools .btn-fetch:hover {
  background: #1e293b;
}

.hidden {
  display: none !important;
}

/* Exact A4 Document Page Dimensions (Matching Service Report 210mm x 297mm) */
.page {
  width: 210mm;
  height: 297mm;
  margin: 0 auto;
  background: #fff;
  padding: 3.5mm 5.5mm 2mm 15mm;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.content-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  justify-content: space-between;
  min-height: 0;
}

.content-body textarea {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* Header (3-Column Corporate Identity) */
.header {
  display: grid;
  grid-template-columns: 1.35fr 0.95fr 1.25fr;
  gap: 6px;
  align-items: center;
}

.logo {
  font-family: "Barlow Condensed", sans-serif !important;
  font-size: 42px !important;
  font-weight: 800 !important;
  color: #047A3D !important;
  line-height: 0.95;
  letter-spacing: -0.5px;
}
.logo .dot {
  color: #6FB426 !important;
}

.tagline {
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 8.5px;
  margin-top: 2px;
  font-weight: 600;
  color: #444;
}

.tech {
  font-size: 8px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #333;
  text-align: center;
}

.contact {
  text-align: right;
  font-size: 11px;
  line-height: 1.2;
}

.contact-line {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}
.contact-line svg {
  width: 12px;
  height: 12px;
  fill: #047A3D;
}
.contact-line input {
  border: none;
  background: transparent;
  text-align: right;
  font-size: 11px;
  font-weight: 500;
  color: #374151;
  width: 130px;
  outline: none;
}

/* Document Title Banner */
.banner {
  background: #047A3D;
  color: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 2px;
  padding: 1.5px 0;
  margin: 0;
}

/* Metadata Grid Row */
.meta {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.9fr 0.9fr;
  border: 1px solid #bbb;
  border-top: 0;
  font-size: 10.5px;
  margin: 0;
  background: #fcfcfc;
}

.meta div {
  padding: 1.5px 4px;
  border-right: 1px solid #bbb;
  display: flex;
  align-items: center;
  gap: 4px;
}
.meta div:last-child {
  border-right: 0;
}

.meta input {
  border: none;
  background: transparent;
  font-size: 10.5px;
  font-weight: 700;
  color: #047A3D;
  outline: none;
  width: 100%;
}

.meta-select {
  padding: 1px 3px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid #d1d5db;
  outline: none;
  cursor: pointer;
}

.priority-normal { color: #0284c7; background: #f0f9ff; }
.priority-urgent { color: #d97706; background: #fffbeb; }
.priority-critical { color: #dc2626; background: #fef2f2; }

.status-open { color: #0284c7; background: #f0f9ff; }
.status-scheduled { color: #7c3aed; background: #f5f3ff; }
.status-inprogress { color: #d97706; background: #fffbeb; }
.status-completed { color: #047A3D; background: #f0fdf4; }
.status-cancelled { color: #64748b; background: #f8fafc; }

/* Standardized Service Category Bar */
.category-selection-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #bbb;
  border-top: 0;
  padding: 2px 5px;
  background: #fcfcfc;
  font-size: 10.5px;
  margin: 0;
}

.type-title {
  font-weight: 700;
  color: #047A3D;
  text-transform: uppercase;
  font-size: 10.5px;
  margin-right: 4px;
}

.category-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.cat-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  font-weight: 600;
  font-size: 10.5px;
  color: #222;
}

.cat-label input[type="radio"] {
  width: 12px;
  height: 12px;
  accent-color: #047A3D;
  cursor: pointer;
  margin: 0;
}

.cat-amc-container {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ecfdf5;
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid #a7f3d0;
}

.amc-dropdown {
  padding: 1px 3px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid #10b981;
  border-radius: 3px;
  background: #fff;
  color: #047A3D;
  outline: none;
  cursor: pointer;
}

.btn-amc-auto {
  background: #047A3D;
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-amc-auto:hover {
  background: #036332;
}

/* Grid & Section Boxes */
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin: 0;
}

.box {
  border: 1px solid #bbb;
  border-radius: 0;
  padding: 0;
  position: relative;
  background: #fff;
}

.box h3 {
  margin: 0;
  background: #047A3D;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 5px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 4px;
  text-transform: uppercase;
}

.box h3 .icon {
  width: 12px;
  height: 12px;
  fill: #fff;
  flex-shrink: 0;
}

.clear-btn {
  width: 13px;
  height: 13px;
  fill: #ffcdd2;
  margin-left: auto;
  cursor: pointer;
}
.clear-btn:hover {
  fill: #fff;
}

.row {
  display: flex;
  align-items: center;
  font-size: 10.5px;
  padding: 1px 4px;
  border-bottom: 1px solid #f0f0f0;
  margin: 0;
}
.row:last-child {
  border-bottom: 0;
}

.row label {
  width: 105px;
  font-weight: 600;
  color: #333;
  flex-shrink: 0;
  font-size: 10px;
}

.row input, .row select {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 10.5px;
  font-family: 'Barlow', Arial, sans-serif;
  color: #111;
  outline: none;
  padding: 1px 2px;
}

.row input:focus, .row select:focus, textarea:focus {
  background: #f0fdf4;
}

.form-select {
  cursor: pointer;
  background: transparent;
}

/* Problem Descriptions */
.srf-textarea {
  width: 100%;
  height: 38px;
  border: none;
  padding: 2px 5px;
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 10.5px;
  color: #111;
  resize: none;
  outline: none;
  background: transparent;
  display: block;
}

/* SRF Photos Section (175px Matching Service Report) */
.photos-container-box {
  border: 1px solid #bbb;
  margin: 0;
  background: #fff;
}

.photo-badge {
  font-size: 8.5px;
  font-weight: 600;
  background: #ecfdf5;
  color: #047A3D;
  border: 1px solid #a7f3d0;
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: auto;
}

.srf-photos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  justify-items: center;
}

.srf-photo-slot {
  width: 175px;
  border: 1px solid #bbb;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  padding: 0;
  position: relative;
  overflow: hidden;
  border-radius: 2px;
}

.photo-slot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9.5px;
  font-weight: 700;
  color: #fff;
  background: #047A3D;
  padding: 2px 5px;
}

.photo-remove-btn {
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.photo-preview-wrap {
  width: 175px;
  height: 175px;
  background: #fafafa;
  border: 1px solid #aaa;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  aspect-ratio: 1 / 1 !important;
}
.photo-preview-wrap:hover {
  border-color: #047A3D;
  background: #f0fdf4;
}

.photo-img {
  width: 175px;
  height: 175px;
  object-fit: cover;
  display: block;
}

.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #64748b;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  padding: 8px;
}
.photo-placeholder svg {
  width: 28px;
  height: 28px;
  fill: #94a3b8;
}

.hidden-file-input {
  display: none !important;
}

.srf-caption-input {
  width: 175px;
  border: none;
  border-top: 1px solid #bbb;
  padding: 3px 4px;
  font-size: 9.5px;
  font-family: 'Barlow', Arial, sans-serif;
  color: #1e293b;
  outline: none;
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
}

/* Engineer Action Buttons */
.btn-engineer-close {
  background: #047A3D;
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
  transition: background 0.15s;
}
.btn-engineer-close:hover {
  background: #036332;
}

.btn-convert-srf {
  background: #7c3aed;
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
  transition: background 0.15s;
}
.btn-convert-srf:hover {
  background: #6d28d9;
}

/* Date Field Component */
.date-field {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 100%;
  flex: 1;
  min-width: 0;
}

.date-display {
  width: 100%;
  padding-right: 22px !important;
}

.date-picker-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.calendar-button {
  position: absolute;
  top: 0;
  right: 0;
  width: 20px;
  height: 16px;
  padding: 0;
  border: 1px solid #aaa;
  background: #fff;
  color: #047A3D;
  font-size: 10px;
  line-height: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.calendar-button svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

/* Signatures */
.signatures-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid #bbb;
  background: #fff;
  margin: 0;
}

.sig-box {
  border-right: 1px solid #bbb;
  padding: 2px 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 48px;
  background: #fff;
}
.sig-box:last-child {
  border-right: 0;
}

.sig-title {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: #047A3D;
  margin-bottom: 0;
}

.sig-space {
  flex: 1;
  height: auto;
}

.sig-line {
  border-top: 1px dashed #aaa;
  margin: 2px 20px 2px 20px;
}

.sig-input {
  width: 100%;
  border: none;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: #111;
  outline: none;
  background: transparent;
  font-family: 'Barlow', Arial, sans-serif;
}

/* Footer */
.footer {
  border-top: 1px solid #000;
  padding-top: 1px;
  font-size: 8.5px;
  color: #444;
  line-height: 1.1;
  margin: 0;
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 1px;
}

.flogo {
  font-family: "Barlow Condensed", sans-serif !important;
  font-weight: 800;
  font-size: 11px;
  color: #047A3D;
}
.flogo .dot {
  color: #6FB426;
}

.footer input {
  border: none;
  background: transparent;
  font-size: 8.5px;
  color: #444;
  outline: none;
  text-align: center;
  font-family: 'Barlow', Arial, sans-serif;
}

/* Print Calibration (Exact Match to Service Report) */
@media print {
  html, body {
    width: 210mm;
    height: 297mm;
    background: #fff;
    margin: 0 !important;
    padding: 0 !important;
  }
  .page {
    width: 210mm;
    height: 297mm;
    margin: 0;
    padding: 2mm 4mm 1mm 15mm;
    box-shadow: none;
    page-break-inside: avoid;
    page-break-after: avoid;
  }
  .tools, .photo-remove-btn, .clear-btn, .calendar-button, .btn-amc-auto, .btn-engineer-close, .btn-convert-srf {
    display: none !important;
  }
  input, textarea {
    border-color: transparent !important;
  }
  select {
    border-color: transparent !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    background-image: none !important;
  }
  input[type=number]::-webkit-inner-spin-button,
  input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
}
