/* SCBC Legal Office - Production Stylesheet */
:root {
  --scbc-red: #C90019;
  --scbc-deep-red: #960014;
  --scbc-navy: #091C47;
  --scbc-blue: #15548A;
  --scbc-light-blue: #D7E8FB;
  --scbc-bg: #F5F7FA;
  --scbc-border: #E5E7EB;
  --scbc-text: #171717;
  --scbc-muted: #64748B;
  --scbc-success: #16803C;
  --scbc-warning: #D88900;
}

* { box-sizing: border-box; }
html, body, #root {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Segoe UI', Roboto, -apple-system, sans-serif;
  background-color: var(--scbc-bg);
  color: var(--scbc-text);
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Word A4 Paper Simulation */
.word-paper {
  font-family: 'Times New Roman', Times, serif !important;
  font-size: 13pt;
  line-height: 1.45;
  color: #000000;
  background: #ffffff;
  width: 210mm;
  min-height: 297mm;
  padding: 20mm 18mm 20mm 25mm;
  margin: 0 auto 24px auto;
  box-shadow: 0 4px 20px rgba(9, 28, 71, 0.12);
  border: 1px solid #d1d5db;
  position: relative;
}

.word-paper.landscape {
  width: 297mm;
  min-height: 210mm;
  padding: 15mm 15mm 15mm 20mm;
}

.word-paper table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 12px 0;
  font-size: 12pt;
}

.word-paper.landscape table {
  font-size: 10.5pt;
}

.word-paper th, .word-paper td {
  border: 1px solid #000;
  padding: 4px 6px;
  vertical-align: top;
}

.word-paper th {
  text-align: center;
  font-weight: bold;
}

.word-paper .no-border-table td, .word-paper .no-border-table th {
  border: none !important;
  padding: 2px 4px;
}

/* Mapping Highlights */
.map-field {
  display: inline;
  cursor: pointer;
  border-radius: 3px;
  padding: 0 3px;
  transition: all 0.15s ease;
}

.mapping-on .map-field.filled {
  background-color: #dcfce7;
  border-bottom: 2px solid #16803C;
  color: #000;
}

.mapping-on .map-field.empty {
  background-color: #fef3c7;
  border-bottom: 2px dashed #D88900;
  color: #92400e;
}

.mapping-on .map-field.required-empty {
  background-color: #fee2e2;
  border-bottom: 2px solid #C90019;
  color: #991b1b;
  font-weight: bold;
}

.mapping-on .map-field:hover {
  outline: 2px solid #15548A;
  outline-offset: 1px;
}

/* Checkbox symbol */
.chk-box {
  display: inline-block;
  font-family: 'Segoe UI Symbol', 'DejaVu Sans', serif;
  font-size: 14pt;
  line-height: 1;
  margin-right: 4px;
}

/* Resizer handle */
.resizer-bar {
  width: 6px;
  cursor: col-resize;
  background: #e2e8f0;
  transition: background 0.15s;
  flex-shrink: 0;
}
.resizer-bar:hover, .resizer-bar.active {
  background: #15548A;
}

/* PRINT MEDIA RULES - Clean A4 Print */
@media print {
  @page {
    size: A4 portrait;
    margin: 15mm 15mm 15mm 20mm;
  }
  body.print-landscape {
    /* Handled via dynamic style tag for landscape forms like Mau 10 */
  }
  html, body, #root {
    background: #ffffff !important;
    height: auto !important;
    overflow: visible !important;
  }
  .no-print {
    display: none !important;
  }
  .print-area {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    transform: none !important;
  }
  .word-paper {
    width: 100% !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
  }
  .map-field,
  .mapping-on .map-field.filled,
  .mapping-on .map-field.empty,
  .mapping-on .map-field.required-empty {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: #000000 !important;
    font-weight: inherit !important;
    padding: 0 !important;
  }
}

/* LIVE ACTIVE FIELD HIGHLIGHT WHEN TYPING IN FORM */
@keyframes scbcPulse {
  0%, 100% { box-shadow: 0 0 0 2px #C90019, 0 0 12px rgba(201, 0, 25, 0.45); }
  50% { box-shadow: 0 0 0 4px #f59e0b, 0 0 18px rgba(245, 158, 11, 0.55); }
}

.map-field.active-editing {
  background-color: #fef08a !important;
  color: #991b1b !important;
  font-weight: bold !important;
  border-bottom: 2px solid #C90019 !important;
  padding: 1px 5px !important;
  border-radius: 4px !important;
  animation: scbcPulse 1.4s infinite ease-in-out;
  position: relative;
}

.active-table-editing {
  outline: 3px solid #C90019 !important;
  outline-offset: 4px;
  background-color: #fffbeb !important;
  transition: all 0.2s ease;
}

@media print {
  .map-field.active-editing,
  .active-table-editing {
    background: transparent !important;
    color: #000000 !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    animation: none !important;
    padding: 0 !important;
    font-weight: inherit !important;
  }
}
