/* Correction / Report-misinformation styles (StoryTerra)
   Covers: report button next to Locations heading + correction overlay popup. */

.report-correction-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin-left: 0.6rem;
  padding: 0.15rem 0.55rem;
  font-size: 0.95rem;
  line-height: 1.4;
  border-radius: 999px;
  border: 1px solid rgba(204, 58, 122, 0.55);
  background: linear-gradient(135deg, rgba(95, 26, 58, 0.12), rgba(42, 13, 28, 0.12));
  color: inherit;
  cursor: pointer;
  vertical-align: middle;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  white-space: nowrap;
}

.report-correction-btn:hover,
.report-correction-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(204, 58, 122, 0.25);
  background: linear-gradient(135deg, #5f1a3a, #2a0d1c);
  color: #fff;
  outline: none;
}

.report-correction-btn .report-correction-icon {
  font-size: 0.9em;
}

/* Keep Locations heading + button on one comfortable row.
   Uses .has-correction-btn (added by correction.js at inject time) plus
   !important so it wins over per-type rules like the game card's
   `display: block !important` and the youtube card's higher-specificity
   `display: block`. Margins/colors from the per-type rules still apply. */
.expanded-card.expanded .locations-heading.has-correction-btn {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.expanded-card.expanded .locations-heading.has-correction-btn h4 {
  margin: 0;
  flex: 1 1 auto;
}

/* Small inline suggest link inside history-panel expanded meta */
.history-correction-link {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.5rem;
  font-size: 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(204, 58, 122, 0.55);
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.history-correction-link:hover {
  background: #5f1a3a;
  color: #fff;
}

/* ---------- Overlay popup (mirrors #contact-popup behaviour) ---------- */
#correction-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10001;
  animation: fadeIn 0.25s ease-out;
  padding: 1rem;
  box-sizing: border-box;
}

.correction-content {
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  overflow-y: auto;
  background: #fff;
  color: #222;
  padding: 1.5rem 1.5rem 1.25rem;
  border-radius: 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  position: relative;
  animation: slideIn 0.25s ease-out;
  box-sizing: border-box;
}

.correction-content h2 {
  color: #4a9eff;
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
  font-weight: 700;
  padding-right: 2rem;
}

.correction-sub {
  color: #666;
  font-size: 0.88rem;
  line-height: 1.5;
  margin: 0 0 1rem;
}

.correction-close-btn {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: none;
  background: #f0f0f0;
  color: #555;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

.correction-close-btn:hover {
  background: #e0e0e0;
  color: #222;
}

/* Item preview header */
.correction-item-preview {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  background: #f7f9fc;
  border: 1px solid #e5eaf1;
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 1.1rem;
}

.correction-item-preview img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 8px;
  background: #ddd;
  flex: 0 0 auto;
}

.correction-item-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.2rem;
  color: #1c1c1c;
}

.correction-item-type {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #e8f1ff;
  color: #2d7dd2;
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  margin-bottom: 0.35rem;
}

.correction-item-meta {
  font-size: 0.8rem;
  color: #555;
  line-height: 1.5;
}

.correction-item-desc {
  font-size: 0.8rem;
  color: #666;
  line-height: 1.5;
  margin-top: 0.35rem;
  max-height: 5.5em;
  overflow-y: auto;
}

/* Sections */
.correction-section {
  border: 1px solid #e7e7e7;
  border-radius: 12px;
  padding: 0.9rem;
  margin-bottom: 0.9rem;
  background: #fff;
}

.correction-section h3 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
  color: #333;
}

.correction-hint {
  font-size: 0.82rem;
  color: #777;
  margin: 0 0 0.6rem;
  line-height: 1.5;
}

.correction-location-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid #eee;
  border-radius: 8px;
  margin-bottom: 0.4rem;
  background: #fafafa;
  cursor: pointer;
  font-size: 0.88rem;
  line-height: 1.4;
}

.correction-location-row:hover {
  border-color: #cfd8e3;
  background: #f3f7fd;
}

.correction-location-row input[type="checkbox"] {
  margin-top: 0.2rem;
  width: 1rem;
  height: 1rem;
  accent-color: #2d7dd2;
  flex: 0 0 auto;
  cursor: pointer;
}

.correction-location-row.removed {
  opacity: 0.55;
  text-decoration: line-through;
  background: #fdf0f0;
  border-color: #f0c9c9;
}

.correction-location-row .correction-location-text {
  flex: 1 1 auto;
}

.correction-empty {
  font-size: 0.85rem;
  color: #888;
  font-style: italic;
  padding: 0.4rem 0;
}

.correction-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  border: 1px dashed #2d7dd2;
  background: #f0f6ff;
  color: #2d7dd2;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.correction-add-btn:hover {
  background: #e1efff;
}

.correction-add-btn.disabled,
.correction-add-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #f0f0f0;
  border-color: #ccc;
  color: #888;
}

.correction-limit-note {
  font-size: 0.8rem;
  color: #98661a;
  background: #fdf6e3;
  border: 1px solid #f0dcb0;
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  margin-top: 0.45rem;
  line-height: 1.4;
}

.correction-counter {
  text-align: right;
  font-size: 0.75rem;
  color: #999;
  margin: 0.2rem 0 0.1rem;
}

.correction-new-location-row {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.correction-new-location-row input {
  flex: 1 1 auto;
  padding: 0.55rem 0.65rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: inherit;
  box-sizing: border-box;
}

.correction-new-location-row input:focus {
  outline: none;
  border-color: #4a9eff;
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.12);
}

.correction-remove-new-btn {
  flex: 0 0 auto;
  border: none;
  background: #f5d5d5;
  color: #a33;
  border-radius: 8px;
  width: 2.2rem;
  cursor: pointer;
  font-size: 1rem;
}

.correction-remove-new-btn:hover {
  background: #eebcbc;
}

.correction-original-time {
  font-size: 0.85rem;
  color: #555;
  background: #f7f9fc;
  border: 1px solid #e5eaf1;
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.55rem;
  line-height: 1.5;
}

.correction-content textarea,
.correction-content input[type="text"],
.correction-content input[type="email"] {
  width: 100%;
  padding: 0.65rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.correction-content textarea:focus,
.correction-content input[type="text"]:focus,
.correction-content input[type="email"]:focus {
  outline: none;
  border-color: #4a9eff;
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.12);
}

.correction-content textarea {
  resize: vertical;
}

.correction-field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #555;
  margin: 0 0 0.3rem;
}

.correction-form-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.correction-form-row > div {
  flex: 1;
}

.correction-error {
  display: none;
  font-size: 0.83rem;
  color: #b3261e;
  background: #fdecea;
  border: 1px solid #f5c6c2;
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.6rem;
}

.correction-submit-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #4a9eff, #2d7dd2);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.8rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.correction-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 158, 255, 0.3);
}

.correction-submit-btn:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.correction-classic-btn {
  width: 100%;
  padding: 0.6rem 1rem;
  background: #f0f6ff;
  color: #2d7dd2;
  border: 1px solid #2d7dd2;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
}

.correction-classic-btn:hover {
  background: #e1efff;
}

.correction-cancel-btn {
  display: block;
  width: 60%;
  max-width: 140px;
  margin: 0.8rem auto 0;
  background: #f0f0f0;
  color: #666;
  border: none;
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}

.correction-cancel-btn:hover {
  background: #e0e0e0;
  color: #333;
}

.correction-success {
  display: none;
  font-size: 0.88rem;
  color: #1a5f3a;
  background: #e7f6ec;
  border: 1px solid #bfe3c9;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.6rem;
  line-height: 1.5;
}

/* ---------- Bottom toast (success feedback after overlay closes) ---------- */
#correction-toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%) translateY(20px);
  background: rgba(20, 20, 25, 0.95);
  color: #fff;
  padding: 0.8rem 1.3rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.9rem;
  line-height: 1.4;
  max-width: min(90vw, 480px);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 10003;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

#correction-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Shared FormSubmit AJAX status UI (contact + correction) ---------- */
.formsubmit-status {
  display: none;
  font-size: 0.88rem;
  line-height: 1.5;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin-top: 0.7rem;
}

.formsubmit-status.show-ok {
  display: block;
  color: #1a5f3a;
  background: #e7f6ec;
  border: 1px solid #bfe3c9;
}

.formsubmit-status.show-error {
  display: block;
  color: #8f1d17;
  background: #fdecea;
  border: 1px solid #f5c6c2;
}

.formsubmit-classic-btn {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  border: 1px solid #2d7dd2;
  background: #f0f6ff;
  color: #2d7dd2;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.formsubmit-classic-btn:hover {
  background: #e1efff;
}

@media (max-width: 560px) {  .correction-content {
    padding: 1.1rem 0.9rem 1rem;
    max-height: 92vh;
  }

  .correction-item-preview img {
    width: 64px;
    height: 64px;
  }

  .correction-form-row {
    flex-direction: column;
  }

  .report-correction-btn .report-correction-label {
    display: none;
  }

  .report-correction-btn {
    padding: 0.15rem 0.5rem;
  }
}
