/* ═══════════════════════════════════════════════
   Loan Document Builder — Custom Styles
   ═══════════════════════════════════════════════ */

/* ─── Document Container ─── */
.document-container {
  border: 1px solid #e5e7eb;
}

/* ─── Editable Cells ─── */
.editable-cell {
  cursor: pointer;
  position: relative;
}

.editable-cell:hover {
  background-color: #eff6ff;
}

.editable-cell::after {
  content: '✎';
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 10px;
  color: #93c5fd;
  opacity: 0;
  transition: opacity 0.15s;
}

.editable-cell:hover::after {
  opacity: 1;
}

/* ─── Editing Input ─── */
.editing-input {
  font-family: inherit;
  font-size: inherit;
}

.editing-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px #3b82f6;
}

/* ─── Manual Table Inputs ─── */
.manual-input {
  font-family: inherit;
  font-size: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 6px;
  transition: border-color 0.15s, background-color 0.15s;
}

.manual-input:hover {
  border-color: #d1d5db;
}

.manual-input:focus {
  outline: none;
  border-color: #3b82f6;
  background: white;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.manual-row:hover {
  background-color: #f9fafb;
}

/* Hide number input spinners in manual table */
.manual-input::-webkit-outer-spin-button,
.manual-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.manual-input[type=number] {
  -moz-appearance: textfield;
}

/* ═══════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════ */

@media print {
  /* Reset */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: white !important;
    margin: 0;
    padding: 0;
    font-size: 11pt;
  }

  /* Hide non-document elements */
  .print\:hidden {
    display: none !important;
  }

  /* Document container */
  .document-container {
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    max-width: none !important;
  }

  .document-container > div {
    padding: 1.5cm 2cm !important;
  }

  /* Typography */
  h1 {
    font-size: 18pt !important;
  }

  h2 {
    font-size: 12pt !important;
  }

  p, td, th {
    font-size: 10pt !important;
    line-height: 1.5 !important;
  }

  /* Table */
  .amortization-table {
    page-break-inside: auto;
  }

  .amortization-table thead {
    display: table-header-group;
  }

  .amortization-table tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  .amortization-table thead tr {
    background-color: #1f2937 !important;
    color: white !important;
  }

  .amortization-table thead th {
    color: white !important;
  }

  .amortization-table tfoot tr {
    background-color: #f3f4f6 !important;
  }

  /* Hide edit indicators */
  .editable-cell {
    cursor: default !important;
  }

  .editable-cell::after {
    display: none !important;
  }

  .editable-cell:hover {
    background-color: transparent !important;
  }

  /* Signature section — keep together */
  .grid.grid-cols-2.gap-12 {
    page-break-inside: avoid;
  }

  /* Page settings */
  @page {
    size: A4;
    margin: 1cm 1.5cm;
  }

  /* Ensure colored backgrounds for edited rows */
  tr.bg-yellow-50 {
    background-color: #fefce8 !important;
  }

  /* Manual table: hide inputs, show values cleanly */
  .manual-input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    -webkit-appearance: none;
    -moz-appearance: textfield;
  }

  .manual-row:hover {
    background-color: transparent !important;
  }
}
