/* Report show / new / edit views. They reuse the card (.vote-container,
   .vote-card-wide), note boxes and sticky .vote-footer from ballot.css. */

/* ---- Show: label/value list ------------------------------------------- */
.report-details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1.25rem;
  margin: 1rem 0 1.25rem;
}

.report-details dt {
  color: #6b7280;
  font-weight: 600;
}

.report-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.report-media {
  margin-bottom: 1.25rem;
}

.report-media .media-caption {
  margin: 0.4rem 0 0;
  color: #4b5563;
  font-size: 0.9rem;
}

/* ---- Form --------------------------------------------------------------- */
.report-form h2 {
  margin: 1.75rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #e5e7eb;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.form-grid .field-wide {
  grid-column: 1 / -1;
}

/* Start/end date side by side on one line, even on phones. */
.form-grid .field-pair {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.field-pair .field {
  min-width: 0;
}

.report-form .field label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
}

.report-form input[type="text"],
.report-form input[type="number"],
.report-form input[type="date"],
.report-form select,
.report-form textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.65rem;
  font: inherit;
  color: #111827;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
}

.report-form textarea {
  resize: vertical;
}

.report-form input:focus-visible,
.report-form select:focus-visible,
.report-form textarea:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
  border-color: #2563eb;
}

.report-form input[type="file"] {
  max-width: 100%;
}

.form-errors {
  margin-bottom: 1rem;
  padding: 0.5rem 1rem;
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.5rem;
}

.form-errors h2 {
  margin: 0.25rem 0;
  padding: 0;
  border: 0;
  font-size: 1rem;
}

/* Nested record / embed. The layout lives on inner divs, not the fieldset, so
   the `.hide` class added by remove_records.js still hides the whole box. */
.nested-fields {
  min-width: 0; /* fieldsets default to min-content width, which lets wide iframes stretch the card */
  margin: 0 0 1rem;
  padding: 0.25rem 1rem 1rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
}

.nested-media {
  margin-top: 0.75rem;
  max-width: 100%;
  overflow: hidden;
}

.nested-media iframe {
  max-width: 100%;
}

.nested-media img {
  max-height: 14rem;
  width: auto;
}

.remove_fields {
  display: inline-block;
  margin-top: 0.75rem;
  color: #b91c1c;
  font-size: 0.9rem;
}

.add-row {
  margin-bottom: 0.5rem;
}

/* ---- Buttons (form submit rows and footer buttons) ---------------------- */
.secondary_button,
.vote-footer button,
.vote-footer input[type="submit"] {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  margin: 0;
  padding: 0 1rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.secondary_button {
  color: #374151;
  background: #fff;
  border: 1px solid #d1d5db;
}

.secondary_button:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

/* Edit / Update / Create: same blue primary as the ballot footer. */
.vote-footer button.edit_button {
  margin-left: auto;
  color: #fff;
  background: #2563eb;
  border: 1px solid #2563eb;
}

.vote-footer button.edit_button:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

/* Destroy: red, kept away from the primary action. */
.vote-footer .footer-form {
  margin: 0;
}

.vote-footer .danger_button {
  color: #b91c1c;
  background: #fff;
  border: 1px solid #fca5a5;
}

.vote-footer .danger_button:hover {
  color: #fff;
  background: #dc2626;
  border-color: #dc2626;
}

@media (max-width: 520px) {
  .report-details {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .report-details dd {
    margin-bottom: 0.5rem;
  }

  .vote-footer {
    flex-wrap: wrap;
  }
}
