/* field_visit.css — Field Visit Report page styles
   Extends shared.css patterns; does not override base/portal globals. */

/* ── Required / optional labels ─────────────────────────────── */
.fv-required {
  color: #e53e3e;
  font-size: 12px;
}

.panel-required {
  color: #e53e3e;
  font-size: 11px;
  font-weight: 700;
}

.panel-optional {
  color: #8a94a6;
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

/* Round 2.9 Item H: .fv-time-row deleted — consolidated into the shared
   .form-grid-2 utility in shared.css (also picks up a responsive
   collapse to single column on phone tier, which .fv-time-row lacked).
   The VR form's Arrival/Departure pairing now uses class="form-grid-2". */

/* ── Textarea fields ─────────────────────────────────────────── */
.fv-textarea {
  resize: vertical;
  min-height: 80px;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid #e6eaf0;
  border-radius: 14px;
  background: #ffffff;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  box-sizing: border-box;
}

.fv-textarea:focus {
  border-color: #c9d3e3;
  box-shadow: 0 0 0 3px rgba(30, 90, 200, 0.08);
}

/* ── Project selector list ───────────────────────────────────── */
.fv-project-list {
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.fv-section-label {
  font-size: 11px;
  font-weight: 700;
  color: #5f6b7a;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 6px 4px 2px;
  margin-top: 4px;
}

.fv-section-label:first-child {
  margin-top: 0;
}

/* Round 2.7 Item 4: .fv-section-recent removed — the "Recently Completed"
 * section is no longer rendered by field_visit.js. */

/* Round 2.7 Item 5: "Clear search" pill on the active projects picker.
 * Explicit-text label per Mari's outdoor-visibility / tech-friendliness
 * preference (vs. a minimalist × icon). Visible only when the search
 * input has content; toggled via .is-hidden by field_visit.js. */
.fv-clear-search-row {
  display: flex;
  justify-content: flex-end;
}

.fv-clear-search-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1px solid #c9d3e3;
  border-radius: 999px;
  background: #ffffff;
  color: #1f2937;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.fv-clear-search-pill:hover {
  background: #f4f7fb;
  border-color: #a8b5c9;
}

.fv-clear-search-pill:active {
  transform: translateY(1px);
}

.fv-clear-search-pill.is-hidden {
  display: none;
}

.fv-project-item {
  padding: 10px 14px;
  border: 1px solid #e6e9ee;
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  transition: border-color 0.1s, background 0.1s;
}

.fv-project-item:active,
.fv-project-item:hover {
  border-color: #1f6fd6;
  background: #f0f6ff;
}

.fv-project-item.selected {
  border-color: #1f6fd6;
  background: #eef4ff;
}

.fv-project-name {
  font-weight: 750;
  font-size: 14px;
  line-height: 1.3;
}

.fv-project-code {
  font-size: 12px;
  color: #5f6b7a;
  margin-top: 2px;
}

.fv-project-status {
  font-size: 11px;
  color: #8a94a6;
  white-space: nowrap;
  margin-top: 2px;
}

/* ── Materials request table ─────────────────────────────────── */
.fv-materials-wrap {
  margin-top: 10px;
  border: 1px solid #e6e9ee;
  border-radius: 12px;
  overflow: hidden;
}

.fv-materials-header {
  display: grid;
  grid-template-columns: 1.4fr 2fr 0.6fr 0.6fr 1fr 32px;
  gap: 0;
  background: #f5f7fa;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #5f6b7a;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.fv-material-row {
  display: grid;
  grid-template-columns: 1.4fr 2fr 0.6fr 0.6fr 1fr 32px;
  gap: 0;
  padding: 6px 10px;
  border-top: 1px solid #e6e9ee;
  align-items: center;
}

.fv-material-row:first-child {
  border-top: none;
}

.fv-material-row input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #e6e9ee;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #ffffff;
  outline: none;
  box-sizing: border-box;
}

.fv-material-row input:focus {
  border-color: #c9d3e3;
  box-shadow: 0 0 0 2px rgba(30, 90, 200, 0.07);
}

.fv-col-sm { }   /* narrow columns inherit from grid */
.fv-col-action { }

.fv-row-remove {
  border: none;
  background: transparent;
  color: #e53e3e;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.fv-add-row {
  margin-top: 10px;
  width: 100%;
}

/* ── Signature date display ──────────────────────────────────── */
.fv-sig-date {
  font-size: 12px;
  color: #5f6b7a;
  padding: 6px 10px;
  background: #f5f7fa;
  border-radius: 8px;
}

/* ── Visit history list (visits.html) ───────────────────────── */
.fv-history-list {
  display: grid;
  gap: 8px;
}

.fv-history-item {
  padding: 12px 14px;
  border: 1px solid #e6e9ee;
  border-radius: 14px;
  background: #ffffff;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.fv-history-item:hover {
  border-color: #1f6fd6;
  background: #f0f6ff;
}

.fv-history-date {
  font-weight: 800;
  font-size: 14px;
}

.fv-history-by {
  font-size: 12px;
  color: #5f6b7a;
  margin-top: 2px;
}

.fv-history-status {
  font-size: 11px;
  color: #8a94a6;
  white-space: nowrap;
}

.fv-history-status.submitted {
  color: #2e7d32;
  font-weight: 700;
}

/* ── Report detail panel (lazy-loaded inside visits.html) ────── */
.fv-report-detail {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid #e6e9ee;
  border-radius: 14px;
  background: #fafbfc;
}

.fv-report-field {
  margin-top: 10px;
}

.fv-report-field:first-child {
  margin-top: 0;
}

.fv-report-label {
  font-size: 11px;
  font-weight: 700;
  color: #5f6b7a;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 4px;
}

.fv-report-value {
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Media grid in report detail ─────────────────────────────── */
.fv-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.fv-media-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e6e9ee;
  cursor: pointer;
}

/* ── Spinner ─────────────────────────────────────────────────── */
.fv-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #e6e9ee;
  border-top-color: #1f6fd6;
  border-radius: 50%;
  animation: fv-spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes fv-spin {
  to { transform: rotate(360deg); }
}

/* ── Last visit hint on project picker items ─────────────────── */
.fv-project-last-visit {
  font-size: 11px;
  color: #8a94a6;
  margin-top: 2px;
}

/* ── Pending Start section separator ────────────────────────── */
.fv-section-separator {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e6e9ee;
}

/* ── Materials modal — full-screen on mobile, card on desktop ─── */
.fv-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
}

/* Backdrop hidden on mobile (full-screen covers everything);
   shown on desktop so clicking outside closes the modal */
.fv-modal-backdrop {
  display: none;
}

/* Full-screen on mobile */
.fv-modal-box {
  position: relative;
  background: #ffffff;
  border-radius: 0;
  width: 100%;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 16px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

/* Tablet / desktop: centered card with dim backdrop */
@media (min-width: 640px) {
  .fv-modal {
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
  }

  .fv-modal-backdrop {
    display: block;
    position: absolute;
    inset: 0;
  }

  .fv-modal-box {
    position: relative;
    width: 90%;
    max-width: 620px;
    height: auto;
    max-height: 88vh;
    border-radius: 20px;
  }
}

.fv-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.fv-modal-title {
  font-weight: 800;
  font-size: 16px;
}

.fv-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: #5f6b7a;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
}

.fv-modal-close:active {
  background: #f0f0f0;
}

/* Round 2.9 Item D: flex layout moved to shared .btn-row in shared.css.
   This class survives as a per-surface margin-top hook only. Consumers:
   the three history-page edit modals (visits / materials_history /
   aggregate_media_history) + the two fv_confirm.js modal templates. */
.fv-modal-footer {
  margin-top: 20px;
}

/* Signature block inside the modal */
.fv-modal-sig {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #e6e9ee;
}

/* ── Signature canvas ────────────────────────────────────────── */
.fv-sig-canvas-wrap {
  border: 1px solid #e6e9ee;
  border-radius: 12px;
  overflow: hidden;
  background: #fafbfc;
  user-select: none;
  -webkit-user-select: none;
}

.fv-sig-canvas-label {
  font-size: 11px;
  font-weight: 700;
  color: #8a94a6;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 8px 12px 4px;
}

.fv-sig-canvas {
  display: block;
  width: 100%;
  height: 150px;
  touch-action: none;   /* prevents scroll hijack on mobile while drawing */
  cursor: crosshair;
}

.fv-sig-canvas-footer {
  padding: 4px 12px 8px;
  text-align: right;
}
