/* assets/css/index.css */

/* ==========================
   Top bar / header
   ========================== */

.page-index .top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.page-index .top-bar h1 {
  margin: 0;
  font-size: 1.4rem;
}

/* Right-side controls: Theme dropdown + search (and optionally stats button) */
.top-bar__controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* If you're using the Stats / Standings toggle */
.top-bar__controls .stats-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Mobile: let them wrap under each other */
@media (max-width: 768px) {
  .page-index .top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .top-bar__controls {
    flex-wrap: wrap;
    align-items: flex-start;
  }
}

/* ==========================
   Team filter (compact, themed)
   ========================== */

.team-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.team-filter label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Use theme vars for a soft, pill-like control */
.team-filter select {
  padding: 8px;
  font-size: 0.85rem;
  border-radius: 8px;
  border: 2px solid var(--border-subtle);
  background: var(--bg-input, var(--bg-surface-alt));
  color: var(--text-main);
  cursor: pointer;
  appearance: none;              /* cleaner look across browsers */
  -moz-appearance: none;
  -webkit-appearance: none;
  line-height: 1.2;
}

/* Add a subtle focus ring in your accent color */
.team-filter select:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 1px;
}

/* ==========================
   Thread search (themed input)
   ========================== */

.thread-search {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.thread-search label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Search input styled to match the dropdown */
.thread-search input[type="search"] {
  padding: 8px 10px;
  font-size: 0.85rem;
  border-radius: 999px;
  border: 2px solid var(--border-subtle);
  background: var(--bg-input, var(--bg-surface-alt));
  color: var(--text-main);
  min-width: 180px;
  max-width: 260px;
}

/* Placeholder color in theme-muted */
.thread-search input[type="search"]::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
}

/* Focus ring in accent color */
.thread-search input[type="search"]:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 1px;
}

/* ==========================
   Thread grid + cards
   ========================== */

.thread-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

/* Thread card */
.thread-card {
  display: flex;
  flex-direction: column;
  /* was: background: var(--bg-surface); */
  background: var(--page-card-bg, var(--bg-surface));
  border-radius: 6px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  transition:
    transform 0.12s ease-out,
    box-shadow 0.12s ease-out,
    border-color 0.12s ease-out,
    background-color 0.12s ease-out;
  min-height: 180px;
}

.thread-card,
.thread-card:visited {
  color: var(--text-main);
}

.thread-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6);
  border-color: var(--accent-primary-border, var(--accent-primary));
  /* was: background-color: var(--bg-surface-alt); */
  background-color: var(--page-card-bg-hover, var(--bg-surface-alt));
  color: var(--text-main);
}

/* Image / header area when we have a custom article image */
.thread-card__image {
  height: 160px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Team logo strip (fallback when there is no custom header) */
.thread-card__logo-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 12px;
  background-color: var(--accent-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.thread-card__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.thread-card__logo img {
  height: 42px;
  width: 42px;
  object-fit: contain;
}

/* The "@" between logos */
.thread-card__at {
  font-weight: 700;
  font-size: 1.1rem;
}

/* Placeholder if no image & no logos (should be rare) */
.thread-card__placeholder {
  height: 160px;
  background: linear-gradient(
    135deg,
    var(--bg-surface-alt),
    var(--bg-surface)
  );
}

/* Card body */
.thread-card__body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.thread-card__title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 2px;
  color: var(--text-main);
}

.thread-card:hover .thread-card__title {
  color: var(--text-main);
}

.thread-card__meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.thread-card__meta span {
  opacity: 0.9;
}

/* Small matchup line (e.g. VGK @ SJS) */
.thread-card__matchup {
  display: inline-flex;
  gap: 4px;
  font-weight: 500;
  background-color: var(--accent-secondary-soft);
  padding: 6px;
  border-radius: 9px;
  align-items: center;
}

/* Optional date badge */
.thread-card__date-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--accent-secondary-soft);
  border: 1px solid var(--accent-secondary);
  display: inline-block;
  margin-top: 4px;
}

/* Posts / unread counts */
.thread-card__counts {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.thread-card__counts--has-unread {
  color: var(--accent-secondary);
  font-weight: 600;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 0;
  opacity: 0.85;
  color: var(--text-muted);
}

/* Infinite scroll sentinel + button */

.thread-sentinel {
  width: 100%;
  height: 1px;
}

.thread-load-more {
  display: block;
  margin: 16px auto 0;
  padding: 6px 14px;
  font-size: 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-alt);
  color: var(--text-main);
  cursor: pointer;
}

.thread-load-more[hidden] {
  display: none;
}

/* Score styling */

.thread-card__score {
  display: inline-block;
  margin-top: 2px;
  font-weight: 600;
  color: var(--shark-orange); /* pops nicely on dark cards */
}

.thread-card__abbr--win {
  color: #4ade80; /* soft lime green */
}

.thread-card__abbr--loss {
  color: #f97373; /* warm red/pink – reads as loss but not neon */
}

.thread-card__score-num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  margin-left: 2px;
}

.thread-card__matchup--live .thread-card__pill {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #d6f8da; /* very light green */
  color: #075f22;
  border: 1px solid #b0e4b8;
}

.thread-card__at {
  opacity: 0.8;
}
.top-bar__controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-primary-soft) 14%, transparent);
}

/* ==========================
   Responsive tweaks
   ========================== */

@media (max-width: 768px) {
  .thread-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .thread-card__image,
  .thread-card__placeholder {
    height: min(56vw, 260px);
  }
}

@media (max-width: 480px) {
  .thread-card__image,
  .thread-card__placeholder {
    height: min(60vw, 240px);
  }

  .thread-search input[type="search"] {
    min-width: 140px;
    max-width: 100%;
  }
}
/* =======================================
   Mobile-friendly layout for index top bar
   ======================================= */

@media (max-width: 768px) {
  /* Let the title sit on its own line */
  .page-index .top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 12px;
  }

  /* Make the control block a full-width card */
  .top-bar__controls {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--accent-primary-soft) 18%, transparent);
  }

  /* Stack label + field vertically, full width */
  .thread-search,
  .team-filter {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    font-size: 0.85rem;
  }

  .thread-search label,
  .team-filter label {
    font-size: 0.8rem;
    color: var(--text-muted);
  }

  .thread-search input[type="search"],
  .team-filter select {
    width: 100%;
    min-width: 0;        /* kill any previous min-widths */
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* Extra-small tweaks */
@media (max-width: 480px) {
  .page-index .top-bar h1 {
    font-size: 1.2rem;
  }

  .top-bar__controls {
    padding: 8px 10px;
    border-radius: 10px;
  }
}
/* ==========================
   Desktop nav (unchanged-ish)
   ========================== */

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Hide hamburger on desktop */
.site-nav-toggle {
  display: none;
}

/* ==========================
   Mobile nav
   ========================== */

@media (max-width: 768px) {
  /* Header: logo + hamburger only on the main row */
  .site-header__inner {
    position: relative;
    padding-right: 8px;
  }

  /* Show hamburger button on mobile */
  .site-nav-toggle {
    display: block;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: color-mix(in srgb, var(--accent-primary-soft) 18%, transparent);
  }

  /* Nav becomes a dropdown panel under the header */
  .site-nav {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--bg-surface-elevated, #020617);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6);

    flex-direction: column;
    align-items: stretch;
    gap: 4px;

    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition:
      max-height 0.18s ease-out,
      opacity 0.18s ease-out;
  }

  /* When JS adds .site-nav--open, show the panel */
  .site-nav.site-nav--open {
    max-height: 400px; /* enough for all links */
    opacity: 1;
    pointer-events: auto;
  }

  /* Groups & dropdown items stacked vertically */
  .site-nav__group,
  .site-nav__item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }

  .site-nav__link,
  .site-nav__dropdown-link {
    display: block;
    width: 100%;
    border-radius: 8px;
    text-align: left;
    font-size: 0.9rem;
  }

  /* Primary “New Thread” link stands out but still full-width */
  .site-nav__link--primary {
    text-align: center;
    font-weight: 600;
  }

  /* Dropdown: just inline with other links on mobile */
  .site-nav__item--dropdown {
    position: static;
  }

  .site-nav__dropdown {
    position: static;
    box-shadow: none;
    background: transparent;
    padding-left: 0;
    margin-top: 0;
  }

  .site-nav__link--dropdown {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .site-nav__caret {
    margin-left: 6px;
    font-size: 0.7rem;
    opacity: 0.8;
  }
}
