/* Mirrors the Variables/Styles defined in the SettleThePot Figma file (Foundations page).
   Values below were pulled directly from Figma's resolved variables (not eyeballed from
   screenshots) and cross-checked against every Button/Alert state on 2026-10-05 — see
   CLAUDE.md's "Figma — design source of truth" section for the file link and node ids. */

:root {
  /* Primitives */
  --color-gray-0: #FFFFFF;
  --color-gray-50: #F5F6F7;
  --color-gray-100: #E4E7EB;
  --color-gray-600: #687076;
  --color-gray-900: #11181C;
  --color-green-600: #1B6E4A;
  --color-green-700: #15563A;
  --color-red-600: #D33B3B;
  --color-red-700: #B32E2E;
  --color-orange-600: #D9731C;
  --color-orange-700: #B3591A;

  /* Semantic colors */
  --color-bg-primary: var(--color-gray-0);
  --color-bg-surface: var(--color-gray-50);
  --color-text-primary: var(--color-gray-900);
  --color-text-muted: var(--color-gray-600);
  --color-border-default: var(--color-gray-100);
  --color-accent-primary: var(--color-green-600);
  --color-accent-primary-hover: var(--color-green-700);
  --color-accent-secondary: var(--color-orange-600);
  --color-accent-secondary-hover: var(--color-orange-700);
  --color-feedback-success: var(--color-green-600);
  --color-feedback-danger: var(--color-red-600);
  --color-feedback-danger-hover: var(--color-red-700);
  --color-feedback-warning: var(--color-orange-600);
  /* No dedicated "info" color exists in Figma — the Info Alert variant borrows
     --color-text-muted for its accent border. Don't invent a feedback-info token. */

  /* Disabled state (Button, and anything else disabled) isn't a separate token in Figma —
     every disabled variant reuses bg: --color-border-default, text: --color-text-muted. */

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-full: 999px;

  /* Typography — sizes in rem so a single html{font-size} adjustment can
     rescale the whole type ramp if a swapped font reads bigger/smaller */
  --font-family-base: 'Inter', system-ui, sans-serif;
  --font-size-small: 0.875rem;  /* 14px */
  --font-size-label: var(--font-size-small);
  --font-size-body: 1rem;       /* 16px */
  --font-size-h3: 1.125rem;     /* 18px */
  --font-size-h2: 1.375rem;     /* 22px */
  --font-size-h1: 1.75rem;      /* 28px */
  --font-weight-regular: 400;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  /* Not part of Figma's documented H1-H3/Body/Small ramp, but Stat Card's value
     consistently uses this larger size for its headline number. */
  --font-size-stat: 1.625rem; /* 26px */
}

/* Reset: browser default margins on p/ul/form etc. would otherwise fight
   with the gap-based spacing used throughout (.page > * + *, .card's flex
   gap) — every layout gap here is explicit, not incidental UA margin. */
*, *::before, *::after {
  box-sizing: border-box;
}
body, h1, h2, h3, p, ul, ol, figure {
  margin: 0;
}
ul, ol {
  padding: 0;
  list-style: none;
}
form {
  margin: 0;
}
img {
  max-width: 100%;
  display: block;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-primary);
}

h1, h2, h3 {
  color: var(--color-text-primary);
}
h1 { font-size: var(--font-size-h1); font-weight: var(--font-weight-bold); }
h2 { font-size: var(--font-size-h2); font-weight: var(--font-weight-semibold); }
h3 { font-size: var(--font-size-h3); font-weight: var(--font-weight-semibold); }

a {
  color: var(--color-accent-primary);
}
a:hover {
  color: var(--color-accent-primary-hover);
}

/* ==========================================================================
   Layout
   ========================================================================== */

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg) var(--spacing-xl);
}

/* Lobotomized-owl spacing: consecutive top-level sections in .page get a
   consistent gap with no extra wrapper markup needed per template. */
.page > * + * {
  margin-top: var(--spacing-lg);
}

@media (max-width: 600px) {
  .page {
    padding: 0 var(--spacing-md) var(--spacing-xl);
  }
}

.messages {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.auth-card {
  max-width: 360px;
  margin: var(--spacing-xl) auto 0;
  text-align: center;
}
/* The real page <h1> sits below the SettleThePot wordmark here, so it's
   sized down to H3 rather than competing with it for visual weight. */
.auth-card h1 {
  font-size: var(--font-size-h3);
}
.auth-card .btn {
  width: 100%;
}
.auth-card .input-group {
  text-align: left;
}

/* Most forms here are one of two shapes: a multi-field form that stacks
   vertically (.form-stack), or a single button + csrf token that should
   render inline next to other content, e.g. a "Delete" action (.form-inline).
   Bare <form> is left unstyled since both shapes are common. */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}
.form-inline {
  display: inline-flex;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-sm);
}
.flex-1 {
  flex: 1;
  min-width: 0;
}
.grid-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}
.list-stack {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.status-actionable {
  color: var(--color-feedback-warning);
  font-weight: var(--font-weight-semibold);
}

.text-muted {
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

/* A card that needs the viewer's attention on the Sessions list - e.g. a
   session with requires_confirmation on that's still waiting on someone. */
/* Higher-specificity .card.card-pending (not just .card-pending) since
   this is defined before .card's own border rule in the cascade - a
   same-specificity, later-in-source .card{border:...} would otherwise win. */
.card.card-pending {
  border-color: var(--color-feedback-warning);
}

/* Real checkbox underneath, visually hidden; the track/thumb are styled
   siblings driven by :checked - no JS needed. */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
}
.toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.toggle-track {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--color-border-default);
  transition: background-color 0.15s ease;
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--color-bg-primary);
  box-shadow: 0 1px 2px rgba(17, 24, 28, 0.2);
  transition: transform 0.15s ease;
}
.toggle input:checked ~ .toggle-track {
  background: var(--color-accent-primary);
}
.toggle input:checked ~ .toggle-track .toggle-thumb {
  transform: translateX(18px);
}
.toggle input:focus-visible ~ .toggle-track {
  outline: 2px solid var(--color-accent-primary);
  outline-offset: 2px;
}
.toggle-label {
  font-size: var(--font-size-body);
  color: var(--color-text-primary);
}

.divider {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border-default);
}

/* ==========================================================================
   Button
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-family-base);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  background: var(--color-border-default);
  color: var(--color-text-muted);
  border-color: var(--color-border-default);
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-accent-primary);
  color: var(--color-gray-0);
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-accent-primary-hover);
}

.btn-secondary {
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  border-color: var(--color-border-default);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--color-bg-surface);
}

.btn-danger {
  background: var(--color-feedback-danger);
  color: var(--color-gray-0);
}
.btn-danger:hover:not(:disabled) {
  background: var(--color-feedback-danger-hover);
}

/* ==========================================================================
   Input
   ========================================================================== */

.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.input-label {
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-muted);
}
.input-group:focus-within .input-label {
  color: var(--color-text-primary);
}

.input-field {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-default);
  background: var(--color-bg-primary);
  font-family: var(--font-family-base);
  font-size: var(--font-size-body);
  color: var(--color-text-primary);
  box-sizing: border-box;
}
.input-field-narrow {
  width: 140px;
  max-width: 100%;
}
/* Signals "this text input also has a suggestion list" (an <input list=...>
   bound to a <datalist>, not a real <select> — free text still works, this
   is purely a visual affordance). Chevron color is --color-text-muted
   (#687076) hardcoded, since a data: URI can't reference a CSS variable. */
.input-field-select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23687076' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--spacing-md) center;
}
.input-field:focus {
  outline: none;
  border: 2px solid var(--color-accent-primary);
  padding: calc(var(--spacing-sm) - 1px) calc(var(--spacing-md) - 1px);
}
/* The generic focus rule above resets the shorthand `padding`, which would
   clobber the chevron's clearance — restore it after. */
.input-field-select:focus {
  padding-right: 35px;
}
.input-field:disabled {
  background: var(--color-bg-surface);
  color: var(--color-text-muted);
}

/* Error state has no :invalid-only CSS hook in Django's rendered HTML, so it's
   opt-in via this modifier class on .input-group rather than a pseudo-class. */
.input-group.has-error .input-field {
  border: 2px solid var(--color-feedback-danger);
  padding: calc(var(--spacing-sm) - 1px) calc(var(--spacing-md) - 1px);
}

.input-helper {
  display: none;
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}
.input-group.has-error .input-helper {
  display: block;
  color: var(--color-feedback-danger);
}

/* ==========================================================================
   Avatar
   ========================================================================== */

.avatar {
  display: inline-block;
  border-radius: var(--radius-full);
  background-color: var(--color-border-default);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.avatar-sm { width: 24px; height: 24px; }
.avatar-md { width: 32px; height: 32px; }
.avatar-lg { width: 48px; height: 48px; }

/* ==========================================================================
   Alert
   ========================================================================== */

.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-text-muted); /* Info: no dedicated color, reuses text-muted */
  background: var(--color-bg-surface);
  font-size: var(--font-size-body);
  color: var(--color-text-primary);
}
.alert-success { border-left-color: var(--color-feedback-success); }
.alert-warning { border-left-color: var(--color-feedback-warning); }
.alert-danger  { border-left-color: var(--color-feedback-danger); }

.alert-close {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: var(--font-size-body);
  line-height: 1;
}

/* ==========================================================================
   Card
   ========================================================================== */

.card {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-default);
  background: var(--color-bg-primary);
}

.card-title {
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}
.card-body {
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}

/* ==========================================================================
   Stat Row
   ========================================================================== */

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
}
.stat-row-label {
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}
.stat-row-value {
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  text-align: right;
}
.stat-row-value.is-positive { color: var(--color-feedback-success); }
.stat-row-value.is-negative { color: var(--color-feedback-danger); }

/* ==========================================================================
   Stat Card / Chart Card
   ========================================================================== */

.stat-card {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-default);
  background: var(--color-bg-primary);
}
.stat-card-label {
  font-size: var(--font-size-small); /* Figma uses 13px; close enough to not need its own token */
  color: var(--color-text-muted);
}
.stat-card-value {
  font-size: var(--font-size-stat);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}
.stat-card-value.is-positive { color: var(--color-feedback-success); }
.stat-card-value.is-negative { color: var(--color-feedback-danger); }

.chart-card {
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-default);
  background: var(--color-bg-primary);
}
.chart-card-title {
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: 0 0 var(--spacing-sm);
}
/* .chart-card-area is a placeholder slot for a charting library — no chart
   rendering is implemented here. */

/* ==========================================================================
   Navbar
   ========================================================================== */

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--spacing-lg);
  height: 68px;
  border-bottom: 1px solid var(--color-border-default);
  position: relative;
}

.navbar-brand {
  font-size: var(--font-size-h3);
  font-weight: var(--font-weight-semibold);
  color: var(--color-accent-primary);
  text-decoration: none;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
}
.navbar-links a {
  font-size: var(--font-size-body);
  color: var(--color-text-primary);
  text-decoration: none;
}

.navbar-hamburger {
  display: none;
}

/* Mobile nav uses the checkbox-hack toggle (no JS needed):
   <input type="checkbox" id="nav-toggle" class="nav-toggle" hidden>
   <label for="nav-toggle" class="navbar-hamburger">...</label>
   <div class="navbar-links">...</div>
   all three as siblings inside .navbar, in that order. */
@media (max-width: 600px) {
  .navbar {
    padding: 0 var(--spacing-md);
    height: 60px;
  }
  .navbar-brand {
    font-size: var(--font-size-body);
  }

  .navbar-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 10;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--color-bg-primary);
    border-bottom: 1px solid var(--color-border-default);
  }
  .nav-toggle:checked ~ .navbar-links {
    display: flex;
  }
  .navbar-hamburger {
    display: inline-flex;
    cursor: pointer;
  }
}

/* ==========================================================================
   Info Popover
   ========================================================================== */

/* Hover/focus reveal, no JS. Popover content is plain HTML written directly
   in the template — no data-attribute, no JSON, nothing to escape — so
   editing the hint text means editing the text between the tags:

   <span class="info-hint">
     <button type="button" class="info-trigger" aria-label="More info">?</button>
     <div class="info-popover">
       <p class="info-popover-title">Sessions</p>
       <p class="info-popover-text">Sessions are where your poker games are tracked.</p>
     </div>
   </span>

   For Figma's "Detailed" popover (multiple term/definition pairs, e.g. the
   session status legend), repeat the title/text pair inside the same
   .info-popover — it has no fixed child count, so there's nothing extra to
   learn for the longer case. */

.info-hint {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.info-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: var(--radius-full);
  background: var(--color-bg-surface);
  color: var(--color-text-muted);
  font-family: var(--font-family-base);
  font-size: 0.75rem; /* 12px, matches Figma's "?" glyph size exactly */
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  cursor: pointer;
}
.info-trigger:hover,
.info-trigger:focus-visible {
  color: var(--color-accent-primary);
}
.info-trigger:focus-visible {
  outline: 2px solid var(--color-accent-primary);
  outline-offset: 2px;
}

.info-popover {
  display: none;
  position: absolute;
  top: calc(100% + var(--spacing-xs));
  left: 0;
  z-index: 20;
  width: max-content;
  max-width: 280px;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-default);
  background: var(--color-bg-primary);
  box-shadow: 0 4px 12px rgba(17, 24, 28, 0.15);
}
.info-hint:hover .info-popover,
.info-hint:focus-within .info-popover {
  display: block;
}

.info-popover-title {
  margin: 0 0 var(--spacing-xs);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}
.info-popover-text {
  margin: 0;
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}
/* A title that follows a previous entry's text (the "Detailed" case, several
   term/definition pairs) gets space above it so each entry reads as its own block. */
.info-popover-text + .info-popover-title {
  margin-top: var(--spacing-sm);
}
