/* ============================================================================
   CSS CUSTOM PROPERTIES
   Centralized color palette and typography for easy theming
   ========================================================================= */
:root {
  /* Typography */
  --font-heading: 'Russo One', system-ui, sans-serif;
  --font-mono: 'Azeret Mono', ui-monospace, monospace;
  --font-body: system-ui, -apple-system, sans-serif;

  /* Primary Colors */
  --color-primary: #4A7FB8;        /* Blue navbar */
  --color-secondary: #E8B4A8;      /* Peach footer */
  --color-accent-emerald: #10b981; /* Success/positive */
  --color-accent-rose: #f43f5e;    /* Error/negative */
  --color-accent-indigo: #6366f1;  /* Interactive elements */
  --color-accent-cyan: #06b6d4;    /* Info sections */
  --color-accent-amber: #f59e0b;   /* Warnings/highlights */
  --color-accent-fuchsia: #d946ef; /* Special features */

  /* Neutral Colors */
  --color-white: #ffffff;
  --color-slate-50: #f8fafc;
  --color-slate-100: #f1f5f9;
  --color-slate-200: #e2e8f0;
  --color-slate-300: #cbd5e1;
  --color-slate-500: #64748b;
  --color-slate-600: #475569;
  --color-slate-700: #334155;
  --color-slate-800: #1e293b;
  --color-slate-900: #0f172a;

  /* Layout */
  --max-width: 1280px;
  --content-width: 80%;
  --spacing-unit: 1rem;
  --border-radius: 0.75rem;
  --transition-speed: 0.2s;
}

/* ============================================================================
   RESET & BASE STYLES
   Normalize browser defaults and set foundational styles
   ========================================================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  color: var(--color-slate-900);
  background: linear-gradient(to bottom, var(--color-white), var(--color-slate-50));
  min-height: 100vh;
  line-height: 1.6;
}

/* ============================================================================
   TYPOGRAPHY
   Font styles, sizes, and text utilities
   ========================================================================= */
.heading-font {
  font-family: var(--font-heading);
  letter-spacing: 0.02em;
}

.mono-font {
  font-family: var(--font-mono);
}

.uppercase {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Tabular numbers for consistent width (great for tables and metrics) */
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* ============================================================================
   LAYOUT UTILITIES
   Grid, flex, spacing, and container utilities
   ========================================================================= */
.container {
  max-width: 1152px; /* 72rem */
  width: var(--content-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  margin-bottom: 4rem;
}

/* Header row with title and action buttons on the same line */
.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.section-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.section-header-row .section-header {
  margin-bottom: 0;
}

.section-header {
  font-size: 1.5rem;
  font-weight: 600;
  padding-left: 0.5rem;
  border-left: 4px solid;
  margin-bottom: 1rem;
}

.section-subtitle {
  font-size: 0.875rem;
  color: var(--color-slate-500);
  margin-bottom: 1rem;
  padding-left: 0.5rem;
}

/* Decorative divider between sections */
.section-divider {
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(148, 163, 184, 0.3) 20%,
    rgba(148, 163, 184, 0.3) 80%,
    transparent
  );
  margin: 3rem 0;
}

/* ============================================================================
   NAVIGATION BAR
   Fixed top navigation with search functionality
   ========================================================================= */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--color-primary);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.navbar-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.navbar-brand h1 {
  font-size: 1.875rem;
  color: var(--color-white);
  font-family: var(--font-heading);
  letter-spacing: 0.02em;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.navbar-link {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: color 0.2s;
}

.navbar-link:hover {
  color: #fff;
}

.navbar-link.active {
  color: #fff;
  border-bottom: 2px solid #fbbf24;
  padding-bottom: 2px;
}

.navbar-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.search-box {
  position: relative;
}

.search-box .search-results {
  right: 0;
}

.search-input {
  width: 288px; /* 18rem */
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #93c5fd;
  color: var(--color-slate-900);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  outline: none;
  transition: all var(--transition-speed);
}

.search-input:focus {
  border-color: var(--color-white);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
}

.search-input::placeholder {
  color: var(--color-slate-500);
}

.search-button {
  width: 2.5rem;
  height: 2.5rem;
  background: #fbbf24;
  color: #1e3a8a;
  border: none;
  border-radius: 0.375rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--transition-speed);
}

.search-button:hover {
  background: #fcd34d;
}

/* Search Results Dropdown */
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 2.5rem; /* Account for search button */
  margin-top: 0.5rem;
  background: var(--color-white);
  border: 1px solid var(--color-slate-200);
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.search-results.active {
  display: block;
}

.search-results-empty {
  padding: 1rem;
  text-align: center;
  color: var(--color-slate-500);
  font-size: 0.875rem;
}

.search-result-item {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--color-slate-100);
  transition: background var(--transition-speed);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item.selected {
  background: var(--color-slate-50);
}

.search-result-item.selected {
  background: #dbeafe; /* Light blue for keyboard selection */
}

.search-result-name {
  font-weight: 600;
  color: var(--color-slate-900);
  font-size: 0.9375rem;
}

.search-result-school {
  font-size: 0.8125rem;
  color: var(--color-slate-500);
  margin-top: 0.125rem;
}

/* ============================================================================
   FOOTER
   Bottom footer with links and copyright
   ========================================================================= */
.footer {
  background: var(--color-secondary);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
  margin-top: 4rem;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.footer-links a {
  color: var(--color-slate-700);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  transition: color var(--transition-speed);
}

.footer-links a:hover {
  color: var(--color-slate-900);
  text-decoration: underline;
}

.footer-divider {
  color: var(--color-slate-400);
  font-size: 0.875rem;
}

.footer-copyright {
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-slate-600);
}

/* ============================================================================
   CARDS
   Reusable card component for content sections
   ========================================================================= */
.card {
  background: var(--color-white);
  border-radius: var(--border-radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem 0.25rem;
  border-bottom: 1px solid var(--color-slate-200);
}

.card-content {
  padding: 1rem;
}

/* Enhanced card with colored ring outline */
.card-ring {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  outline: 2px solid;
  outline-offset: -2px;
}

.card-ring-emerald { outline-color: rgba(16, 185, 129, 0.6); }
.card-ring-indigo { outline-color: rgba(99, 102, 241, 0.6); }
.card-ring-fuchsia { outline-color: rgba(217, 70, 239, 0.6); }
.card-ring-cyan { outline-color: rgba(6, 182, 212, 0.5); }
.card-ring-amber { outline-color: rgba(245, 158, 11, 0.6); }

/* ============================================================================
   ICONS (SVG)
   Inline SVG icon utilities
   ========================================================================= */
.icon {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-lg {
  width: 1.25rem;
  height: 1.25rem;
}

.icon-xl {
  width: 1.5rem;
  height: 1.5rem;
}

/* ============================================================================
   UTILITY CLASSES
   Spacing, alignment, and other helpers
   ========================================================================= */
.mt-28 {
  margin-top: 7rem; /* Account for fixed navbar */
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

/* ============================================================================
   SCANLINES OVERLAY
   Retro CRT effect for cards
   ========================================================================= */
.scanlines {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 1) 0,
    rgba(0, 0, 0, 1) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.05;
  pointer-events: none;
}

/* ============================================================================
   HEAD-TO-HEAD COMPARISON (SHARED STYLES)
   Integrated player comparison with fuchsia theme
   Used on both homepage and player-detail pages
   ========================================================================= */
.h2h-controls-row {
  display: flex;
  align-items: end;
  gap: 1.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.h2h-control {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-width: 250px;
}

.h2h-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-slate-600);
  font-weight: 600;
}

.h2h-select {
  width: 100%;
  background: var(--color-white);
  border: 1px solid var(--color-slate-300);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.h2h-select:focus {
  outline: none;
  border-color: var(--color-accent-fuchsia);
  box-shadow: 0 0 0 2px rgba(217, 70, 239, 0.2);
}

/* Category tabs */
.h2h-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.h2h-tab {
  padding: 0.5rem 1rem;
  background: var(--color-white);
  border: 2px solid var(--color-slate-300);
  border-radius: 0.375rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-slate-700);
  cursor: pointer;
  transition: all var(--transition-speed);
  font-weight: 600;
}

.h2h-tab:hover {
  background: var(--color-slate-50);
  border-color: var(--color-slate-400);
}

.h2h-tab.active {
  background: #fae8ff;
  border-color: var(--color-accent-fuchsia);
  color: #86198f;
}

/* Comparison card */
.h2h-card {
  position: relative;
  overflow: hidden;
  /* Dot-matrix background pattern */
  background-image:
    linear-gradient(#ffffff, #ffffff),
    radial-gradient(circle at 1px 1px, rgba(217, 70, 239, 0.08) 1px, transparent 1px);
  background-size: 100% 100%, 12px 12px;
}

.h2h-content {
  position: relative;
  padding: 1.5rem;
}

/* Similarity badge */
.h2h-similarity-badge {
  position: absolute;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  background: #fae8ff;
  color: #86198f;
  border: 2px solid var(--color-accent-fuchsia);
  z-index: 10;
  box-shadow: 0 2px 4px rgba(217, 70, 239, 0.2);
}

/* Comparison container with photos */
.h2h-comparison-container {
  display: flex;
  flex-direction: column;
  margin-top: 3.5rem;
  margin-bottom: 1rem;
}

/* Photos row above table */
.h2h-photos-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 1.5rem;
}

/* Spacer to separate photos */
.h2h-photos-spacer {
  width: 2rem;
}

/* Player photos */
.h2h-player-photo {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.h2h-photo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
}

.h2h-player-photo img {
  width: 150px;
  height: 150px;
  border-radius: 0.75rem;
  object-fit: cover;
  border: 3px solid var(--color-accent-fuchsia);
  box-shadow: 0 4px 8px rgba(217, 70, 239, 0.2);
  transition: transform var(--transition-speed);
}

.h2h-player-photo img:hover {
  transform: scale(1.05);
}

.h2h-photo-name {
  margin-top: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-slate-700);
}

/* Comparison table */
.h2h-comparison-table {
  width: 100%;
  overflow-x: auto;
}

.h2h-comparison-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.h2h-comparison-table thead th {
  padding: 0.75rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
  color: var(--color-slate-600);
  border-bottom: 2px solid var(--color-slate-200);
  font-weight: 600;
}

.h2h-comparison-table tbody td {
  padding: 0.875rem 0.75rem;
  border-bottom: 1px solid var(--color-slate-200);
}

.h2h-comparison-table tbody tr:hover {
  background: var(--color-slate-50);
}

.h2h-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  font-weight: 600;
}

.h2h-value.winner {
  color: var(--color-accent-fuchsia);
  font-weight: 800;
  background: #fae8ff;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.h2h-value.loser {
  color: var(--color-slate-500);
}

/* Winner banner */
.h2h-winner-banner {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 0.375rem;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.875rem;
}

.h2h-winner-banner.winner-a {
  background: #fae8ff;
  color: #86198f;
  border: 2px solid var(--color-accent-fuchsia);
}

.h2h-winner-banner.winner-b {
  background: #cffafe;
  color: #155e75;
  border: 2px solid var(--color-accent-cyan);
}

.h2h-winner-banner.tie {
  background: var(--color-slate-100);
  color: var(--color-slate-800);
  border: 2px solid var(--color-slate-300);
}

/* ============================================================================
   NEWS FEED (SHARED STYLES)
   Used on both homepage and player-detail pages
   ========================================================================= */
.feed-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.feed-item {
  background: var(--color-white);
  padding: 0.75rem;
  border-radius: var(--border-radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  outline: 1px solid rgba(6, 182, 212, 0.5);
  transition: background var(--transition-speed);
}

.feed-item:hover {
  background: var(--color-slate-50);
}

.feed-title {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 0.25rem;
}

.feed-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.6875rem;
  color: var(--color-slate-500);
}

.feed-tag {
  margin-left: auto;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  border: 1px solid;
  font-size: 0.6875rem;
}

.feed-tag.scouting-report {
  color: #4338ca;
  border-color: #c7d2fe;
  background: #e0e7ff;
}

.feed-tag.big-board {
  color: #7c3aed;
  border-color: #ddd6fe;
  background: #ede9fe;
}

.feed-tag.mock-draft {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #dbeafe;
}

.feed-tag.tier-update {
  color: #0891b2;
  border-color: #a5f3fc;
  background: #cffafe;
}

.feed-tag.game-recap {
  color: #15803d;
  border-color: #a7f3d0;
  background: #d1fae5;
}

.feed-tag.film-study {
  color: #475569;
  border-color: #cbd5e1;
  background: #f1f5f9;
}

.feed-tag.skill-theme {
  color: #92400e;
  border-color: #fde68a;
  background: #fef3c7;
}

.feed-tag.team-fit {
  color: #0f766e;
  border-color: #99f6e4;
  background: #ccfbf1;
}

.feed-tag.draft-intel {
  color: #be123c;
  border-color: #fecdd3;
  background: #ffe4e6;
}

.feed-tag.stats-analysis {
  color: #334155;
  border-color: #e2e8f0;
  background: #f8fafc;
}

/* ============================================================================
   RESPONSIVE DESIGN - BASE
   Mobile-first breakpoints for shared components
   ========================================================================= */
@media (max-width: 768px) {
  .h2h-controls-row {
    flex-direction: column;
    align-items: stretch;
  }

  .h2h-control {
    min-width: 100%;
  }

  .h2h-tabs {
    gap: 0.375rem;
  }

  .h2h-tab {
    font-size: 0.6875rem;
    padding: 0.375rem 0.75rem;
  }

  .h2h-similarity-badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
  }

  .h2h-comparison-container {
    margin-top: 3rem;
  }

  .h2h-photos-row {
    grid-template-columns: 1fr auto 1fr;
    margin-bottom: 1rem;
  }

  .h2h-player-photo img {
    width: 120px;
    height: 120px;
  }

  .h2h-photo-name {
    font-size: 0.75rem;
  }
  .navbar-brand h1 {
    font-size: 1.5rem;
  }

  .search-input {
    width: 200px;
  }

  .section-header {
    font-size: 1.25rem;
  }
}
