/* Daily Record Keeping - custom styles */

* { box-sizing: border-box; }

.spinner {
  border: 3px solid #e2e8f0;
  border-top-color: #1d4ed8;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: 0.2s;
  border-radius: 24px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.toggle-switch input:checked + .toggle-slider { background-color: #16a34a; }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(22px); }
.toggle-switch input:disabled + .toggle-slider { opacity: 0.5; cursor: not-allowed; }

/* Searchable dropdown */
.searchable-dropdown { position: relative; }
.searchable-dropdown-list {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0; right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
}
.searchable-dropdown-item {
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  font-size: 0.875rem;
}
.searchable-dropdown-item:hover, .searchable-dropdown-item.active {
  background-color: #eff6ff;
  color: #1d4ed8;
}

/* Status badges */
.badge { display: inline-flex; align-items:center; gap:0.3rem; padding: 0.15rem 0.65rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.badge-approved { background-color: #dcfce7; color: #15803d; }
.badge-rejected { background-color: #fee2e2; color: #b91c1c; }
.badge-pending { background-color: #fef9c3; color: #a16207; }

/* Print styles */
@media print {
  @page {
    size: landscape;
    margin: 9mm;
  }
  body * { visibility: hidden; }
  #printable-area, #printable-area * { visibility: visible; }
  #printable-area {
    position: absolute; left: 0; top: 0; width: 100%;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }
  .no-print { display: none !important; }

  /* Fixed layout + narrow colgroup widths only apply when actually printing,
     so the on-screen table keeps its natural width + horizontal scroll.
     Cells always wrap (never nowrap) here: with table-layout:fixed, a
     wrapping cell just grows taller within its own column, which is always
     safe. nowrap + fixed width instead lets overflow spill text sideways
     into the next column when content doesn't fit - a real rendering bug,
     not just a style choice. */
  table.report-table {
    table-layout: fixed;
    width: 100%;
  }
  table.report-table th, table.report-table td {
    padding: 3px 4px;
    font-size: 7.2pt;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  table.report-table thead { display: table-header-group; }
  table.report-table tfoot { display: table-footer-group; }
  table.report-table tr { page-break-inside: avoid; }
  .report-header, .report-footer { page-break-inside: avoid; }

  /* Tightened vertical spacing so header + table + signature footer fit on
     one printed page for a typical day's entries. On screen these keep
     their more generous Tailwind spacing (mt-10 etc.) since there's no
     page-fold to worry about there. */
  .report-header { margin-bottom: 4px !important; }
  .report-header h2 { font-size: 13pt !important; }
  .report-header h3 { font-size: 9pt !important; }
  .report-header img { width: 34px !important; height: 34px !important; }
  .report-footer { margin-top: 10px !important; }
}

table.report-table th, table.report-table td {
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
  font-size: 0.78rem;
}
table.report-table th { background-color: #1e3a8a; color: white; }
@media screen { table.report-table th { white-space: nowrap; } }
table.report-table td.report-wrap-cell { word-wrap: break-word; overflow-wrap: break-word; }
/* Guaranteed-short fixed-format content (DVTS/CVIS/POC) - safe to keep on one line */
table.report-table td.report-nowrap-cell { white-space: nowrap; }
table.report-table tbody tr:nth-child(even) { background-color: #f8fafc; }
table.report-table tfoot td {
  background-color: #eef2ff;
  border-top: 2px solid #1e3a8a;
  font-weight: 700;
}

/* Approved Report: watermark + header/footer */
.report-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48%;
  max-width: 480px;
  opacity: 0.07;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}
.report-header, .report-footer { position: relative; z-index: 1; }

.signature-cursive {
  font-family: 'Brush Script MT', cursive, 'Segoe Script';
  font-size: 1.15rem;
  color: #1e3a8a;
}

.signature-line {
  border-top: 1px solid #64748b;
  padding-top: 4px;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
