/* --- Clients (modules/clients/views/list.php): the dashboard's greeting, tiles, bands and rows (pages/dashboard.css), laid
   out as Find a client on the left and Upcoming consultations over New clients on the right. Phones: one column, Find a
   client first, each list showing five then "Show N more". From 768px the page is the screen's height: Find a client
   and New clients stretch to the bottom and their lists scroll inside them. --- */

.clients {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.clients__tile {
  display: flex;
  flex-direction: column;
  overflow: clip; /* the band follows the tile's round corners */
}

/* A list's title inside a tile: the band's small capitals, in anthracite, with a line under it. */
.clients__sub {
  font-family: inherit;
  font-size: var(--fs-xxs);
  font-weight: 600;
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--c-anthracite);
}

.clients__found > .clients__sub {
  padding-block: var(--sp-3) var(--sp-2);
  border-bottom: var(--border-1) solid var(--c-line);
}

.clients__found {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* New clients' month: its name, the two round buttons to step back and forward, and how many joined. */
.clients__month {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding-bottom: var(--sp-2);
  border-bottom: var(--border-1) solid var(--c-line);
}

.clients__month .clients__sub {
  margin-right: var(--sp-1);
}

.clients__circle {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--sp-6);
  height: var(--sp-6);
  padding: 0;
  font-size: var(--fs-xxs);
  color: var(--c-anthracite);
  background-color: var(--c-page);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.clients__circle:disabled {
  opacity: 0.4;
  cursor: default;
}

.clients__count {
  margin-left: auto;
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}

/* A client: initials in a pale blue circle, name over email (or when they joined), and their tag on the right. */
.clients__row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding-block: var(--sp-2);
}

.clients__row {
  position: relative; /* holds its open button, which covers the whole row */
}

/* Opening a client: an invisible button over the row (it posts their id), so the whole row is the target. */
.clients__open {
  position: absolute;
  inset: 0;
  width: 100%;
  padding: 0;
  background: none;
  border: 0;
  border-radius: var(--radius-1);
  cursor: pointer;
}

.clients__row + .clients__row {
  border-top: var(--border-1) solid var(--c-line);
}

.clients__row .dashboard__what {
  flex: 1;
}

.clients__avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--sp-8);
  height: var(--sp-8);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--c-accent-text);
  background-color: var(--c-accent);
  border-radius: var(--radius-pill);
}

.clients__row mark {
  color: inherit;
  background-color: var(--c-warning-bg);
}

/* Phones: a list shows its first five; "Show N more" (a hidden tick box, so no JavaScript) shows the rest. */
.clients__row--more {
  display: none;
}

.clients__more-box:checked ~ .clients__rows .clients__row--more {
  display: flex;
}

.clients__more {
  align-self: start;
  padding-block: var(--sp-1);
  font-size: var(--fs-small);
  color: var(--c-action);
  text-decoration: underline;
  cursor: pointer;
}

.clients__more-box:checked ~ .clients__more {
  display: none;
}

.clients__more-box:focus-visible ~ .clients__more {
  outline: var(--border-1) solid var(--c-action);
  outline-offset: var(--border-1);
}

@media (hover: hover) {
  .clients__circle:hover:not(:disabled) {
    background-color: var(--c-surface);
  }

  .clients__row:has(.clients__open:hover) {
    background-color: var(--c-off-white);
  }
}

/* From 768px: two columns the screen's height (under the tablet's top bar, then beside the sidebar from 992px). */
@media (min-width: 768px) {
  .admin__page:has(> .clients) {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--admin-top-h));
    height: calc(100dvh - var(--admin-top-h)); /* 100vh first for browsers without dvh */
  }

  .clients {
    display: grid;
    flex: 1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto auto minmax(0, 1fr);
    min-height: 0;
  }

  .clients .dashboard__hello {
    grid-column: 1 / -1;
  }

  .clients__find {
    grid-row: 2 / 4;
    min-height: 0;
  }

  .clients__new {
    min-height: 0;
  }

  .clients__scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .clients__row--more {
    display: flex; /* every new client, scrolling inside the tile */
  }

  .clients__more {
    display: none;
  }
}

@media (min-width: 992px) {
  .admin__page:has(> .clients) {
    height: 100vh;
    height: 100dvh; /* no top bar beside the sidebar */
  }
}
