/* Reportes de problemas — listado, detalle y form del usuario. El backoffice
   reusa .admin-table / .admin-form; acá solo lo del lado público + los
   modificadores de .badge por estado (compartidos con el admin). */

.reports-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.reports-head > div { min-width: 0; }

.reports-title {
  font-family: var(--font-brand);
  font-size: 2rem;
  line-height: 1;
  margin: 0;
}

.reports-subtitle {
  color: var(--fg-2);
  margin: 6px 0 0;
  font-size: 0.9rem;
}

/* Mobile: el header apila y el CTA pasa a ancho completo (más tocable). */
@media (max-width: 560px) {
  .reports-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .reports-head .btn {
    width: 100%;
  }
}

.reports-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.report-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.report-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-hover);
}

.report-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.report-card__date {
  color: var(--fg-3);
  font-size: 0.8rem;
  font-family: var(--mono);
}

.report-card__message {
  margin: 0;
  color: var(--fg);
  font-size: 0.95rem;
}

.report-card__meta {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  color: var(--fg-3);
  font-size: 0.8rem;
}

.report-card__meta .-response { color: var(--green); }

.reports-load-more {
  margin-top: 16px;
  text-align: center;
}

/* Form de reporte (lado usuario) */
.report-form {
  max-width: 640px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.report-form__field {
  margin-bottom: 18px;
}

.report-form__field > .input.-area {
  min-height: 120px;
  line-height: 1.5;
  resize: vertical;
}

.report-form__hint {
  margin: 0 0 8px;
  color: var(--fg-3);
  font-size: 0.78rem;
}

.report-form__field > .input.-file,
.report-reply__field > .input.-file {
  padding: 8px;
  cursor: pointer;
}

.report-form__field > .input.-file::file-selector-button,
.report-reply__field > .input.-file::file-selector-button {
  margin-right: 12px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--fg-2);
  font-family: var(--font);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.report-form__field > .input.-file::file-selector-button:hover,
.report-reply__field > .input.-file::file-selector-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
}

.report-form__errors {
  margin-bottom: 18px;
  padding: 12px 14px;
  background: var(--red-dim);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
}

.report-form__error {
  margin: 0;
  color: var(--red);
  font-size: 0.85rem;
}

.report-form__error + .report-form__error {
  margin-top: 6px;
}

.report-form__actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

@media (max-width: 560px) {
  .report-form {
    padding: 16px;
  }

  .report-form__actions {
    flex-direction: column;
  }

  .report-form__actions > .btn {
    width: 100%;
  }
}

/* Desktop: aprovecha el ancho con 2 columnas — mensaje (ancho) + imágenes
   (al costado). Errores y acciones cruzan a todo el ancho. */
@media (min-width: 768px) {
  .report-form {
    max-width: none;
    display: grid;
    grid-template-columns: 1.7fr 1fr;
    column-gap: 28px;
    align-items: start;
    padding: 28px 32px;
  }

  .report-form__errors,
  .report-form__actions {
    grid-column: 1 / -1;
  }

  .report-form__field {
    margin-bottom: 0;
  }

  .report-form__field > .input.-area {
    min-height: 200px;
  }
}

/* Galería de capturas dentro de una burbuja del chat */
.report-detail__images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.report-detail__thumb {
  height: 120px;
  width: auto;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
}

/* Modificadores de estado para .badge (usuario + admin) */
.badge.-open      { color: var(--blue); }
.badge.-reviewing { color: var(--amarilla); }
.badge.-resolved  { color: var(--green); }
.badge.-closed    { color: var(--fg-3); }

/* ── Chat del reporte (usuario + admin) ──────────────────────────────────
   Una sola caja con fondo y borde: hilo scrolleable arriba + composer
   compacto abajo. Ocupa todo el ancho disponible; el hilo es ancho y de alto
   acotado (scrollea), no transparente. */
.report-chat {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.report-chat__thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--bg-2);
}

@media (min-width: 768px) {
  .report-chat__thread { max-height: 440px; }
}

.report-bubble {
  max-width: 640px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* "Mío" = a la derecha y resaltado; "del otro" = a la izquierda, neutro. Qué
   lado es cada uno lo decide el caller según quién mira (usuario o admin). */
.report-bubble.-mine {
  align-self: flex-end;
  background: var(--accent-dim);
  border-color: transparent;
}

.report-bubble.-theirs {
  align-self: flex-start;
}

.report-bubble__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.report-bubble__author {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fg-2);
}

.report-bubble.-mine .report-bubble__author {
  color: var(--accent);
}

.report-bubble__time {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--fg-3);
  white-space: nowrap;
}

.report-bubble__body {
  color: var(--fg);
  font-size: 0.92rem;
  line-height: 1.5;
}

.report-bubble__body p {
  margin: 0 0 0.5em;
}

.report-bubble__body p:last-child {
  margin-bottom: 0;
}

.report-bubble .report-detail__images {
  margin-top: 10px;
}

.report-bubble .report-detail__thumb {
  height: 110px;
}

/* ── Composer (barra de envío) ──────────────────────────────────────── */
.report-chat__composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--card);
}

.report-chat__row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

/* Clip de adjuntar — el <input type=file> real va oculto detrás. */
.report-chat__attach {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--fg-2);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.report-chat__attach:hover {
  border-color: var(--line-strong);
  color: var(--fg);
}

.report-chat__file {
  display: none;
}

.report-chat__count {
  display: none;
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.report-chat__count.-on {
  display: block;
}

.report-chat__input {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  max-height: 140px;
  padding: 9px 12px;
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--fg);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.4;
  resize: none;
  outline: none;
}

.report-chat__input:focus {
  border-color: var(--accent);
}

.report-chat__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  transition: background 0.15s ease;
}

.report-chat__send:hover {
  background: var(--accent-2);
}

.report-chat__errors {
  padding: 8px 12px;
  background: var(--red-dim);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
}

.report-chat__error {
  margin: 0;
  color: var(--red);
  font-size: 0.82rem;
}

.report-chat__error + .report-chat__error {
  margin-top: 4px;
}

.report-chat__closed {
  padding: 16px;
  border-top: 1px solid var(--line);
  background: var(--card);
  color: var(--fg-3);
  font-size: 0.9rem;
  text-align: center;
}

/* Cierre por el usuario, debajo del chat */
.report-thread__close {
  margin-top: 16px;
}

.report-thread__close .field-hint {
  margin-bottom: 8px;
}
