/* Buttons, inputs, tables, cards, chips, slots, modals, toasts. */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: var(--s2) var(--s4);
  min-height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-3); border-color: var(--text-faint); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn.small { min-height: 26px; padding: 2px var(--s2); font-size: 12.5px; }

.icon-btn {
  background: none;
  border: 0;
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: var(--s1) var(--s2);
  border-radius: var(--radius);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

/* ---------- Inputs ---------- */
.input, input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="search"], input[type="datetime-local"],
select, textarea {
  width: 100%;
  padding: var(--s2) var(--s3);
  min-height: 34px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
}
.input:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-dim);
}
textarea { min-height: 80px; resize: vertical; }
input:disabled, select:disabled, textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--surface-2);
}

.field { display: flex; flex-direction: column; gap: var(--s1); }
.field-label { font-weight: 500; font-size: 12.5px; color: var(--text-dim); }
.field-hint { font-size: 12px; color: var(--text-faint); }
.field.invalid .input { border-color: var(--danger); }
.field-error { font-size: 12px; color: var(--danger); }

.checkbox { display: flex; align-items: center; gap: var(--s2); cursor: pointer; }
.checkbox input { width: auto; min-height: 0; }

.filter-bar {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
  align-items: flex-end;
  padding: var(--s3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--s4);
}
.filter-bar .field { min-width: 150px; }
.filter-bar .field.grow { flex: 1; min-width: 220px; }

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s4);
}
.card-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin: calc(var(--s4) * -1) calc(var(--s4) * -1) var(--s4);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--border);
}
.card-head h2, .card-head h3 { margin: 0; }

.stat { display: flex; flex-direction: column; gap: var(--s1); }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12.5px; color: var(--text-dim); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th, .table td {
  padding: var(--s2) var(--s3);
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  font-weight: 600;
  white-space: nowrap;
  z-index: 1;
}
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }

/* ---------- Chips / badges ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 1px var(--s2);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-dim);
  white-space: nowrap;
}
.chip.ok     { background: rgba(63, 185, 80, 0.15);  color: var(--ok); }
.chip.warn   { background: rgba(210, 153, 34, 0.15); color: var(--warn); }
.chip.danger { background: rgba(240, 94, 94, 0.15);  color: var(--danger); }
.chip.info   { background: rgba(88, 166, 255, 0.15); color: var(--info); }

.chip.tank    { background: rgba(217, 139, 74, 0.15); color: var(--role-tank); }
.chip.healer  { background: rgba(78, 201, 139, 0.15); color: var(--role-healer); }
.chip.dps     { background: rgba(224, 92, 110, 0.15); color: var(--role-dps); }
.chip.support { background: rgba(155, 124, 224, 0.15); color: var(--role-support); }
.chip.utility { background: rgba(122, 132, 148, 0.18); color: var(--role-utility); }

/* ---------- Comp / slot grid ---------- */
.party-grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.party {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.party.full { border-color: var(--border-strong); opacity: 0.85; }

.party-head {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.party-fill { margin-left: auto; font-size: 12.5px; color: var(--text-dim); font-weight: 500; }

.party-bar { height: 3px; background: var(--surface-3); }
.party-bar > span { display: block; height: 100%; background: var(--accent); transition: width 0.2s; }
.party.full .party-bar > span { background: var(--ok); }

.slots { list-style: none; margin: 0; padding: var(--s2); display: flex; flex-direction: column; gap: 2px; }

.slot {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2);
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  width: 100%;
}
.slot:hover:not(.disabled):not(.taken) { background: var(--surface-2); border-color: var(--border-strong); }
.slot.selected { background: var(--accent-dim); border-color: var(--accent); }
.slot.taken { background: var(--surface-2); cursor: default; }

/* A full or ineligible slot stays visible but is clearly inert - hiding it
   would leave a member wondering whether the comp changed. */
.slot.disabled { opacity: 0.45; cursor: not-allowed; }

.slot-label { font-weight: 500; }
.slot-role { color: var(--text-dim); font-size: 12.5px; }
.slot-player { margin-left: auto; font-size: 12.5px; color: var(--text); }
.slot-reason { margin-left: auto; font-size: 11.5px; color: var(--text-faint); font-style: italic; }
.slot-lock { color: var(--warn); font-size: 12px; }

/* ---------- Modal ---------- */
.modal-host { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.modal-host.open { pointer-events: auto; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: var(--s4);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: min(560px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.modal-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; flex: 1; font-size: 16px; }
.modal-body { padding: var(--s4); overflow-y: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--s2);
  padding: var(--s3) var(--s4);
  border-top: 1px solid var(--border);
}

/* ---------- Toast ---------- */
.toast-host {
  position: fixed;
  bottom: var(--s4);
  right: var(--s4);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  max-width: min(420px, calc(100vw - var(--s6)));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--s2);
  padding: var(--s3);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-left-width: 3px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: toast-in 0.16s ease-out;
}
.toast-msg { flex: 1; }
.toast-close { background: none; border: 0; color: var(--text-dim); cursor: pointer; font-size: 16px; line-height: 1; }
.toast-ok     { border-left-color: var(--ok); }
.toast-warn   { border-left-color: var(--warn); }
.toast-danger { border-left-color: var(--danger); }
.toast-info   { border-left-color: var(--info); }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Login privacy note ---------- */
/* Collapsed by default: someone signing in wants the button, not an essay.
   Open it and the detail is there, which is the point of the disclosure. */
.privacy-note {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: var(--s2) var(--s3);
  font-size: 12.5px;
  color: var(--text-dim);
}
.privacy-note > summary {
  cursor: pointer;
  color: var(--text-dim);
  font-weight: 500;
  list-style: none;
}
.privacy-note > summary::-webkit-details-marker { display: none; }
.privacy-note > summary::before {
  content: "▸ ";
  color: var(--text-faint);
}
.privacy-note[open] > summary::before { content: "▾ "; }
.privacy-note > summary:hover { color: var(--text); }
.privacy-note p { margin: var(--s2) 0 0; }
.privacy-head { font-weight: 600; color: var(--text); }
.privacy-note ul { margin: var(--s1) 0 0; padding-left: var(--s4); }
.privacy-note li { margin: 2px 0; }

/* ---------- Assignment popup ---------- */
.assignment-callout {
  padding: var(--s4);
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  text-align: center;
}
.assignment-party { font-size: 26px; font-weight: 700; }
.assignment-role { color: var(--text-dim); margin-top: var(--s1); }

/* ---------- Misc ---------- */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading { padding: var(--s6); text-align: center; color: var(--text-dim); }

.pager { display: flex; align-items: center; gap: var(--s3); justify-content: flex-end; margin-top: var(--s3); }
