/* lib/components.css — shared styles for lib/ + components/ widgets. */

/* ── Modal backdrop (lib/modal.js) ── */
.lib-modal {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(10, 10, 20, 0.88);
  display: none; align-items: center; justify-content: center;
}
.lib-modal.open { display: flex; }

/* ── Session-start card (components/session-modal.js) ── */
/* (.tc-group / .tc-btn / .tc-custom live in shared-header.css, loaded alongside) */
.session-card {
  background: #16213e; border: 1px solid #0f3460;
  border-radius: 12px; padding: 28px 24px; width: 320px;
}
.session-card h2 { color: #c8a400; margin-bottom: 18px; font-size: 1rem; }
.session-card label {
  font-size: 0.78rem; color: #888; display: block;
  margin-bottom: 3px; margin-top: 12px;
}
.session-card input {
  width: 100%; padding: 7px 9px; font-size: 0.9rem;
  background: #0a1628; border: 1px solid #0f3460;
  border-radius: 5px; color: #e0e0e0;
}
/* Min-price hint under the price input; .warn = the price was auto-corrected. */
.price-note { font-size: 0.72rem; color: #6f6f8f; margin-top: 4px; min-height: 14px; }
.price-note.warn { color: #e8c84a; }

.session-error { color: #e94560; font-size: 0.8rem; margin-top: 10px; min-height: 16px; }
.session-actions { display: flex; gap: 8px; margin-top: 16px; }
.session-actions button {
  flex: 1; padding: 9px; border: none; border-radius: 5px;
  cursor: pointer; font-weight: 600;
}
.btn-cancel   { background: #0f3460; color: #e0e0e0; }
.btn-start-ok { background: #4caf50; color: #0a1a0a; }
.btn-start-ok:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── GM profile card (components/profile-modal.js) ── */
.profile-card {
  background: #16213e; border: 1px solid #0f3460;
  border-radius: 12px; padding: 24px; width: min(420px, 92vw);
  max-height: 88vh; overflow-y: auto; color: #e0e0e0;
}
.profile-card h2 { color: #c8a400; margin-bottom: 16px; font-size: 1rem; }
.profile-card label { font-size: 0.78rem; color: #888; display: block; margin: 14px 0 4px; }
.profile-card textarea {
  width: 100%; box-sizing: border-box; padding: 8px 10px; font-size: 0.9rem;
  background: #0a1628; border: 1px solid #0f3460; border-radius: 6px;
  color: #e0e0e0; resize: vertical; font-family: inherit;
}
.profile-card textarea:focus { outline: none; border-color: #c8a400; }
.profile-loading, .profile-err { padding: 16px 0; color: #8888aa; }
.profile-err { color: #e94560; font-size: 0.85rem; min-height: 18px; }

.profile-head { display: flex; gap: 16px; align-items: center; }
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700; color: #fff;
}
/* Edit-mode avatar row (preview + change/remove). */
.profile-edit-avatar { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.profile-edit-avatar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.profile-edit-avatar-hint { flex-basis: 100%; font-size: 0.78rem; color: #8888aa; }

.profile-name { font-size: 1.2rem; font-weight: 600; color: #fff; display: flex; align-items: center; gap: 8px; }
.profile-title {
  background: #c8a400; color: #1a1a2e; font-size: 0.7rem; font-weight: 700;
  padding: 2px 7px; border-radius: 4px; letter-spacing: 0.04em;
}
.profile-fide { margin-top: 4px; font-size: 0.95rem; color: #e0e0e0; display: flex; align-items: center; gap: 12px; }
.profile-country { color: #aaaacc; font-size: 0.85rem; display: inline-flex; align-items: center; gap: 6px; }
.profile-flag { width: 20px; height: 15px; border-radius: 2px; vertical-align: middle; }
.profile-since { font-size: 0.8rem; color: #8888aa; margin-top: 4px; }
.profile-price { margin-top: 14px; font-size: 0.9rem; color: #c8a400; font-weight: 600; }
.profile-bio { margin-top: 14px; font-size: 0.9rem; line-height: 1.5; color: #cfcfe6; white-space: pre-wrap; }
.profile-bio.empty { color: #555577; font-style: italic; }

.profile-stats { margin-top: 16px; }
.profile-stat-header { font-size: 0.82rem; color: #aaaacc; margin-bottom: 5px; }
.profile-stat-bar { display: flex; height: 7px; border-radius: 4px; overflow: hidden; background: #1e1e32; }
.profile-stat-seg { flex-basis: 0; flex-shrink: 0; height: 100%; }
.profile-stat-seg.w { background: #4caf50; } .profile-stat-seg.d { background: #f0c040; } .profile-stat-seg.l { background: #e94560; }
.profile-stat-counts { display: flex; justify-content: space-between; font-size: 0.82rem; margin-top: 4px; font-weight: 500; }
.profile-stat-counts .w { color: #4caf50; } .profile-stat-counts .d { color: #f0c040; } .profile-stat-counts .l { color: #e94560; }
.profile-stat-none { color: #555577; font-style: italic; font-size: 0.82rem; }

.profile-actions { display: flex; gap: 8px; margin-top: 20px; }
.profile-actions button { flex: 1; padding: 9px; border: none; border-radius: 5px; cursor: pointer; font-weight: 600; }

/* Join CTA on the profile modal — full-width, prominent (gold), tracks live state */
.profile-join { margin-top: 16px; }
.profile-join:empty { display: none; }
.profile-join-btn {
  display: block; width: 100%; padding: 11px; border: none; border-radius: 5px;
  font-weight: 700; font-size: 0.95rem; text-align: center; cursor: pointer;
}
.profile-join-btn.go     { background: #c8a400; color: #1a1a1a; }
.profile-join-btn.resume { background: #1a6060; color: #e0fafa; }
.profile-join-btn.muted  { background: #0f3460; color: #8a8aa0; cursor: not-allowed; }
/* A disabled state that comes with an explanation (`help: true`) — the `?` is a
   sibling of the muted label, which is not itself clickable. */
.profile-join-row { display: flex; gap: 8px; align-items: stretch; }
.profile-join-row .profile-join-btn { flex: 1; }
.profile-join-help {
  flex: 0 0 40px; min-height: 40px; border-radius: 5px; border: 1px solid #2a3a5a;
  background: transparent; color: #88aadd; font-size: 0.95rem; font-weight: 700;
  cursor: pointer; transition: background 0.2s, color 0.2s;
}
.profile-join-help:hover { background: #16213e; color: #aaccff; }

.profile-fide-note { font-size: 0.78rem; color: #8888aa; margin-top: 8px; font-style: italic; }

/* Subscribe (notify-me) modal */
.sub-card h2 { text-align: center; line-height: 1.3; }
.sub-card .sub-gm { color: #c8a400; }
.sub-sub { color: #8888aa; font-size: 0.85rem; text-align: center; margin: 4px 0 18px; }
.sub-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sub-row .sub-toggle { flex: 1; margin-bottom: 0; }
.sub-info {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  background: #0f1d38; border: 1px solid #2a3a5c; color: #8fa0c4;
  font-weight: 700; font-size: 0.9rem; line-height: 1;
}
.sub-info:hover { border-color: #c8a400; color: #c8a400; }
.sub-explain {
  font-size: 0.78rem; color: #9aa; line-height: 1.45;
  margin: -4px 2px 12px; padding: 8px 10px;
  background: #0d1830; border-left: 2px solid #2a3a5c; border-radius: 4px;
}
.sub-note { font-size: 0.74rem; color: #7a7f99; line-height: 1.4; margin: 8px 2px 0; }
.sub-toggle {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  box-sizing: border-box; padding: 12px 14px; margin-bottom: 10px; cursor: pointer;
  background: #0a1628; border: 1px solid #0f3460; border-radius: 8px; color: #e0e0e0;
  font-size: 0.95rem; font-weight: 600;
}
.sub-toggle:disabled { opacity: 0.5; cursor: not-allowed; }
.sub-toggle .sub-switch {
  position: relative; width: 42px; height: 24px; border-radius: 12px;
  background: #1a2a4a; transition: background 0.15s; flex-shrink: 0;
}
.sub-toggle .sub-switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #6a7aa0; transition: transform 0.15s, background 0.15s;
}
.sub-toggle.on { border-color: #c8a400; }
.sub-toggle.on .sub-switch { background: #4caf50; }
.sub-toggle.on .sub-switch::after { transform: translateX(18px); background: #0a1a0a; }
.sub-hint { font-size: 0.78rem; color: #8888aa; margin: 6px 2px 0; line-height: 1.4; }

/* FIDE typeahead (shared by lobby suggest box + profile edit) */
.fide-typeahead { position: relative; }
.fide-typeahead input {
  width: 100%; box-sizing: border-box; padding: 9px 11px; font-size: 0.9rem;
  background: #0a1628; border: 1px solid #0f3460; border-radius: 6px; color: #e0e0e0;
}
.fide-typeahead input:focus { outline: none; border-color: #c8a400; }
.fide-results {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0;
  background: #0a1628; border: 1px solid #0f3460; border-radius: 6px;
  max-height: 240px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.fide-option {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 11px; cursor: pointer; font-size: 0.88rem; color: #e0e0e0;
  border-bottom: 1px solid #11203c;
}
.fide-option:last-child { border-bottom: none; }
.fide-option:hover { background: #0f3460; }
.fide-option .meta { color: #8888aa; font-size: 0.8rem; white-space: nowrap; }
.fide-option.empty { color: #555577; cursor: default; font-style: italic; }
.fide-option.empty:hover { background: none; }
/* Already a verified GM on the platform — shown for context but not selectable. */
.fide-option.taken { color: #6a6a82; cursor: not-allowed; }
.fide-option.taken:hover { background: none; }
.fide-option.taken .meta { color: #6a6a82; font-style: italic; }
.fide-option.taken .pa-title-badge { color: #6a6a82; }  /* dim the gold badge to match */

/* ── Account modal (components/account-modal.js) ──
   Reuses .profile-card / .profile-err / .profile-actions; only the residence row and
   the register-and-wait block are its own. The same country-select rules serve the
   signup form in lobby.html, which <link>s this file too. */
/* The identity block: who you are, stated — never a control. Everything below it is
   boxed because it is editable, so nothing in here may carry an input's border or fill:
   a "disabled-looking field" still reads as a field, which is how the address was first
   built and read. It is a second line of the same sentence, styled by inheritance —
   `<strong>` on the address exactly as on the name — so the two can never drift. */
.account-who { font-size: 0.85rem; color: #8888aa; }
.account-email { margin-top: 3px; overflow-wrap: anywhere; }
/* Why the modal opened, when something opened it for the user (the residence gate's 428
   at Join). Absent for the ordinary menu route. */
.account-reason {
  font-size: 0.85rem; line-height: 1.5; color: #e0e0e0;
  background: #0a1628; border: 1px solid #0f3460; border-left: 3px solid #c8a400;
  border-radius: 6px; padding: 9px 11px; margin: 4px 0 2px;
}
/* The account modal's own text inputs. Nothing styled them until now, so the postal
   field inherited gm.html's global `input` rule on the dashboard and the browser
   default on every other page — the same modal looked like two different modals.
   Matches .account-country-row select below, so all three rows agree. */
.profile-card input[type="text"] {
  width: 100%; box-sizing: border-box; padding: 8px 10px; font-size: 0.9rem;
  background: #0a1628; border: 1px solid #0f3460; border-radius: 6px;
  color: #e0e0e0; font-family: inherit;
}
.profile-card input[type="text"]:focus { outline: none; border-color: #c8a400; }

.account-country-row { display: flex; align-items: center; gap: 8px; }
.account-country-row select { flex: 1; min-width: 0; }
.pa-country-select, .account-country-row select {
  width: 100%; box-sizing: border-box; padding: 8px 10px; font-size: 0.9rem;
  background: #0a1628; border: 1px solid #0f3460; border-radius: 6px;
  color: #e0e0e0; font-family: inherit;
}
.pa-country-select:focus, .account-country-row select:focus {
  outline: none; border-color: #c8a400;
}
/* Some browsers paint <optgroup>/<option> from the system palette; force ours so the
   "Available now" / "Not yet available" split stays readable on the dark card. */
.pa-country-select optgroup, .account-country-row select optgroup { color: #8888aa; background: #0a1628; }
.pa-country-select option,   .account-country-row select option   { color: #e0e0e0; background: #0a1628; }

.account-hint, .pa-country-hint { font-size: 0.78rem; color: #8888aa; margin-top: 5px; line-height: 1.45; }

/* Shown only for a country PlayAGM cannot serve yet. Informational, never a refusal —
   registering, spectating and subscribing all still work (§ 5, "blocked ≠ excluded"). */
.account-wait, .pa-wait {
  margin-top: 14px; padding: 11px 12px; border-radius: 6px;
  background: #101c33; border: 1px solid #24406e;
}
.account-wait-msg, .pa-wait-msg { font-size: 0.82rem; color: #cfcfe6; line-height: 1.5; }
.account-check, .pa-wait-check {
  display: flex; align-items: center; gap: 8px; margin: 10px 0 0;
  font-size: 0.85rem; color: #e0e0e0; cursor: pointer;
}
.account-check input, .pa-wait-check input { width: auto; margin: 0; cursor: pointer; }
