/*
 * Arbotech Field Operations App
 * Herbicide Application Record
 * Extracted from JavaScript during Phase 3.
 */

.herbicide-record-screen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 6400;
  overflow-y: auto;
  background: #edf2ef;
}

.herbicide-record-screen.open {
  display: block;
}

#herbicideApplicationRoot {
  padding: 18px;
}

.herbicide-record-document {
  width: min(100%, 1120px);
  margin: 0 auto 40px;
  padding: 24px;
  border: 1px solid #d4ddd6;
  border-radius: 14px;
  background: white;
  box-shadow:
    0 8px 28px
    rgba(18, 48, 30, 0.09);
}

.herbicide-record-header {
  text-align: center;
}

.herbicide-record-header h1 {
  margin: 0;
  color: #173c22;
  font-family:
    Georgia,
    "Times New Roman",
    serif;
  font-size:
    clamp(22px, 3vw, 31px);
}

.herbicide-record-header h2 {
  margin: 9px 0 0;
  color: #28353e;
  font-family:
    Georgia,
    "Times New Roman",
    serif;
  font-size:
    clamp(20px, 2.7vw, 28px);
}

.herbicide-record-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top:
    2px solid #2f6f45;
}

.herbicide-record-section h3 {
  margin: 0 0 11px;
  color: #173c22;
}

.herbicide-record-two-column {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.herbicide-record-four-column {
  display: grid;
  grid-template-columns:
    repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
}

.herbicide-record-volume-grid {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.herbicide-record-field,
.herbicide-record-comments,
.herbicide-password-field {
  display: grid;
  gap: 6px;
  color: #183c24;
  font-weight: bold;
}

.herbicide-record-field input,
.herbicide-record-comments textarea,
.herbicide-password-field input {
  width: 100%;
  padding: 10px;
  border:
    2px solid #cfd8d2;
  border-radius: 8px;
  background: white;
  color: #1f2937;
  font: inherit;
}

.herbicide-record-field input:focus,
.herbicide-record-comments textarea:focus,
.herbicide-password-field input:focus {
  outline: none;
  border-color: #2f6f45;
}

.herbicide-record-number-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
}

.herbicide-record-number-wrap strong {
  flex: 0 0 auto;
  color: #475569;
  font-size: 12px;
}

.herbicide-record-row-status,
.herbicide-record-signs-row {
  display: grid;
  grid-template-columns:
    minmax(220px, 0.8fr)
    minmax(280px, 1.2fr);
  align-items: end;
  gap: 10px;
  margin-top: 10px;
}

.herbicide-record-fieldset {
  margin: 0;
  padding: 10px;
  border:
    1px solid #cfd8d2;
  border-radius: 9px;
}

.herbicide-record-fieldset legend {
  padding: 0 5px;
  color: #183c24;
  font-weight: bold;
}

.herbicide-record-radio-row,
.herbicide-record-weather-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.herbicide-record-direction-grid {
  display: grid;
  grid-template-columns:
    repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.herbicide-record-radio,
.herbicide-record-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px;
  border:
    1px solid #d4ddd6;
  border-radius: 8px;
  background: white;
  color: #27352c;
  font-weight: 600;
  line-height: 1.35;
}

.herbicide-record-radio:has(input:checked),
.herbicide-record-checkbox:has(input:checked) {
  border-color: #8eb59a;
  background: #f1f8f3;
}

.herbicide-record-radio input,
.herbicide-record-checkbox input {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin: 0;
  accent-color: #2f6f45;
}

.herbicide-record-weather-grid {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.herbicide-record-weather-grid
.herbicide-record-field {
  margin-top: 10px;
}

.herbicide-time-grid {
  margin-top: 10px;
}

.herbicide-record-checkbox-grid {
  display: grid;
  grid-template-columns:
    repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.herbicide-species-grid {
  margin-top: 10px;
}

.herbicide-record-comments textarea {
  resize: vertical;
  line-height: 1.45;
}

.herbicide-signature-note {
  color: #5d6870;
  line-height: 1.45;
}

.herbicide-password-field {
  max-width: 430px;
  margin-top: 12px;
}

.herbicide-signature-pad-wrap {
  position: relative;
  max-width: 720px;
  margin-top: 14px;
  overflow: hidden;
  border:
    2px solid #aeb8b1;
  border-radius: 10px;
  background: white;
}

.herbicide-signature-canvas {
  display: block;
  width: 100%;
  height: 190px;
  touch-action: none;
  cursor: crosshair;
}

.herbicide-signature-line {
  position: absolute;
  right: 30px;
  bottom: 30px;
  left: 30px;
  border-bottom:
    1px solid #9ca3af;
  pointer-events: none;
}

.herbicide-signature-pad-actions {
  margin-top: 8px;
}

.herbicide-signature-pad-actions button {
  padding: 8px 12px;
  border:
    1px solid #aeb8b1;
  border-radius: 8px;
  background: white;
  font-weight: bold;
  cursor: pointer;
}

.herbicide-completion-message {
  min-height: 22px;
  margin-top: 8px;
  color: #24587d;
  font-size: 13px;
  font-weight: bold;
}

.herbicide-completion-message.error,
.herbicide-signature-missing {
  color: #9b1c1c;
}

.herbicide-completed-signature {
  display: grid;
  grid-template-columns:
    minmax(240px, 0.8fr)
    minmax(280px, 1.2fr);
  align-items: center;
  gap: 16px;
}

.herbicide-completed-signature img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-bottom:
    1px solid #9ca3af;
}

.herbicide-completed-signature-details {
  display: grid;
  gap: 10px;
}

.herbicide-completed-signature-details > div {
  display: grid;
  gap: 3px;
}

.herbicide-completed-signature-details span {
  color: #64748b;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.herbicide-hash-row code {
  overflow-wrap: anywhere;
  font-size: 10px;
}

.herbicide-record-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
  padding-top: 15px;
  border-top:
    1px solid #d4ddd6;
}

.herbicide-record-save-indicator {
  margin-right: auto;
  color: #64748b;
  font-size: 12px;
  font-weight: bold;
}

.herbicide-record-primary-button,
.herbicide-record-secondary-button {
  padding: 11px 14px;
  border-radius: 9px;
  font-weight: bold;
  cursor: pointer;
}

.herbicide-record-primary-button {
  border: none;
  background: #2f6f45;
  color: white;
}

.herbicide-record-secondary-button {
  border:
    1px solid #9da89f;
  background: white;
  color: #26332b;
}

.herbicide-record-primary-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.herbicide-record-available-row {
  display: block;
}

.available-form-row .herbicide-record-available-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.herbicide-record-available-heading > div {
  display: grid;
  gap: 3px;
}

.herbicide-record-recent-list {
  display: grid;
  gap: 6px;
  margin-top: 9px;
}

.herbicide-record-recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px;
  border:
    1px solid #d4ddd6;
  border-radius: 8px;
  background: #f9fbfa;
  color: #27352c;
  text-align: left;
  cursor: pointer;
}

.herbicide-record-recent-item > span:first-child {
  display: grid;
  gap: 2px;
}

.herbicide-record-recent-item small {
  color: #64748b;
}

.herbicide-record-status-pill {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
}

.herbicide-record-status-pill.active {
  background: #fff1cc;
  color: #7c5200;
}

.herbicide-record-status-pill.completed {
  background: #e4f5e9;
  color: #176534;
}

@media (max-width: 860px) {
  #herbicideApplicationRoot {
    padding: 9px;
  }

  .herbicide-record-document {
    padding: 15px;
  }

  .herbicide-record-two-column,
  .herbicide-record-four-column,
  .herbicide-record-volume-grid,
  .herbicide-record-row-status,
  .herbicide-record-signs-row,
  .herbicide-record-weather-grid,
  .herbicide-completed-signature {
    grid-template-columns: 1fr;
  }

  .herbicide-record-checkbox-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .herbicide-signature-canvas {
    height: 165px;
  }

  .herbicide-record-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .herbicide-record-actions button {
    width: 100%;
  }

  .herbicide-record-save-indicator {
    margin-right: 0;
    text-align: center;
  }
}

@media (max-width: 520px) {
  .herbicide-record-checkbox-grid,
  .herbicide-record-direction-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  body.printing-herbicide-record > * {
    display: none !important;
  }

  body.printing-herbicide-record
  #herbicideApplicationScreen {
    display: block !important;
    position: static !important;
    overflow: visible !important;
    background: white !important;
  }

  body.printing-herbicide-record
  #herbicideApplicationScreen
  .tailboard-screen-topbar,
  body.printing-herbicide-record
  .herbicide-record-actions {
    display: none !important;
  }

  body.printing-herbicide-record
  #herbicideApplicationRoot {
    padding: 0 !important;
  }

  body.printing-herbicide-record
  .herbicide-record-document {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }

  body.printing-herbicide-record
  .herbicide-record-section,
  body.printing-herbicide-record
  .herbicide-record-fieldset,
  body.printing-herbicide-record
  .herbicide-completed-signature {
    break-inside: avoid;
  }

  body.printing-herbicide-record
  .herbicide-record-checkbox-grid {
    grid-template-columns:
      repeat(4, minmax(0, 1fr));
  }

  body.printing-herbicide-record
  .herbicide-record-four-column {
    grid-template-columns:
      repeat(4, minmax(0, 1fr));
  }

  body.printing-herbicide-record
  .herbicide-record-volume-grid,
  body.printing-herbicide-record
  .herbicide-record-two-column {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }
}
