/**
 * @file
 * Shared SM components: panels, tables, chips, entity fields, the day-sheet
 * itinerary and empty states.
 */

/* Page head: title plus the actions for this page. */
.sm-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sm-space-4);
  margin-bottom: var(--sm-space-6);
}

.sm-page-head .sm-button-bar {
  margin: 0;
}

.sm-page-head__meta {
  margin: 0;
  color: var(--sm-mist);
  font-size: var(--sm-text-lg);
}

.sm-section {
  margin: 0 0 var(--sm-space-7);
}

.sm-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sm-space-3);
  margin-bottom: var(--sm-space-4);
  padding-bottom: var(--sm-space-3);
  border-bottom: 1px solid var(--sm-line);
}

.sm-section__head h2 {
  margin: 0;
  font-size: var(--sm-text-xl);
}

.sm-section__head .sm-button-bar {
  margin: 0;
}

/* Panels. */
.sm-panel {
  padding: var(--sm-space-5);
  border: 1px solid var(--sm-line);
  border-radius: var(--sm-radius-card);
  background: var(--sm-navy);
}

.sm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: var(--sm-space-4);
}

.sm-tour-card {
  display: flex;
  flex-direction: column;
  gap: var(--sm-space-2);
  padding: var(--sm-space-5);
  border: 1px solid var(--sm-line);
  border-radius: var(--sm-radius-card);
  background: var(--sm-navy);
  color: var(--sm-ink) !important;
  text-decoration: none;
  transition: border-color 120ms ease, transform 120ms ease;
}

.sm-tour-card:hover {
  border-color: var(--sm-amber);
  transform: translateY(-2px);
}

.sm-tour-card__name {
  font-family: var(--sm-font-display);
  font-size: var(--sm-text-xl);
  font-weight: 800;
  line-height: 1.05;
}

.sm-tour-card__artist {
  color: var(--sm-cyan);
  font-weight: 600;
}

.sm-tour-card__dates,
.sm-tour-card__next {
  color: var(--sm-mist);
  font-size: var(--sm-text-sm);
}

.sm-tour-card__stats {
  display: flex;
  gap: var(--sm-space-4);
  margin-top: auto;
  padding-top: var(--sm-space-3);
  border-top: 1px solid var(--sm-line);
  font-size: var(--sm-text-sm);
}

.sm-tour-card__stats strong {
  font-family: var(--sm-font-display);
  font-size: var(--sm-text-lg);
}

/* Chips and status. */
.sm-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.6rem;
  border-radius: var(--sm-radius-pill);
  background: var(--sm-chip-bg, var(--sm-navy-3));
  color: var(--sm-chip-fg, var(--sm-ink));
  font-size: var(--sm-text-xs);
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.sm-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--sm-mist);
  font-size: var(--sm-text-xs);
  font-weight: 600;
}

.sm-status::before {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.sm-status--confirmed,
.sm-status--on_road {
  color: var(--sm-green);
}

.sm-status--tentative,
.sm-status--planning {
  color: var(--sm-amber);
}

.sm-status--cancelled {
  color: var(--sm-red);
}

.sm-status--wrapped {
  color: var(--sm-mist);
}

/* Tables (list builders and member lists). FullCalendar keeps its own. */
.sm-shell table:not(.fc *) {
  width: 100%;
  margin: 0 0 var(--sm-space-5);
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--sm-line);
  border-radius: var(--sm-radius-card);
  overflow: hidden;
  background: var(--sm-navy);
  font-size: var(--sm-text-sm);
}

.sm-shell th:not(.fc *) {
  padding: var(--sm-space-3) var(--sm-space-4);
  border-bottom: 1px solid var(--sm-line);
  background: var(--sm-navy-2);
  color: var(--sm-mist);
  font-weight: 600;
  text-align: left;
}

.sm-shell th:not(.fc *) a {
  color: var(--sm-mist);
}

.sm-shell td:not(.fc *) {
  padding: var(--sm-space-3) var(--sm-space-4);
  border-bottom: 1px solid rgba(42, 71, 127, 0.55);
  vertical-align: middle;
}

.sm-shell tbody tr:last-child td:not(.fc *) {
  border-bottom: 0;
}

.sm-shell tbody tr:hover td:not(.fc *) {
  background: rgba(31, 61, 117, 0.35);
}

.sm-shell td:not(.fc *) a {
  font-weight: 600;
}

.sm-shell td .dropbutton-wrapper,
.sm-shell td ul.dropbutton,
.sm-shell td .links.inline {
  margin: 0;
}

.sm-shell .sm-row-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--sm-space-2);
  justify-content: flex-end;
}

@media (max-width: 700px) {
  .sm-shell .sm-table-wrap {
    overflow-x: auto;
  }
}

/* Pager. */
.sm-shell .pager__items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sm-space-2);
  justify-content: center;
  padding: 0;
  list-style: none;
}

.sm-shell .pager__item a {
  display: inline-block;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--sm-line);
  border-radius: var(--sm-radius-pill);
  text-decoration: none;
}

.sm-shell .pager__item.is-active a {
  background: var(--sm-ink);
  color: var(--sm-ink-on-light);
}

/* Entity fields on canonical pages: a tiled panel with hairline gaps. */
.sm-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  margin: 0 0 var(--sm-space-6);
  border: 1px solid var(--sm-line);
  border-radius: var(--sm-radius-card);
  background: var(--sm-line);
  overflow: hidden;
}

.sm-fields:empty {
  display: none;
}

.sm-shell .sm-fields > .field,
.sm-shell .sm-fields > div {
  flex: 1 1 14rem;
  margin: 0;
  padding: var(--sm-space-4) var(--sm-space-5);
  background: var(--sm-navy);
}

.sm-fields .field__label {
  display: block;
  margin-bottom: var(--sm-space-1);
  color: var(--sm-mist);
  font-size: var(--sm-text-xs);
  font-weight: 600;
}

.sm-fields .field__label::after {
  content: none;
}

.sm-fields .field__item {
  color: var(--sm-ink);
  font-weight: 500;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.sm-fields > .sm-field--wide {
  flex-basis: 100%;
}

/* Empty state. */
.sm-empty {
  padding: var(--sm-space-6) var(--sm-space-5);
  border: 1px dashed var(--sm-line);
  border-radius: var(--sm-radius-card);
  text-align: left;
}

.sm-empty__title {
  margin-bottom: var(--sm-space-2);
  font-family: var(--sm-font-display);
  font-size: var(--sm-text-xl);
  font-weight: 700;
}

.sm-empty__text {
  color: var(--sm-mist);
}

.sm-empty .sm-button-bar {
  margin-bottom: 0;
}

/* Type picker (add event / add vendor). */
.sm-type-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: var(--sm-space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.sm-type-picker a {
  display: flex;
  flex-direction: column;
  gap: var(--sm-space-1);
  height: 100%;
  padding: var(--sm-space-4) var(--sm-space-5);
  border: 1px solid var(--sm-line);
  border-left: 6px solid var(--sm-type-color, var(--sm-amber));
  border-radius: var(--sm-radius-card);
  background: var(--sm-navy);
  color: var(--sm-ink);
  text-decoration: none;
}

.sm-type-picker a:hover {
  border-color: var(--sm-type-color, var(--sm-amber));
  background: var(--sm-navy-2);
}

.sm-type-picker strong {
  font-family: var(--sm-font-display);
  font-size: var(--sm-text-lg);
}

.sm-type-picker span {
  color: var(--sm-mist);
  font-size: var(--sm-text-sm);
}

/*
 * Day sheet: the itinerary. Each day is a row with a big date on the left
 * and that day's run of events on the right, like a tour manager's printed
 * day sheet.
 */
.sm-itinerary {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sm-day {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: var(--sm-space-5);
  padding: var(--sm-space-5) 0;
  border-top: 1px solid var(--sm-line);
}

.sm-day:first-child {
  border-top: 0;
  padding-top: 0;
}

.sm-day__date {
  position: sticky;
  top: 5rem;
  align-self: start;
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.sm-day__dow {
  color: var(--sm-amber);
  font-weight: 600;
  font-size: var(--sm-text-sm);
}

.sm-day__num {
  font-family: var(--sm-font-display);
  font-size: 3.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.sm-day__month {
  color: var(--sm-mist);
  font-size: var(--sm-text-sm);
}

.sm-day__add {
  margin-top: var(--sm-space-3);
  font-size: var(--sm-text-xs);
}

.sm-day__events {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  gap: var(--sm-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.sm-slot {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto;
  gap: var(--sm-space-4);
  align-items: center;
  padding: var(--sm-space-3) var(--sm-space-4);
  border-radius: var(--sm-radius-field);
  background: var(--sm-navy);
  box-shadow: inset 5px 0 0 var(--sm-slot-color, var(--sm-amber));
}

.sm-slot--cancelled {
  opacity: 0.6;
}

.sm-slot--cancelled .sm-slot__title {
  text-decoration: line-through;
}

.sm-slot__time {
  padding-left: var(--sm-space-2);
  font-family: var(--sm-font-display);
  font-size: var(--sm-text-lg);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sm-slot__time small {
  display: block;
  color: var(--sm-mist);
  font-family: var(--sm-font-body);
  font-size: var(--sm-text-xs);
  font-weight: 500;
}

.sm-slot__body {
  min-width: 0;
}

.sm-slot__title {
  color: var(--sm-ink) !important;
  font-weight: 600;
  text-decoration: none;
}

.sm-slot__title:hover {
  text-decoration: underline;
}

.sm-slot__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sm-space-2) var(--sm-space-3);
  align-items: center;
  margin-top: var(--sm-space-1);
  color: var(--sm-mist);
  font-size: var(--sm-text-sm);
}

.sm-slot__tour {
  color: var(--sm-cyan);
}

.sm-slot__actions a {
  font-size: var(--sm-text-xs);
}

/* In narrow columns (the dashboard), the time sits above the title. */
@container (max-width: 460px) {
  .sm-slot {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--sm-space-1) var(--sm-space-3);
  }

  .sm-slot__time {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    gap: var(--sm-space-2);
  }

  .sm-slot__time small {
    display: inline;
  }
}

@media (max-width: 700px) {
  .sm-day {
    grid-template-columns: 1fr;
    gap: var(--sm-space-3);
  }

  .sm-day__date {
    position: static;
    flex-direction: row;
    align-items: baseline;
    gap: var(--sm-space-2);
  }

  .sm-day__num {
    font-size: var(--sm-text-2xl);
  }

  .sm-day__add {
    margin: 0 0 0 auto;
  }

}

/* Dashboard layout. */
.sm-dash {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: var(--sm-space-7);
}

@media (max-width: 1000px) {
  .sm-dash {
    grid-template-columns: 1fr;
  }
}

.sm-quick {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sm-space-2);
  margin: 0 0 var(--sm-space-7);
}

.sm-stack {
  display: flex;
  flex-direction: column;
  gap: var(--sm-space-3);
}

/* Member list on the band page. */
.sm-people {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: var(--sm-space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.sm-person {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sm-space-4);
  border: 1px solid var(--sm-line);
  border-radius: var(--sm-radius-card);
  background: var(--sm-navy);
}

.sm-person--inactive {
  opacity: 0.6;
}

.sm-person__name {
  font-weight: 600;
}

.sm-person__role {
  color: var(--sm-mist);
  font-size: var(--sm-text-sm);
}

.sm-person__actions {
  margin-top: var(--sm-space-2);
  font-size: var(--sm-text-xs);
}

/* Colour legend used by the calendar and itinerary pages. */
.sm-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sm-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Inline facts under a heading: artist, dates, counts. */
.sm-shell .sm-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sm-space-2);
  margin: 0 0 var(--sm-space-5);
  padding: 0;
  list-style: none;
}

.sm-shell .sm-meta li {
  margin: 0;
  padding: 0.2rem 0.75rem;
  border: 1px solid var(--sm-line);
  border-radius: var(--sm-radius-pill);
  color: var(--sm-mist);
  font-size: var(--sm-text-sm);
}

/* User profile extras from core ("Member for"). */
.sm-shell .sm-profile h4.label,
.sm-shell .sm-profile .label {
  margin: 0 0 var(--sm-space-1);
  color: var(--sm-mist);
  font-size: var(--sm-text-xs);
  font-weight: 600;
}

.sm-shell .item-list h3 {
  font-size: var(--sm-text-xl);
}

.sm-shell .item-list {
  margin-bottom: var(--sm-space-6);
}

.sm-shell .item-list ul {
  padding-left: 1.1rem;
}

/* Vendor menu. */
.sm-menu {
  display: flex;
  flex-direction: column;
  gap: var(--sm-space-4);
}

.sm-menu .sm-button-bar {
  margin: 0;
}

.sm-menu__text {
  max-width: 68ch;
  padding: var(--sm-space-4) var(--sm-space-5);
  border: 1px solid var(--sm-line);
  border-radius: var(--sm-radius-card);
  background: var(--sm-navy);
  white-space: pre-line;
  line-height: 1.6;
}

.sm-menu__images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: var(--sm-space-3);
}

.sm-menu__image {
  display: block;
  overflow: hidden;
  border: 1px solid var(--sm-line);
  border-radius: var(--sm-radius-card);
  background: var(--sm-navy);
}

.sm-menu__image img {
  display: block;
  width: 100%;
  height: 18rem;
  object-fit: cover;
  object-position: top;
}

.sm-menu__image:hover {
  border-color: var(--sm-amber);
}
