/* PlayByPlay web UI, shared styles: loaded on every page (web/base.html).
   The navbar lives in nav.css; a group's page-specific rules in <group>_styles.css.
   Functional first: the visual design comes later. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #667085;
  --border: #d9dee5;
  --brand: #12304a;
  --brand-text: #ffffff;
  --accent: #f2b33d;
  --danger: #b42318;
  --success-bg: #e8f5ee;
  --error-bg: #fdecea;
  --todo-bg: #fff6e0;
  --page-width: 72rem;
  /* max width of a regular page (.page); wide pages skip it */
}

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, sans-serif;
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

a {
  color: var(--brand);
}

.muted {
  color: var(--muted);
}

/* ---------------------------------------------------------------- layout */

.layout {
  display: flex;
  min-height: 100vh;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 2rem;
  padding-top: 5rem;
}

/* all the room next to the navbar */
.page {
  max-width: var(--page-width);
}

/* layouts wrap their content in it; wide pages don't */

/* ---------------------------------------------------------------- avatars */

.avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 700;
}

.user-chip {
  gap: 0.4rem;
  vertical-align: middle;
}

/* ---------------------------------------------------------------- page parts */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.page-header h1,
.page-header h2 {
  margin: 0;
}

.page-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1rem;
  margin: 0 0 1.5rem;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #eef1f5;
  border-radius: 1rem;
  padding: 0.1rem 0.55rem;
  font-size: 0.8rem;
}

.badge svg {
  width: 1em;
  height: 1em;
}

/* Match Draft / Ready (match detail and every match table) */
.badge-ready {
  background: var(--success-bg);
}

.badge-draft {
  background: var(--todo-bg);
}

.score {
  font-size: 1.4rem;
  font-weight: 600;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.5rem;
}

.card-narrow {
  max-width: 28rem;
  margin: 2rem auto;
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.message {
  padding: 0.6rem 0.9rem;
  border-radius: 0.4rem;
  margin-bottom: 0.5rem;
  background: var(--success-bg);
}

.message-error {
  background: var(--error-bg);
}

.message-warning {
  background: var(--todo-bg);
}

.message-info {
  background: #eef1f5;
}

/* Shown while staff are logged in as another user (web/includes/impersonation_banner.html). */
.impersonation {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  background: var(--todo-bg);
  border: 1px solid var(--accent);
  border-radius: 0.5rem;
  padding: 0.6rem 0.9rem;
  margin-bottom: 1rem;
}

.impersonation form {
  margin-left: auto;
}

.todo {
  display: flex;
  gap: 0.75rem;
  background: var(--todo-bg);
  border: 1px dashed var(--accent);
  border-radius: 0.5rem;
  padding: 0.9rem 1rem;
  margin: 1rem 0;
}

.todo p {
  margin: 0.25rem 0 0;
}

/* ---------------------------------------------------------------- tables */

/* django-tables2's wrapper: a wide table scrolls inside it, never the page (phones) */
.table-container {
  overflow-x: auto;
}

.table {
  border-collapse: collapse;
  width: 100%;
  background: var(--surface);
}

.table th,
.table td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.6rem;
  text-align: left;
}

.table thead th {
  background: #eef1f5;
}

.table th a {
  color: inherit;
}

.pagination {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
}

/* ---------------------------------------------------------------- forms and buttons */

.form,
.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.form > div,
.filters > div {
  margin-bottom: 0.8rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
  align-items: end;
}

.form label,
.filters label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.form input:not([type='checkbox']),
.form select,
.filters input,
.filters select {
  font: inherit;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  min-width: 14rem;
}

.helptext {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.errorlist {
  color: var(--danger);
  margin: 0.2rem 0;
  padding-left: 1rem;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.button {
  display: inline-block;
  font: inherit;
  padding: 0.45rem 0.9rem;
  border-radius: 0.35rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.button-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-text);
}

.button-danger {
  color: var(--danger);
  border-color: var(--danger);
}

.button-quiet {
  border-color: transparent;
}

/* An icon-only link or button (e.g. a table row's edit / remove); needs title and aria-label */
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem;
  border-radius: 0.35rem;
  color: var(--brand);
}

.icon-button:hover {
  background: #eef1f5;
}

.icon-button svg {
  width: 1.1rem;
  height: 1.1rem;
}

.icon-button-danger {
  color: var(--danger);
}

.icon-button[aria-disabled='true'] {
  color: var(--muted);
  opacity: 0.5;
  cursor: not-allowed;
}

/* Language switcher (web/includes/language_switcher.html): "Change language" + the current flag;
   the list of languages opens above it. */
.language-menu {
  position: relative;
  font-size: 0.92rem;
}

.language-menu summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  list-style: none;
}

.language-menu summary::-webkit-details-marker {
  display: none;
}

.language-menu .flag {
  width: 1.4rem;
  height: 1.05rem;
  flex-shrink: 0;
  border-radius: 0.15rem;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.language-menu-list {
  position: absolute;
  bottom: calc(100% + 0.35rem);
  left: 0;
  z-index: 10;
  min-width: 12rem;
  max-height: 60vh;
  overflow-y: auto;
  padding: 0.3rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.2);
}

.language-menu-list button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.4rem 0.5rem;
  background: none;
  border: 0;
  border-radius: 0.35rem;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.language-menu-list button:hover {
  background: var(--bg);
}

.language-menu-list button[aria-current='true'] {
  font-weight: 700;
}

.language-menu-centered {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
  color: var(--muted);
}

.language-menu-centered .language-menu-list {
  left: 50%;
  transform: translateX(-50%);
}

.icon-button[aria-disabled='true']:hover {
  background: none;
}

/* ---------------------------------------------------------------- phones */

@media (max-width: 40rem) {
  .content {
    padding: 1rem;
  }

  .form input:not([type='checkbox']),
  .form select {
    min-width: 0;
    width: 100%;
  }
}

/* A destructive action under a form (Settings > Delete account, Edit club > Delete club). */
.danger-zone {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
