/* =========================================================
   APA Pilotage Order Form – FINAL Scoped Styles
   Matches approved mockup
   ========================================================= */

/* Hard reset inside the form only */
#pilotForm,
#pilotForm * {
  box-sizing: border-box;
}

/* Form container */
#pilotForm {
  background: #0a3755;
  color: #ffffff;
  border-radius: 3px;
  padding: 25px 25px 18px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  font-family: "Segoe UI", Arial, sans-serif;
  margin-top: 20px;
}

/* Section titles */
#pilotForm .section-title {
  margin: 18px 0 12px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 4px;
}

/* Labels */
#pilotForm label {
  display: block;
  font-size: 13px !important;
  font-weight: 600 !important;
  /* margin-bottom: 4px; */
  color: #ffffff;
}

#pilotForm .req {
  color: #ffd56d;
  margin-left: 3px;
}

/* Field group spacing */
#pilotForm .field-group {
  padding-top: 10px;
}

/* Inputs – force override of theme styles */
#pilotForm input[type="text"],
#pilotForm input[type="email"],
#pilotForm input[type="date"],
#pilotForm input[type="number"],
#pilotForm select,
#pilotForm textarea {
  width: 100% !important;
  padding: 7px 9px !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  background: rgba(255, 255, 255, 0.12) !important;
  border-radius: 3px !important;
  color: #ffffff !important;
  font-size: 13px !important;
  line-height: 1.2 !important;
  margin-bottom: 2px !important;
}

/* Inputs – force override of theme styles */
#pilotForm input[type="text"]:focus,
#pilotForm input[type="email"]:focus,
#pilotForm input[type="date"]:focus,
#pilotForm input[type="number"]:focus,
#pilotForm select:focus,
#pilotForm textarea:focus {
  border: 1px solid rgba(255, 255, 255, 0.95) !important;
}


/* Placeholder text */
#pilotForm input::placeholder,
#pilotForm textarea::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

/* Dropdown list text */
#pilotForm select option {
  color: #000;
}

/* Remove number spinners */
#pilotForm input[type="number"] {
  -moz-appearance: textfield;
}

#pilotForm input[type="number"]::-webkit-inner-spin-button,
#pilotForm input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Textarea */
#pilotForm textarea {
  min-height: 70px;
  resize: vertical;
}

/* Inline layouts */
#pilotForm .inline-2,
#pilotForm .inline-3 {
  display: flex;
  gap: 12px;
}

#pilotForm .inline-2 > .field-group,
#pilotForm .inline-3 > .field-group {
  flex: 1 1 0;
}

/* =========================================================
   DOCKING ORDERS — HARD OVERRIDE, NO THEME BLEED
   ========================================================= */

#pilotForm .dock-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 18px;
  margin-bottom: 14px;
}

/* Each docking row */
#pilotForm .dock-item {
  display: flex !important;
  align-items: center !important; /* Centers items vertically */
  gap: 8px !important;
  line-height: 1 !important; /* Prevents parent line-height from skewing alignment */
}

/* Checkbox */
#pilotForm .dock-item input[type="checkbox"] {
  margin: 0 !important; /* Kills theme margins */
  padding: 0 !important;
  width: 16px !important; /* Force a consistent size */
  height: 16px !important;
  flex: 0 0 auto;
  vertical-align: middle !important;
  position: static !important; /* Prevents theme absolute positioning */
}

/* SST / PST / O/A / NB4 text */
#pilotForm .dock-code {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #ffffff !important;
  line-height: 1 !important;
  white-space: nowrap;
  display: inline-block !important; /* Simpler than inline-flex for text alignment */
  margin: 0 !important;
  padding-top: 1px; /* Optical adjustment sometimes needed for small caps */
}

/* Berth / wharf input */
#pilotForm .dock-item input[type="text"] {
  flex: 1 1 auto;
  height: 32px !important;
  min-height: 32px !important; /* Enforce height against theme min-heights */
  padding: 6px 8px !important;
  line-height: normal !important; /* "normal" centers text better in inputs than "1.2" */
  font-size: 13px !important;
  margin: 0 !important; /* <--- THE KEY FIX: Removes theme spacing */
  box-shadow: none !important; /* Removes theme shadows */
}

/* Second row naturally wraps */
@media (max-width: 900px) {
  #pilotForm .dock-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Notes + Submit
   ========================================================= */

#pilotForm .small-note {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  margin: 10px 0 12px;
}

/* Submit button */
#pilotForm button[type="submit"] {
  background: #b6a25a;
  border: none;
  border-radius: 3px;
  padding: 9px 18px;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s ease;
}

#pilotForm button[type="submit"]:hover:not(:disabled) {
  background: #cdb758;
}

#pilotForm button[type="submit"]:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Loading Spinner */
#pilotForm .loading-spinner {
  display: none;
  width: 20px !important;
  height: 20px !important;
  border: 3px solid rgba(255, 255, 255, 0.3) !important;
  border-top: 3px solid #ffffff !important;
  border-radius: 50% !important;
  -webkit-animation: apa-spin 1s linear infinite !important;
  animation: apa-spin 1s linear infinite !important;
  margin-left: 10px !important;
  vertical-align: middle !important;
}

#pilotForm .loading-spinner.active {
  display: inline-block !important;
}

@-webkit-keyframes apa-spin {
  0% { -webkit-transform: rotate(0deg); }
  100% { -webkit-transform: rotate(360deg); }
}

@keyframes apa-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 950px) {
  #pilotForm .inline-2,
  #pilotForm .inline-3 {
    flex-direction: column;
  }

  #pilotForm .dock-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Success & Error Messages
   ========================================================= */
#apa_pof_message {
  display: none;
  padding: 12px 15px;
  border-radius: 3px;
  font-size: 13px;
  margin-bottom: 15px;
  font-weight: 500;
}

#apa_pof_message.success {
  background: #2d6a4f;
  color: #d1e7dd;
  border: 1px solid #1b4332;
}

#apa_pof_message.error {
  background: #842029;
  color: #f8d7da;
  border: 1px solid #6a1a21;
}

/* Legacy support */
.success-message,
.error-message {
  display: none;
  padding: 12px 15px;
  border-radius: 3px;
  font-size: 13px;
  margin-bottom: 15px;
}
.success-message {
  background: #2d6a4f;
  color: #d1e7dd;
}

.error-message {
  background: #842029;
  color: #f8d7da;
}

/* Error message */
.field-error-msg {
  margin-top: 6px;
  padding: 6px 8px;
  font-size: 0.75rem;
  line-height: 1.25;
  color: #7f1d1d;
  background: #fee2e2;       /* light red / pink */
  border-left: 3px solid #dc2626;
  border-radius: 3px;
}

/* Field highlight */
.field-error {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.35);
}

