/* archive.css
   Styles for the Genealogy Document Archives:
   records.html (list, search and filters) and
   record-viewer.html (document viewer and the 'Add New Document' form).
   Loaded after  and records.css. */

.archive-title {
  text-align: center;
  padding: 0.2em 0;
}

.archive-back {
  text-align: center;
  margin: 0 0 0.5em 0;
}

/* ===== Search and filters on records.html (see js/list-builder.js) ===== */
#archive-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  align-items: center;
  justify-content: center;
  margin-bottom: 1em;
  padding: 0.6em;
  background: #ddd5be;
  border-radius: 8px;
}

#archive-filters input,
#archive-filters select,
#archive-filters button {
  font-family: inherit;
  font-size: 0.85em;
  padding: 0.3em;
  border: 1px solid #2d2f24;
  border-radius: 4px;
  background: #fff;
}

#filter-text {
  flex: 1 1 260px;
}

#filter-count {
  font-size: 0.8em;
  color: #485E48;
}

.link-list li {
  margin: 0.2em 0;
}

.doc-meta {
  font-size: 0.85em;
  color: #555;
}

.no-results {
  text-align: center;
}

/* ===== Document viewer (see js/create-areas.js) ===== */
#doc-details {
  text-align: center;
  font-size: 0.9em;
  color: #485E48;
  margin: 0.3em auto 0.8em auto;
  width: 80%;
}

.doc-edit-link {
  font-size: 0.85em;
  margin-left: 0.5em;
}

.mag-controls {
  display: flex;
  gap: 1em;
  align-items: center;
  justify-content: center;
  margin: 0.5em 0;
  font-size: 0.85em;
}

.mag-hint {
  color: #555;
  font-style: italic;
}

#doc-container {
  position: relative;
  display: inline-block;
  width: 100%;
}

.magGlass-container {
  text-align: center;
  position: relative;
  z-index: 1;
}

.magGlass-container img {
  display: inline-block;
}

#doc-image {
  position: relative;
  z-index: 1;
}

/* Magnifier glass (see js/magnifier.js) */
.img-magnifier-glass {
  position: absolute;
  border: 1px solid #f00;
  outline: 2px dashed red;
  width: 250px;
  height: 150px;
  background-color: white;
  background-repeat: no-repeat;
  border-radius: 10px;
  cursor: none;
  z-index: 1000;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.4);
  transition: opacity 0.3s ease;
  opacity: 0;
  display: block;
  pointer-events: none;
}

.magGlass-container.hide-cursor,
.magGlass-container.hide-cursor * {
  cursor: none !important;
}

/* Red boxes over the area of interest (see js/zoomArea.js) */
.highlight-box {
  position: absolute;
  border: 3px solid red;
  pointer-events: none;
  z-index: 9;
  border-radius: 10px;
}

.highlight-box.area {
  pointer-events: auto;
  border-color: rgba(255, 0, 0, 0.5);
  cursor: zoom-in;
}

.highlight-box.enlarged {
  z-index: 2000;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
  background-repeat: no-repeat;
  border-radius: 20px;
  cursor: zoom-out;
}

.zoom-caption {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  margin-top: 8px;
  background: rgba(0, 0, 0, 0.9);
  color: #8f8;
  padding: 6px 18px;
  border-radius: 8px;
  font-size: 1em;
  z-index: 2100;
  pointer-events: none;
  width: 90%;
  text-align: center;
}

/* ===== 'Add New Document' form (see js/record-editor.js) ===== */
.styled-form {
  max-width: 950px;
  text-align: left;
}

.styled-form fieldset {
  min-width: 0;
}

/* keep the inputs inside the form (textareas are 80 columns wide by default) */
.styled-form .form-row input[type="text"],
.styled-form .form-row textarea,
.people-box, .areas-box {
  min-width: 0;
}

.styled-form .form-row textarea {
  width: 100%;
  font-family: inherit;
}

.styled-form legend {
  margin-bottom: 0.3em;
}

.styled-form ul {
  font-size: 0.9em;
}

.form-row-top {
  align-items: flex-start;
}

.doc-id {
  font-weight: bold;
  color: #485E48;
}

.people-box, .areas-box {
  flex: 1;
}

#people-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3em 1.2em;
  margin-bottom: 0.4em;
}

.form-row label.person-choice,
.form-row label.area-pick,
.form-row label.percent-pair {
  width: auto;
  font-weight: normal;
}

.form-row label.area-pick {
  font-weight: bold;
}

.new-person {
  display: flex;
  gap: 0.5em;
}

.area-row {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0.4em 0.6em;
  margin-bottom: 0.5em;
  background: #fff;
}

.area-row.selected {
  border-color: red;
}

.area-row .percent-group {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.6em;
  margin: 0.3em 0 0.4em 0;
}

.area-row textarea {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.4em;
  font-family: inherit;
}

.small-button {
  font-size: 0.85em;
  padding: 0.3em 0.8em;
  border: 1px solid #2d2f24;
  border-radius: 4px;
  background: #ddd5be;
  cursor: pointer;
}

.form-actions {
  flex-wrap: wrap;
}

.form-actions button.danger {
  background-color: #a33;
  margin-left: auto;
}

.form-status {
  font-weight: bold;
  color: #485E48;
  min-height: 1.2em;
}

.form-status.error {
  color: #a33;
}

/* Areas being drawn in the form: dashed until chosen */
.highlight-box.edit-area {
  border: 3px dashed rgba(255, 0, 0, 0.6);
  border-radius: 4px;
}

.highlight-box.edit-area.selected {
  border: 3px solid red;
}

/* Comment below the document image */
.doc-comment {
  width: 80%;
  margin: 1em auto;
  padding: 0.8em 1em;
  background: #f1e9d2;
  border-left: 4px solid #485E48;
  border-radius: 4px;
  white-space: pre-line;   /* keeps line breaks typed in the form */
  text-align: left;
}
