/* Core Journal Container & Layout */
.journal-container {
  background-color: #fdfcf7;
  /* Lightened significantly for maximum contrast */
  border-radius: 4px;
  padding: 20px 30px 35px 35px;
  /* Generous left padding to clear a "margin line" */
  font-family: 'Georgia', serif;
  color: #110d0a;
  /* Darkened to deep near-black ink for contrast compliance */
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.15),
    0 1px 3px rgba(0, 0, 0, 0.1);
  position: relative;
  max-width: 650px;
  margin: 30px auto;
}

.journal-title {
  font-size: 15px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: right;
  border-bottom: 0px solid #4a3319;
  padding-bottom: 0px;
  margin-bottom: 0;
  color: #110d0a;
  /* High contrast */
  font-style: italic;
}

.journal-section-title {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: bold;
  color: #2b1f13;
  /* Darkened for better readability */
  border-bottom: 2px solid #7c6a52;
  padding-bottom: 4px;
  margin-top: 25px;
  margin-bottom: 15px;
}

label {
  display: block;
  margin-bottom: 18px;
  font-weight: 700;
  /* Increased weight for crisp legibility */
  color: #110d0a;
}

.journal-input,
.journal-textarea,
.journal-select {
  width: 100%;
  background-color: transparent;
  border: none;
  border-bottom: 2px dashed #544637;
  /* Dashed underline for editable inputs */
  border-radius: 0px !important;
  padding: 6px 4px;
  font-family: 'Georgia', serif;
  font-size: 16px;
  color: #110d0a;
  /* Crisp high-contrast values */
  box-sizing: border-box;
  transition: all 0.2s ease;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
  background-color: #f7f3e8;
}

.readonly-field,
.suggestion-readonly,
input[readonly] {
  border-bottom: 1px solid #544637;
  background-color: transparent;
  color: #110d0a;
  cursor: default;
  font-style: italic;
  user-select: text;
  -webkit-user-select: text;
}

.readonly-field:focus,
.suggestion-readonly:focus,
input[readonly]:focus {
  outline: 2px solid #2e4d31;
  outline-offset: 3px;
  background-color: rgba(84, 70, 55, 0.04);
}

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

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

.journal-input:focus,
.journal-textarea:focus,
.journal-select:focus {
  outline: 2px solid #2e4d31;
  /* Added explicit focus outline ring for accessibility */
  outline-offset: 3px;
  background-color: rgb(250, 240, 214);
}

.journal-input.field-error,
.journal-textarea.field-error,
.journal-select.field-error {
  background-color: rgba(186, 45, 45, 0.2);
  border-bottom: 2px dashed #ba2d2d;
}

.journal-textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.5;
}

.journal-btn {
  background-color: #2b1f13;
  /* Darkened for contrast against light button text */
  color: #ffffff;
  border: 1px solid #110d0a;
  border-radius: 4px;
  padding: 10px 20px;
  font-family: 'Georgia', serif;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.15s ease;
}

.journal-btn:hover,
.journal-btn:focus-visible {
  background-color: #110d0a;
  outline: 2px solid #2e4d31;
  outline-offset: 2px;
}

.journal-btn:active {
  box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.4);
  transform: translateY(1px);
}

.journal-btn.success {
  background-color: #166534;
  border-color: #166534;
  color: #ffffff;
}

.journal-output-box {
  background-color: #ffffff;
  border: 1px solid #544637;
  border-left: 5px solid #2b1f13;
  /* Pronounced spine accent */
  border-radius: 2px;
  padding: 15px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 18px;
  color: #000000;
  /* Absolute highest contrast for dynamic generation output */
  box-shadow: inset 1px 1px 4px rgba(0, 0, 0, 0.05);
  margin-top: 15px;
  width: 100%;
  max-width: 100%;
  min-height: 120px;
  max-height: 24vh;
  height: 120px;
  resize: none;
  box-sizing: border-box;
  overflow-y: auto;
}

@media (max-width: 480px) {
  .journal-container {
    padding: 20px 15px 20px 20px;
  }

  .journal-output-box {
    min-height: 100px;
    max-height: 22vh;
    height: 100px;
    font-size: 16px;
  }

  .gps-input-row {
    grid-template-columns: 1fr;
  }

  .suggestion-input-row {
    display: grid;
    grid-template-columns: 7fr 13fr !important;
    /* Two equal columns */
    gap: 16px;
    /* Adjust spacing between fields */

  }

  /* Make the third item span across both columns */
  .suggestion-input-row .suggestion-field:nth-child(3) {
    grid-column: span 2;
  }

  .suggestion-field label {
    font-size: 12px;
  }

  .suggestion-readonly {
    font-size: 12px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.3;
  }
}

.gps-map {
  position: relative;
  width: 100%;
  height: 360px;
  border: 1px solid #544637;
  border-radius: 6px;
  overflow: hidden;
  background: #dfe9f2;
  margin: 10px 0 14px;
}

.gps-map .maplibregl-map,
.gps-map .maplibregl-canvas-container,
.gps-map .maplibregl-canvas {
  width: 100%;
  height: 100%;
  background: #dfe9f2;
}

.gps-map .maplibregl-control-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.gps-map .maplibregl-ctrl {
  pointer-events: auto;
}

.gps-position-marker,
.gps-accuracy-circle {
  position: absolute;
  display: none;
  pointer-events: none;
  z-index: 350;
}

.gps-position-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2563eb;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2);
}

.gps-accuracy-circle {
  border-radius: 50%;
  background: rgba(96, 165, 250, 0.18);
  border: 2px solid rgba(59, 130, 246, 0.55);
  box-sizing: border-box;
}

.gps-center-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  border-radius: 50% 50% 50% 0;
  background: #b91c1c;
  border: 2px solid #ffffff;
  transform: translate(-50%, -100%) rotate(-45deg);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 500;
}

.gps-center-pin::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  background: #ffffff;
  border-radius: 50%;
  left: 5px;
  top: 5px;
}

.gps-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin: 10px 0 18px;
}

.gps-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.gps-field label {
  margin-bottom: 0;
}

.gps-field input[readonly] {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  pointer-events: none;
  cursor: default;
}

.gps-button {
  align-self: end;
  margin-bottom: 0;
  white-space: nowrap;
  height: fit-content;
}

.journal-btn.gps-button.missing-gps {
  background-color: #7f1d1d;
  border-color: #7f1d1d;
  color: #ffffff;
}

.form-actions {
  margin-top: 18px;
}

.suggestion-table-wrap {
  margin: 0 0 18px;
  border: none;
  background: transparent;
  overflow: visible;
}

.suggestion-input-row {
  display: grid;
  grid-template-columns: minmax(90px, 1.1fr) minmax(120px, 1.8fr) minmax(130px, 2.3fr);
  gap: 12px;
  align-items: end;
}

.suggestion-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.suggestion-field label {
  margin-bottom: 0;
  font-weight: 700;
  color: #110d0a;
}

.suggestion-readonly {
  width: 100%;
  background-color: transparent;
  border: none;
  border-bottom: 1px solid #544637;
  border-radius: 0;
  padding: 6px 4px;
  font-family: 'Georgia', serif;
  font-size: 16px;
  color: #110d0a;
  box-sizing: border-box;
  cursor: default;
}

.suggestion-readonly:focus {
  outline: 2px solid #2e4d31;
  outline-offset: 3px;
}

.chip {
  display: inline-block;
  background: #eadeca;
  border: 1px solid #544637;
  border-radius: 2px;
  padding: 3px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #110d0a;
  font-weight: bold;
}

body {
  margin: 0;
  background-color: #355831;
  /* Softened desk background slightly to help paper surface pop */
  background-size: 60px 60px;
  background-position: 0 0, 30px 30px;
  font-family: 'Georgia', serif;
  color: #110d0a;
  padding: 10px;
}