/* ---------- Reports: the queue tabs, list rows and the report's page ---------- */

/* How many are waiting, beside a section's name in its segmented control (Entregas, Solicitudes, Tareas) */
.tabs__count {
  min-width: 1.25rem;
  padding: 0 var(--space-1-5);
  border-radius: var(--radius-full);
  background: var(--color-surface-sunken);
  color: var(--color-text);
  font-size: var(--text-xs);
  text-align: center;
}

.report-list {
  padding: 0;
  list-style: none;
}

.report-row + .report-row {
  border-top: var(--border);
}

.report-row__link {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: inherit;
  text-decoration: none;

  &:hover {
    background: var(--color-surface-hover);
  }
}

.report-row__thumb {
  position: relative;
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 5rem;
  height: 5rem;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--color-primary-subtle);
  color: var(--color-text-subtle);

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  > svg {
    width: 1.5rem;
    height: 1.5rem;
  }

  /* On phones the status drops below, since three columns don't fit */
  @media (max-width: 48rem) {
    width: 4rem;
    height: 4rem;
  }
}

.report-row__photo-count {
  position: absolute;
  right: var(--space-1);
  bottom: var(--space-1);
  min-width: 1.25rem;
  padding: 0 var(--space-1);
  border-radius: var(--radius-full);
  background: rgb(0 0 0 / 65%);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-align: center;
}

.report-row__body {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: var(--space-0-5);
  min-width: 0;
}

.report-row__kind {
  font-weight: var(--weight-semibold);
}

.report-row__description {
  color: var(--color-text);
  font-size: var(--text-sm);
}

.report-row__match {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* What was searched, within a row */
.report-row mark {
  border-radius: var(--radius-xs);
  background: var(--color-warning-border);
  color: var(--color-text);
  font-weight: var(--weight-semibold);
}

.report-row__meta {
  color: var(--color-text-subtle);
  font-size: var(--text-xs);
}

.report-row__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);

  @media (max-width: 48rem) {
    flex-direction: row;
    flex-basis: 100%;
    flex-wrap: wrap;
    align-items: center;
  }
}

/* In a page's sidebar there's no room for three columns: as on a phone */
aside .report-row__thumb {
  width: 4rem;
  height: 4rem;
}

aside .report-row__side {
  flex-direction: row;
  flex-basis: 100%;
  flex-wrap: wrap;
  align-items: center;
}

/* A report's colony and cat, changed right on its page */
.report-link {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.report-description {
  font-size: var(--text-md);
}

/* The comment takes the room left, then the status and its button; one under another on a phone */
.status-move {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(10rem, auto) auto;
  gap: var(--space-3);
  align-items: end;

  @media (max-width: 48rem) {
    grid-template-columns: minmax(0, 1fr);
  }
}

.assign-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Status changes and assignments are quieter dots than comments */
.timeline__item--status_change::before,
.timeline__item--assignment::before {
  background: var(--color-text-subtle);
}

/* Reports on the map: an orange dot */
.map-marker--report {
  background: var(--color-warning);
}

.map-marker--shelter {
  background: var(--color-info);
  border-radius: 4px;
}

/* ---------- reports#index: the queues on the left, the list on the right ---------- */

.reports-layout {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

.queue-nav {
  position: sticky;
  top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-0-5);
}

.queue-nav__group {
  display: flex;
  flex-direction: column;
  gap: var(--space-0-5);
  padding: 0;
  list-style: none;
}

.queue-nav__label {
  margin: var(--space-3) 0 var(--space-1);
  padding: 0 var(--space-3);
  color: var(--color-text-subtle);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.queue-nav__end {
  display: flex;
  flex-direction: column;
  gap: var(--space-0-5);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: var(--border);
}

.queue-nav__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-1-5) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: var(--text-sm);
  text-decoration: none;

  &:hover {
    background: var(--color-surface-hover);
  }

  &[aria-current="page"] {
    background: var(--color-primary-subtle);
    color: var(--color-primary-text);
    font-weight: var(--weight-medium);
  }
}

/* A queue with nothing waiting: still there, but quiet */
.queue-nav__link--empty:not([aria-current="page"]) {
  color: var(--color-text-subtle);
}

.queue-nav__count {
  min-width: 1.5rem;
  padding: 0 var(--space-1-5);
  border-radius: var(--radius-full);
  background: var(--color-surface-sunken);
  color: var(--color-text);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-align: center;
}

.queue-nav__link[aria-current="page"] .queue-nav__count {
  background: var(--color-primary);
  color: #fff;
}

/* All the filters in one row where they fit, the colony's long names with the most room, and the queues' short ones
   giving up some. On narrower windows they wrap instead of squeezing */
@media (min-width: 80rem) {
  .reports-layout {
    grid-template-columns: 12rem minmax(0, 1fr);
  }

  .reports-layout .filters {
    display: grid;
    grid-template-columns: 1.15fr 1.15fr 1fr 1.3fr;
  }

  .reports-layout .filters__search {
    max-width: none;
  }

  .reports-layout .filters__select {
    width: 100%;
    min-width: 0;
  }
}

/* Tablets and phones: the queues become chips that wrap above the list (no sideways scrolling) */
@media (max-width: 64rem) {
  .reports-layout {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .queue-nav,
  .queue-nav__group,
  .queue-nav__end {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-1-5);
  }

  .queue-nav__label {
    display: none;
  }

  .queue-nav__end {
    margin: 0;
    padding: 0;
    border: 0;
  }

  .queue-nav__link {
    border: var(--border);
    border-radius: var(--radius-full);
    background: var(--color-surface);
    padding: var(--space-1) var(--space-3);
  }
}

/* An evaluation's questions: the question, then yes / no / not observed */
.evaluation-question {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  margin: 0;
  padding: var(--space-2) 0;
  border: 0;
  border-bottom: var(--border-width) solid var(--color-border);

  > legend {
    float: left;
    flex: 1 1 16rem;
    padding: 0;
    font-size: var(--text-sm);
  }
}


/* An adoption request's questionnaire (reports/_adoption_application): whole questions, so not the usual small
   uppercase labels; each section under its own heading */
.adoption-application {
  .card__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
  }

  .form-section-title {
    margin: 0 0 var(--space-3);
  }

  .details {
    gap: var(--space-3);
  }

  dt {
    font-size: var(--text-sm);
    text-transform: none;
    letter-spacing: normal;
  }

  dd p {
    margin: 0;
  }
}

/* "Asignar un aviso existente" (cats/report_assignments): each aviso's row, its button beside it (under it on phones) */
.report-assignment {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-right: var(--space-4);

  .report-list {
    flex: 1;
    min-width: 0;
  }

  & + & {
    border-top: var(--border);
  }

  @media (max-width: 40rem) {
    flex-direction: column;
    align-items: stretch;
    padding: 0 var(--space-4) var(--space-4);

    .report-list {
      margin: 0 calc(-1 * var(--space-4));
    }
  }
}

/* ---------- The cats an aviso is about (reports/_cat_card): short cards across its first card and its form ---------- */

.report-cats {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.report-cat {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: var(--border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.report-cat__link {
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;

  &:hover .report-cat__name {
    text-decoration: underline;
  }
}

.report-cat__main {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.report-cat__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.report-cat__name {
  font-weight: var(--weight-medium);
}

.report-cat__meta {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-cat__badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-1);
}

/* On phones the pills go under the name, so the card stays one short row with its photo */
@media (max-width: 40rem) {
  .report-cat {
    flex-wrap: wrap;
  }

  .report-cat__badges {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
    padding-left: calc(2.75rem + var(--space-3));
  }
}

/* "Añadir gato" under the cats and the address: the button, and the line it shows across the card */
.report-add-cat {
  display: grid;
  justify-items: start;
  gap: var(--space-3);

  > [data-add-line-target="line"] {
    justify-self: stretch;
  }
}

/* ---------- The adoption contract: its public page (public_adoption_contracts) and its card on the aviso ---------- */

/* The box to sign in: wide, not too tall, touch drawing without scrolling the page */
.signature-pad {
  display: block;
  width: 100%;
  height: 12rem;
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}

.contract-text {
  margin: 0;
  padding-left: var(--space-5);
  display: grid;
  gap: var(--space-1);
}
