/* Interface-specific additions on top of the extracted dashboard.css:
   login screen, loading state, create-team card, small utilities. */

.is-hidden {
  display: none !important;
}

/* ---------------------------------------------------------------- login --- */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.login-card {
  width: min(400px, 100%);
  display: grid;
  gap: 0.9rem;
  padding: 2rem 1.8rem;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.login-card__brand {
  justify-content: center;
  margin-bottom: 0.4rem;
}

.login-card__title {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: 1.25rem;
  text-align: center;
}

.login-card__subtitle {
  margin: -0.5rem 0 0.4rem;
  color: var(--muted);
  text-align: center;
}

.login-card__submit {
  justify-content: center;
  margin-top: 0.4rem;
  padding: 0.7rem 1rem;
}

.login-card__error {
  margin: 0;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--red-soft);
  border: 1px solid rgba(255, 77, 87, 0.35);
  color: var(--red);
}

.login-card__hint {
  margin: 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.78rem;
}

/* -------------------------------------------------------------- loading --- */

.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 100vh;
  color: var(--muted);
}

.loading-screen__spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  animation: hb-spin 0.9s linear infinite;
}

@keyframes hb-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------------------------------------------------- create team --- */

.team-card--create {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  min-height: 180px;
  border-style: dashed;
  color: var(--muted);
  text-align: center;
}

.team-card--create:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.team-card--create .icon {
  width: 1.6rem;
  height: 1.6rem;
}

/* --------------------------------------------------------------- extras --- */

.athlete-team-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.athlete-team-chip {
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-3);
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ------------------------------------------------ profile card alignment --- */
/* The email/name could overflow and shove the chevron out of alignment;
   pin the chevron and truncate the text instead. */
.profile-card__text {
  flex: 1 1 auto;
  overflow: hidden;
}

.profile-card__text strong,
.profile-card__text small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-card__chevron {
  flex: 0 0 auto;
}

/* --------------------------------------------------- header team + refresh --- */

.team-select {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}

.team-select .icon {
  color: var(--muted);
}

.team-select select {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  padding-right: 0.4rem;
  max-width: 210px;
  cursor: pointer;
}

/* The open dropdown popup is painted by the OS and won't inherit the transparent
   select background, so set explicit dark colors on the options themselves. */
.team-select option {
  background-color: var(--panel-2);
  color: var(--text);
}

.team-select select:focus-visible {
  outline: 2px solid var(--border-strong);
  border-radius: 4px;
}

.refresh-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}

.refresh-button:hover {
  border-color: var(--border-strong);
  color: var(--green);
}

.refresh-button.is-spinning .icon {
  animation: hb-spin 0.8s linear infinite;
}

/* ---------------------------------------------------------- inline loader --- */

.inline-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 120px;
  padding: 1.5rem;
  color: var(--muted);
}

.inline-loader__spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  animation: hb-spin 0.8s linear infinite;
}

.pagination__ellipsis {
  display: inline-grid;
  place-items: center;
  min-width: 1.5rem;
  color: var(--muted);
}

/* ------------------------------------------------------ athlete status filter --- */

.status-filter {
  display: flex;
  align-items: center;
  padding: 0 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(12, 17, 15, 0.92);
}

.status-filter select {
  width: 100%;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  padding: 0.8rem 0;
  cursor: pointer;
}

.status-filter option {
  background-color: var(--panel-2);
  color: var(--text);
}

.status-filter select:focus-visible {
  outline: 2px solid var(--border-strong);
  border-radius: 4px;
}

/* ------------------------------------------------------------ re-jump panel --- */

.rejump-panel {
  margin-bottom: 0.75rem;
}

/* Panel headers with a "View all" link: the title block takes the space and the
   link stays a small pill. The more specific selector overrides the mobile rule
   that makes every .secondary-button full-width. */
.panel-card__header > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.panel-card__header .view-all-button {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  padding: 0.4rem 0.7rem;
  gap: 0.3rem;
  font-size: 0.72rem;
  white-space: nowrap;
}

.panel-card__header .view-all-button .icon {
  width: 0.9rem;
  height: 0.9rem;
}

/* ------------------------------------------------ tablet / phone top bar --- */

/* Below the desktop breakpoint the sidebar collapses into a drawer and the top
   bar shows only the logo mark, not the wordmark. */
@media (max-width: 1120px) {
  .brand-lockup--mobile .brand-wordmark {
    display: none;
  }
}

/* ============================================================ athletes page ===
   Desktop: a table. Below 960px each row becomes a card (two per row on
   tablet, one on phone) so nothing needs horizontal scrolling. */

/* Search takes the space, status filter stays a fixed-width column. */
.filters-row {
  grid-template-columns: minmax(0, 1fr) minmax(170px, 240px);
}

.athletes-card > .filters-row {
  padding: 0 0.95rem;
}

.athlete-row__name .table-link-button {
  overflow-wrap: anywhere;
}

/* Desktop fixed-height layout: the card is the screen's only child, so give it
   the full height and let the table scroll inside it. */
@media (min-width: 1121px) {
  #viewAthletes.is-active {
    grid-template-rows: minmax(0, 1fr);
  }
}

/* Header controls: the team picker stretches, the refresh button stays square. */
@media (max-width: 1120px) {
  .header-actions .team-select {
    flex: 1 1 220px;
    min-width: 0;
    min-height: 44px;
  }

  .header-actions .refresh-button {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
  }

  .team-select select {
    width: 100%;
    max-width: none;
    min-width: 0;
    text-overflow: ellipsis;
  }
}

@media (max-width: 960px) {
  .athlete-table {
    display: block;
    min-width: 0;
  }

  .athlete-table thead {
    display: none;
  }

  .athlete-table tbody {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
    padding: 0.1rem 0.95rem 0.4rem;
  }

  .athlete-table tbody tr.athlete-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name status"
      "date date"
      "action action"
      "notes notes";
    align-items: center;
    gap: 0.5rem 0.6rem;
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
  }

  .athlete-table tbody tr.athlete-row:hover {
    background: rgba(255, 255, 255, 0.035);
  }

  .athlete-table tbody td {
    display: block;
    padding: 0;
    border: 0;
    font-size: 0.78rem;
  }

  .athlete-row__name {
    grid-area: name;
    min-width: 0;
  }

  .athlete-row__name .table-link-button {
    font-size: 0.92rem;
  }

  .athlete-row__status {
    grid-area: status;
    justify-self: end;
  }

  .athlete-row__date {
    grid-area: date;
    color: var(--muted);
  }

  .athlete-row__date::before {
    content: attr(data-label) " · ";
  }

  .athlete-row__action {
    grid-area: action;
  }

  .athlete-row__action .action-button {
    width: 100%;
    min-height: 40px;
  }

  .athlete-row__notes {
    grid-area: notes;
  }

  .athlete-row__notes .notes-input {
    width: 100%;
    min-width: 0;
    min-height: 40px;
  }
}

@media (max-width: 760px) {
  .table-card__header {
    flex-direction: column;
    align-items: stretch;
  }

  /* Team picker fills the row; refresh sits beside it rather than below. */
  .header-actions {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .athletes-card > .filters-row {
    padding: 0 0.8rem;
  }

  .athlete-table tbody {
    padding: 0.1rem 0.8rem 0.4rem;
  }
}

@media (max-width: 560px) {
  .filters-row {
    grid-template-columns: 1fr;
  }

  .athlete-table tbody {
    grid-template-columns: 1fr;
    padding: 0.1rem 0.6rem 0.4rem;
  }

  .athletes-card > .filters-row {
    padding: 0 0.6rem;
  }

  .search-field,
  .status-filter select {
    min-height: 44px;
  }
}

/* Yellow counterpart of .stat-card--green / --red: tinted circle behind the icon. */
.stat-card--yellow .stat-card__icon {
  color: var(--yellow);
  background: rgba(244, 183, 64, 0.14);
}

.team-card__badge--alert {
  background: var(--red-soft);
  color: var(--red);
}
