/**
 * FFToolbox shared UI foundations (fft-ui.css)
 * ============================================
 * Workplan: docs/wip/20260930/WORKPLAN_SK_HEADSHOTS_AND_TOP25_RESPONSIVE_POLISH.md (Phase U0)
 *
 * Loaded on every page by includes/NewHeaderTest.php (PHP pages include it
 * directly; ColdFusion pages pull it in via includes/header.cfm ->
 * includes/NewMenuHeader.cfm -> cfhttp NewHeaderTest.php) and by the legacy
 * includes/header.php. It loads AFTER FftNewMenu.css, i.e. last in the cascade.
 *
 * RULES FOR THIS FILE
 *  - Opt-in only. Every selector is scoped to an .fft-* class (or to the
 *    header login button). Nothing here restyles an existing page until the
 *    page adds the class.
 *  - Never target ad/monetization containers (#side-b, .skyscraper, .sky,
 *    .ad, .advertisement, [id*=usmg_ad], [id*=google_ads], .logoBar, ...).
 *  - Breakpoint scale (use ONLY these values in new rules):
 *        390px   small phone
 *        560px   large phone  (card rows, scrolling toolbar)
 *        768px   tablet portrait (44px row targets)
 *        1024px  tablet landscape / small laptop
 *        1280px  desktop
 *  - Motion: 150-200ms transitions; all motion is disabled under
 *    prefers-reduced-motion: reduce (bottom of file).
 */

/* ============================================================
   1. Tokens
   ============================================================ */
:root {
  /* Brand (taken from FftNewMenu.css / responsive.css / proptimizer.css) */
  --fft-navy: #0b1c2d;          /* header + menu bar navy */
  --fft-ink: #0b1c2d;           /* primary text on light surfaces */
  --fft-ink-muted: #536d82;     /* secondary text, >= 4.5:1 on white */
  --fft-surface: #ffffff;
  --fft-surface-alt: #f5f9fc;
  --fft-border: #d8e2ed;
  --fft-accent: #0789e7;        /* FFT brand blue (menu, links) */
  --fft-accent-ink: #0876bc;    /* accent dark enough for small text on white */

  /* Player status (always paired with visible text) */
  --fft-status-active: #08734c;
  --fft-status-questionable: #975a16; /* amber, 5:1 on its chip tint */
  --fft-status-doubtful: #b4491a;    /* orange, 4.6:1 on its chip tint */
  --fft-status-out: #c53030;
  --fft-status-ir: #6b46c1;

  /* Movement */
  --fft-up: #08734c;
  --fft-down: #c53030;

  /* Spacing (4px base) */
  --fft-space-1: 4px;
  --fft-space-2: 8px;
  --fft-space-3: 12px;
  --fft-space-4: 16px;
  --fft-space-5: 24px;
  --fft-space-6: 32px;

  --fft-radius: 8px;
  --fft-shadow-1: 0 1px 2px rgba(11, 28, 45, 0.08), 0 1px 3px rgba(11, 28, 45, 0.06);
  --fft-shadow-2: 0 4px 12px rgba(11, 28, 45, 0.12), 0 2px 4px rgba(11, 28, 45, 0.08);

  /* Body font is Bootstrap 3's stack (no site CSS overrides body font-family) */
  --fft-font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --fft-font-num: var(--fft-font);
  --fft-num-variant: tabular-nums;

  /* Table internals */
  --fft-row-tint: rgba(11, 28, 45, 0.035);
  --fft-row-hover: rgba(7, 137, 231, 0.09);
  --fft-sticky-top: 0px;       /* override when a page has a fixed bar above */

  --fft-ease: cubic-bezier(0.2, 0, 0, 1);
  --fft-duration: 180ms;
}

/* ============================================================
   2. Scoped base / tap targets (opt-in via .fft-ui wrapper)
   ============================================================ */
.fft-ui {
  font-family: var(--fft-font);
  color: var(--fft-ink);
}

.fft-ui button,
.fft-ui .btn,
.fft-toolbar a,
.fft-tabs a {
  min-height: 44px;
}

.fft-num {
  font-family: var(--fft-font-num);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   3. Tables
   ============================================================ */

/* Wrapper: horizontal scroll with edge shadows that appear only when
   there is more content in that direction (local/scroll technique). */
.fft-table-scroll {
  position: relative;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background:
    linear-gradient(to right, var(--fft-surface) 30%, rgba(255, 255, 255, 0)) left center / 40px 100% no-repeat local,
    linear-gradient(to left, var(--fft-surface) 30%, rgba(255, 255, 255, 0)) right center / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(11, 28, 45, 0.2), rgba(11, 28, 45, 0)) left center / 14px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(11, 28, 45, 0.2), rgba(11, 28, 45, 0)) right center / 14px 100% no-repeat scroll;
  background-color: var(--fft-surface);
}

/* Optional: cap height so the sticky header also sticks while scrolling
   vertically (an overflow-x wrapper is the sticky scroll container). */
.fft-table-scroll--capped {
  max-height: 70vh;
  overflow-y: auto;
}

.fft-table {
  width: 100%;
  border-collapse: separate;   /* separate + 0 spacing keeps sticky cell borders */
  border-spacing: 0;
  font-family: var(--fft-font);
  font-size: 13px;             /* never below 12px; Bootstrap 3 sets html to 10px so rem is avoided */
  font-variant-numeric: tabular-nums;
  color: var(--fft-ink);
  background: transparent;     /* let the scroll-shadow cues show through */
}

.fft-table th,
.fft-table td {
  padding: var(--fft-space-2) var(--fft-space-3);
  border-bottom: 1px solid var(--fft-border);
  text-align: left;
  vertical-align: middle;
}

.fft-table thead th {
  position: -webkit-sticky;
  position: sticky;
  top: var(--fft-sticky-top);
  z-index: 2;
  background: var(--fft-surface-alt);
  color: var(--fft-ink);
  font-weight: 700;
  white-space: nowrap;
  box-shadow: inset 0 -1px 0 var(--fft-border);
}

/* Row backgrounds are painted as an image layer from --fft-row-bg so that
   ordinary cells stay translucent (edge cues visible) while sticky cells can
   composite the same tint over an opaque surface. */
.fft-table tbody tr {
  --fft-row-bg: transparent;
}

.fft-table tbody tr:nth-child(even) {
  --fft-row-bg: var(--fft-row-tint);
}

.fft-table tbody tr:hover,
.fft-table tbody tr:focus-within {
  --fft-row-bg: var(--fft-row-hover);
}

.fft-table tbody th,
.fft-table tbody td {
  background-image: linear-gradient(var(--fft-row-bg), var(--fft-row-bg));
}

.fft-table tbody tr:focus-within {
  outline: 2px solid var(--fft-accent);
  outline-offset: -2px;
}

.fft-table .fft-num,
.fft-table td.num,
.fft-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Sticky first column */
.fft-table--sticky-first th:first-child,
.fft-table--sticky-first td:first-child {
  position: -webkit-sticky;
  position: sticky;
  left: 0;
  z-index: 1;
  background-color: var(--fft-surface);
  box-shadow: 4px 0 6px -4px rgba(11, 28, 45, 0.25);
}

.fft-table--sticky-first thead th:first-child {
  z-index: 3;
  background-color: var(--fft-surface-alt);
  box-shadow: inset 0 -1px 0 var(--fft-border), 4px 0 6px -4px rgba(11, 28, 45, 0.25);
}

@media (max-width: 768px) {
  .fft-table tbody tr {
    height: 44px;              /* table rows honour height as a minimum */
  }

  .fft-table th,
  .fft-table td {
    padding: var(--fft-space-2);
  }
}

/* ============================================================
   4. Card rows (opt-in on the <table>): rows become cards <= 560px.
      Each <td> needs data-label="Column name".
   ============================================================ */
@media (max-width: 560px) {
  table.fft-card-rows,
  .fft-card-rows tbody,
  .fft-card-rows tr,
  .fft-card-rows td {
    display: block;
    width: 100%;
  }

  .fft-card-rows thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .fft-card-rows tbody tr {
    height: auto;
    margin: 0 0 var(--fft-space-3);
    padding: var(--fft-space-2) var(--fft-space-3);
    border: 1px solid var(--fft-border);
    border-radius: var(--fft-radius);
    background: var(--fft-surface);
    box-shadow: var(--fft-shadow-1);
  }

  .fft-card-rows tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--fft-space-3);
    min-height: 32px;
    padding: var(--fft-space-1) 0;
    border-bottom: 1px solid var(--fft-surface-alt);
    background-image: none;
    text-align: right;
  }

  .fft-card-rows tbody td:last-child {
    border-bottom: 0;
  }

  .fft-card-rows td[data-label]::before {
    content: attr(data-label);
    flex: none;
    color: var(--fft-ink-muted);
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }

  /* sticky-first makes no sense in card layout */
  .fft-card-rows.fft-table--sticky-first td:first-child,
  .fft-card-rows.fft-table--sticky-first th:first-child {
    position: static;
    box-shadow: none;
    background-color: transparent;
  }
}

/* ============================================================
   5. Headshots
   ============================================================ */
.fft-headshot {
  --fft-headshot-size: 40px;
  display: inline-block;
  flex: none;
  box-sizing: border-box;
  width: var(--fft-headshot-size);
  height: var(--fft-headshot-size);
  border-radius: 50%;
  border: 2px solid var(--fft-team-color, var(--fft-border));
  background: var(--fft-surface-alt);
  object-fit: cover;
  object-position: center top;
  overflow: hidden;
  vertical-align: middle;
}

.fft-headshot--sm { --fft-headshot-size: 28px; }
.fft-headshot--md { --fft-headshot-size: 40px; }
.fft-headshot--lg { --fft-headshot-size: 96px; }

.fft-headshot--initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fft-ink-muted);
  font-family: var(--fft-font);
  font-size: calc(var(--fft-headshot-size) * 0.38);
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0;
  user-select: none;
}

.fft-player-cell {
  display: inline-flex;
  align-items: center;
  gap: var(--fft-space-2);
  min-width: 0;
  max-width: 100%;
  vertical-align: middle;
}

.fft-player-cell__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fft-player-cell__meta {
  color: var(--fft-ink-muted);
  font-size: 12px;
  white-space: nowrap;
}

/* ============================================================
   6. Chips (text always visible; color only reinforces it)
   ============================================================ */
.fft-chip {
  --fft-chip-color: var(--fft-ink-muted);
  --fft-chip-bg: var(--fft-surface-alt);
  display: inline-flex;
  align-items: center;
  gap: var(--fft-space-1);
  box-sizing: border-box;
  min-height: 22px;
  padding: 2px var(--fft-space-2);
  border: 1px solid currentColor;
  border-radius: 999px;
  background: var(--fft-chip-bg);
  color: var(--fft-chip-color);
  font-family: var(--fft-font);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  vertical-align: middle;
}

.fft-chip--active,
.fft-chip--fp       { --fft-chip-color: var(--fft-status-active);       --fft-chip-bg: #e6f4ee; }
.fft-chip--questionable,
.fft-chip--lp       { --fft-chip-color: var(--fft-status-questionable);                        --fft-chip-bg: #fdf3e1; }
.fft-chip--doubtful { --fft-chip-color: var(--fft-status-doubtful);     --fft-chip-bg: #fcebe0; }
.fft-chip--out,
.fft-chip--dnp      { --fft-chip-color: var(--fft-status-out);          --fft-chip-bg: #fdecec; }
.fft-chip--ir       { --fft-chip-color: var(--fft-status-ir);           --fft-chip-bg: #f1ecfb; }
.fft-chip--up       { --fft-chip-color: var(--fft-up);                  --fft-chip-bg: #e6f4ee; }
.fft-chip--down     { --fft-chip-color: var(--fft-down);                --fft-chip-bg: #fdecec; }

/* ============================================================
   7. Cards
   ============================================================ */
.fft-card {
  box-sizing: border-box;
  padding: var(--fft-space-4);
  border: 1px solid var(--fft-border);
  border-radius: var(--fft-radius);
  background: var(--fft-surface);
  box-shadow: var(--fft-shadow-1);
  color: var(--fft-ink);
  transition: transform var(--fft-duration) var(--fft-ease),
              box-shadow var(--fft-duration) var(--fft-ease);
}

@media (hover: hover) {
  .fft-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--fft-shadow-2);
  }
}

.fft-card:focus-within {
  box-shadow: var(--fft-shadow-2);
}

/* ============================================================
   8. Toolbar (sticky filter bar)
   ============================================================ */
.fft-toolbar {
  position: -webkit-sticky;
  position: sticky;
  top: var(--fft-sticky-top);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--fft-space-2);
  box-sizing: border-box;
  padding: var(--fft-space-2) var(--fft-space-3);
  border-bottom: 1px solid var(--fft-border);
  background: var(--fft-surface);
}

.fft-toolbar a {
  display: inline-flex;
  align-items: center;
}

@media (max-width: 560px) {
  .fft-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .fft-toolbar > * {
    flex: none;
    scroll-snap-align: start;
  }
}

/* ============================================================
   9. Tabs (horizontal, scroll-snap, animated underline)
      Active tab: .is-active, [aria-selected="true"] or [aria-current="page"]
   ============================================================ */
.fft-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  border-bottom: 1px solid var(--fft-border);
}

.fft-tabs > li {
  flex: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

.fft-tabs a,
.fft-tabs button,
.fft-tabs .fft-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 44px;
  padding: 0 var(--fft-space-4);
  border: 0;
  background: transparent;
  color: var(--fft-ink-muted);
  font-family: var(--fft-font);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  scroll-snap-align: start;
  transition: color var(--fft-duration) var(--fft-ease);
}

.fft-tabs a::after,
.fft-tabs button::after,
.fft-tabs .fft-tab::after {
  content: "";
  position: absolute;
  left: var(--fft-space-3);
  right: var(--fft-space-3);
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--fft-accent);
  transform: scaleX(0);
  transition: transform var(--fft-duration) var(--fft-ease);
}

.fft-tabs a:hover,
.fft-tabs a:focus-visible,
.fft-tabs button:hover,
.fft-tabs button:focus-visible,
.fft-tabs .fft-tab:hover {
  color: var(--fft-ink);
  text-decoration: none;
}

.fft-tabs .is-active,
.fft-tabs [aria-selected="true"],
.fft-tabs [aria-current="page"] {
  color: var(--fft-ink);
}

.fft-tabs .is-active::after,
.fft-tabs [aria-selected="true"]::after,
.fft-tabs [aria-current="page"]::after,
.fft-tabs li.is-active > a::after {
  transform: scaleX(1);
}

.fft-tabs li.is-active > a {
  color: var(--fft-ink);
}

/* ============================================================
   10. Skeleton shimmer
   ============================================================ */
.fft-skeleton {
  display: block;
  min-height: 1em;
  border-radius: 4px;
  background: linear-gradient(90deg, #eef2f7 25%, #f7f9fc 37%, #eef2f7 63%);
  background-size: 400% 100%;
  color: transparent !important;
  animation: fft-shimmer 1.4s ease infinite;
}

@keyframes fft-shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ============================================================
   11. Header login/logout button (replaces inline styles in
       includes/NewHeaderTest.php; identical appearance)
   ============================================================ */
.fft-login-btn,
#user-menu-stronga .fft-login-btn,
#user-menu-stronga .fft-login-btn:hover,
#user-menu-stronga .fft-login-btn:focus {
  color: #ffffff;
  text-align: right;
}

/* ============================================================
   12. Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .fft-card,
  .fft-tabs a,
  .fft-tabs button,
  .fft-tabs .fft-tab,
  .fft-tabs a::after,
  .fft-tabs button::after,
  .fft-tabs .fft-tab::after {
    transition: none;
  }

  .fft-card:hover {
    transform: none;
  }

  .fft-skeleton {
    animation: none;
  }

  .fft-toolbar,
  .fft-tabs {
    scroll-behavior: auto;
  }
}
