/* ==========================================================================
   FCF Seguidor - Accessible, Responsive CSS Design System (v2)
   WCAG 2.1 AA Compliant, Mobile-First, Clean Modern UI
   ========================================================================== */

:root {
  /* Brand colors */
  --color-primary: #c8102e;        /* FCF Red */
  --color-primary-hover: #a50d24;
  --color-primary-dark: #7f0a1d;
  --color-primary-light: #fff1f2;
  --color-primary-border: #fecdd3;

  --color-secondary: #0f172a;      /* Deep Navy */
  --color-secondary-light: #1e293b;

  /* Neutral scale */
  --color-bg: #f3f4f7;
  --color-surface: #ffffff;
  --color-surface-muted: #f8f9fb;
  --color-surface-hover: #f1f3f6;
  --color-border: #e5e7eb;
  --color-border-subtle: #f0f1f4;

  --color-text-main: #0f172a;
  --color-text-muted: #475569;
  --color-text-subtle: #64748b;
  --color-text-inverse: #ffffff;

  /* Status colors */
  --color-win: #15803d;
  --color-win-bg: #dcfce7;
  --color-draw: #b45309;
  --color-draw-bg: #fef3c7;
  --color-loss: #b91c1c;
  --color-loss-bg: #fee2e2;

  --color-accent: #2563eb;
  --color-accent-bg: #eff6ff;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Shadows (soft, layered) */
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.04);
  --shadow-md: 0 1px 2px rgb(15 23 42 / 0.04), 0 4px 16px rgb(15 23 42 / 0.06);
  --shadow-lg: 0 2px 4px rgb(15 23 42 / 0.05), 0 12px 32px rgb(15 23 42 / 0.10);

  /* Spacing */
  --card-padding: 1.125rem;
  --pos-col-width: calc(var(--card-padding) + 1.25rem);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

@media (min-width: 640px) {
  :root {
    --card-padding: 1.5rem;
  }
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--color-bg);
  overflow-x: hidden;
}

button {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

img {
  max-width: 100%;
}

/* Accessibility: Skip Link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--color-secondary);
  color: var(--color-text-inverse);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  z-index: 9999;
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 1rem;
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* Accessibility: Focus visible outline */
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* Accessibility: Screen reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Layout Container */
.container {
  width: 100%;
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

@media (min-width: 640px) {
  .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

/* Header & Navigation */
.site-header {
  background-color: rgb(255 255 255 / 0.85);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 40;
  padding-top: env(safe-area-inset-top);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0;
  gap: 0.75rem;
  min-height: 56px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: var(--color-text-main);
  min-width: 0;
}

.brand-badge {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: white;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  box-shadow: 0 4px 10px rgb(200 16 46 / 0.25);
  flex-shrink: 0;
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--color-secondary);
  white-space: nowrap;
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--color-text-subtle);
  display: none;
}

@media (min-width: 640px) {
  .brand-text p {
    display: block;
  }
}

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

/* Language Selector (segmented control) */
.lang-selector {
  display: inline-flex;
  background-color: var(--color-surface-hover);
  padding: 3px;
  border-radius: var(--radius-full);
}

.lang-btn {
  background: transparent;
  border: none;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 32px;
  min-width: 36px;
}

.lang-btn:hover {
  color: var(--color-text-main);
}

.lang-btn.active {
  background-color: var(--color-surface);
  color: var(--color-primary);
  box-shadow: 0 1px 3px rgb(15 23 42 / 0.12);
}

/* General Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  min-height: 44px; /* Touch target size */
  text-decoration: none;
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
  box-shadow: 0 4px 12px rgb(200 16 46 / 0.2);
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
}

.btn-outline {
  background-color: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text-main);
}

.btn-outline:hover {
  background-color: var(--color-surface-hover);
}

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  min-height: 40px;
}

/* Main Content Area */
main {
  flex: 1;
  padding-top: 1rem;
  padding-bottom: 2.5rem;
}

@media (min-width: 640px) {
  main {
    padding-top: 1.75rem;
    padding-bottom: 3.5rem;
  }
}

main:focus {
  outline: none;
}

/* Loading & Error States */
.state-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin: 1rem 0;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--color-text-muted);
}

.breadcrumb-btn {
  background: transparent;
  border: none;
  color: var(--color-primary);
  font-weight: 600;
  cursor: pointer;
  padding: 0.35rem 0;
  font-size: 0.85rem;
}

.breadcrumb-btn:hover {
  text-decoration: underline;
}

.breadcrumb-current {
  color: var(--color-text-main);
  font-weight: 700;
}

.breadcrumb-sep {
  color: var(--color-text-subtle);
  opacity: 0.6;
}

/* ==========================================================================
   WIZARD / ONBOARDING COMPONENT
   ========================================================================== */

.wizard-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.25rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .wizard-card {
    padding: 2.25rem;
  }
}

.wizard-header {
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--color-border-subtle);
}

.wizard-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--color-secondary);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

@media (min-width: 640px) {
  .wizard-header h2 {
    font-size: 1.65rem;
  }
}

.wizard-header p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.step-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scrollbar-width: none;
}

.step-indicator::-webkit-scrollbar {
  display: none;
}

.step-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  background-color: var(--color-surface-hover);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.step-pill.active {
  background-color: var(--color-primary);
  color: white;
  font-weight: 700;
}

.step-pill.completed {
  background-color: var(--color-win-bg);
  color: var(--color-win);
}

.wizard-prompt {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.875rem;
  color: var(--color-secondary);
}

/* Grid of selection choices */
.choice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.625rem;
  margin-top: 0.75rem;
}

@media (min-width: 600px) {
  .choice-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .choice-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.choice-btn {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  background-color: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-main);
  font-weight: 600;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 56px;
}

.choice-btn:hover {
  border-color: var(--color-primary-border);
  background-color: var(--color-primary-light);
}

.choice-btn:active {
  transform: scale(0.99);
}

.choice-icon {
  font-size: 1.35rem;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.choice-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  background-color: white;
  border-radius: var(--radius-sm);
  padding: 3px;
}

.choice-label {
  flex: 1;
  min-width: 0;
}

.choice-arrow {
  color: var(--color-text-subtle);
  font-size: 1.1rem;
  transition: transform var(--transition-fast);
}

.choice-btn:hover .choice-arrow {
  color: var(--color-primary);
  transform: translateX(3px);
}

.wizard-prompt-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.team-count-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
  background-color: var(--color-primary-light);
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* Search bar */
.search-top-bar {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.search-top-icon {
  position: absolute;
  left: 1rem;
  font-size: 0.95rem;
  color: var(--color-text-subtle);
  pointer-events: none;
}

.search-top-input {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1rem 0.75rem 2.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: 1rem; /* >=16px prevents iOS zoom on focus */
  font-family: inherit;
  background-color: var(--color-surface-muted);
  transition: all var(--transition-fast);
  color: var(--color-text-main);
}

.search-top-input:focus {
  outline: none;
  background-color: var(--color-surface);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgb(200 16 46 / 0.12);
}

.team-choice-btn {
  align-items: center;
}

/* Quick Search (club name) */
.quick-search {
  margin-bottom: 1.5rem;
}

.quick-search-label {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  color: var(--color-secondary);
  margin-bottom: 0.5rem;
}

.quick-search-bar {
  margin-bottom: 0.4rem;
}

.quick-search-hint {
  font-size: 0.8rem;
  color: var(--color-text-subtle);
  margin-bottom: 0.75rem;
  padding-left: 0.25rem;
}

.quick-search-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.25rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.spinner.spinner-sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
  margin: 0;
}

.qs-club {
  margin-top: 1rem;
}

.qs-club-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.qs-club-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.qs-club-name {
  font-weight: 800;
  color: var(--color-secondary);
  flex: 1;
  min-width: 0;
}

.wizard-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0 1.25rem;
  color: var(--color-text-subtle);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.wizard-divider::before,
.wizard-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: var(--color-border);
}

.team-choice-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.team-group-pill {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  background-color: var(--color-surface-hover);
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-full);
  display: inline-block;
}

.team-following-pill {
  background-color: var(--color-win-bg);
  color: var(--color-win);
}

.wizard-cancel-btn {
  margin-top: 0.875rem;
}

/* ==========================================================================
   TEAM DASHBOARD VIEW
   ========================================================================== */

/* Followed Teams Switcher */
.team-switcher {
  margin-bottom: 1rem;
}

.team-switcher-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.625rem;
}

.team-switcher-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-subtle);
}

/* Mobile: horizontally scrollable chips */
.team-switcher-list {
  list-style: none;
  display: flex;
  gap: 0.625rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  margin: 0 -1rem;
  padding: 0.25rem 1rem 0.5rem;
}

.team-switcher-list::-webkit-scrollbar {
  display: none;
}

@media (min-width: 640px) {
  .team-switcher-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    margin: 0;
    padding: 0;
  }
}

@media (min-width: 850px) {
  .team-switcher-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.team-slot {
  position: relative;
  min-width: 0;
  flex: 0 0 auto;
  width: 168px;
  scroll-snap-align: start;
}

@media (min-width: 640px) {
  .team-slot {
    width: auto;
  }
}

.team-slot-btn {
  width: 100%;
  height: 100%;
  min-height: 60px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
  padding: 0.55rem 2.1rem 0.55rem 0.6rem;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-main);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.team-slot-btn:hover {
  border-color: var(--color-text-subtle);
}

.team-slot.active .team-slot-btn {
  border-color: var(--color-primary);
  background-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px rgb(200 16 46 / 0.10);
}

.team-slot-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  background-color: white;
  border-radius: var(--radius-sm);
  padding: 3px;
  flex-shrink: 0;
}

.team-slot-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 100%;
  min-width: 0;
}

.team-slot-name {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.team-slot.active .team-slot-name {
  color: var(--color-primary);
}

.team-slot-name,
.team-slot-meta {
  max-width: 100%;
}

.team-slot-meta {
  font-size: 0.7rem;
  color: var(--color-text-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-slot-remove {
  position: absolute;
  top: 50%;
  right: 0.25rem;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--color-text-subtle);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.team-slot-remove:hover {
  background-color: var(--color-loss-bg);
  color: var(--color-loss);
}

.team-slot-add-btn {
  justify-content: center;
  padding-right: 0.6rem;
  border-style: dashed;
  background-color: transparent;
  box-shadow: none;
  color: var(--color-text-muted);
}

.team-slot-add-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.team-slot-plus {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 1.15rem;
  font-weight: 800;
  flex-shrink: 0;
}

.team-switcher-hint {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Team hero banner */
.team-banner {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0%, rgb(255 255 255 / 0.16), transparent 45%),
    linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 10px 30px rgb(200 16 46 / 0.22);
}

@media (min-width: 640px) {
  .team-banner {
    padding: 1.75rem 2rem;
    margin-bottom: 1.5rem;
  }
}

.team-profile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
}

@media (min-width: 640px) {
  .team-profile {
    gap: 1.25rem;
  }
}

.team-banner-logo {
  width: 60px;
  height: 60px;
  background-color: white;
  border-radius: var(--radius-md);
  padding: 6px;
  object-fit: contain;
  box-shadow: 0 6px 16px rgb(0 0 0 / 0.18);
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .team-banner-logo {
    width: 80px;
    height: 80px;
    border-radius: 18px;
  }
}

.team-banner-info {
  min-width: 0;
}

.team-banner-info h2 {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

@media (min-width: 640px) {
  .team-banner-info h2 {
    font-size: 1.85rem;
  }
}

.team-badge-pos {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background-color: rgb(255 255 255 / 0.18);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  color: white;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  margin-top: 0.5rem;
}

/* Goal Scorers (Last Match card) */
.scorers {
  margin: 0.25rem 0 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border-subtle);
}

.scorers-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-subtle);
  text-align: center;
  margin-bottom: 0.5rem;
}

.scorers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.scorers-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.scorer-item {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--color-text-main);
}

.scorers-list.away .scorer-item {
  flex-direction: row-reverse;
  text-align: right;
}

.scorer-icon {
  font-size: 0.7rem;
  flex-shrink: 0;
}

.scorer-minute {
  font-weight: 800;
  color: var(--color-secondary);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.scorer-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.goal-type {
  text-decoration: none;
  color: var(--color-text-subtle);
  font-size: 0.72rem;
  cursor: help;
}

/* Match Cards Grid */
.matches-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (min-width: 850px) {
  .matches-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
  }
}

.match-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--card-padding);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.match-card.hero-card {
  box-shadow: var(--shadow-md), inset 0 3px 0 var(--color-primary);
}

.match-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.match-card-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--color-secondary);
  letter-spacing: -0.01em;
}

.match-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.match-tag.countdown {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
}

.match-tag.win {
  background-color: var(--color-win-bg);
  color: var(--color-win);
}

.match-tag.draw {
  background-color: var(--color-draw-bg);
  color: var(--color-draw);
}

.match-tag.loss {
  background-color: var(--color-loss-bg);
  color: var(--color-loss);
}

/* Duel / Face-off display */
.duel-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: 0.5rem;
  text-align: center;
  margin: 0.75rem 0 1.25rem;
}

@media (min-width: 640px) {
  .duel-wrap {
    gap: 1rem;
  }
}

.duel-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.duel-team.my-team .duel-team-name {
  color: var(--color-primary);
  font-weight: 800;
}

.duel-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgb(0 0 0 / 0.08));
}

@media (min-width: 640px) {
  .duel-logo {
    width: 64px;
    height: 64px;
  }
}

.duel-team-name {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  max-width: 100%;
  overflow-wrap: break-word;
  hyphens: auto;
}

@media (min-width: 640px) {
  .duel-team-name {
    font-size: 0.92rem;
  }
}

.duel-role {
  font-size: 0.65rem;
  color: var(--color-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.duel-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding-top: 0.75rem;
}

@media (min-width: 640px) {
  .duel-center {
    padding-top: 1rem;
  }
}

.duel-vs {
  font-size: 0.85rem;
  font-weight: 900;
  color: var(--color-text-subtle);
  background-color: var(--color-surface-hover);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.duel-score {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--color-secondary);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  background-color: var(--color-surface-hover);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
}

@media (min-width: 640px) {
  .duel-score {
    font-size: 2rem;
  }
}

/* Very small phones: give team names more room */
@media (max-width: 399px) {
  .duel-wrap {
    gap: 0.375rem;
  }

  .duel-logo {
    width: 44px;
    height: 44px;
  }

  .duel-score {
    font-size: 1.4rem;
    padding: 0.35rem 0.55rem;
  }

  .duel-vs {
    width: 34px;
    height: 34px;
  }
}

/* Match Meta details */
.match-meta-list {
  background-color: var(--color-surface-muted);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.83rem;
  margin-top: auto;
}

.meta-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  color: var(--color-text-muted);
  min-width: 0;
}

.meta-row > span:last-child {
  min-width: 0;
  overflow-wrap: break-word;
}

.meta-row strong {
  color: var(--color-text-main);
  font-weight: 600;
}

.meta-icon {
  font-size: 0.95rem;
  flex-shrink: 0;
  line-height: 1.4;
}

.meta-link {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 24px;
}

.meta-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   SECTION CARDS & STANDINGS TABLE
   ========================================================================== */

.section-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--card-padding);
  box-shadow: var(--shadow-md);
  margin-bottom: 1rem;
}

@media (min-width: 640px) {
  .section-card {
    margin-bottom: 1.5rem;
  }
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  margin-bottom: 1rem;
}

.section-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-secondary);
  letter-spacing: -0.01em;
}

.table-responsive-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 calc(var(--card-padding) * -1);
}

.standings-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: center;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.standings-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

.standings-table th {
  padding: 0.6rem 0.3rem;
  font-weight: 700;
  color: var(--color-text-subtle);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--color-border);
  background-color: var(--color-surface);
}

.standings-table th:first-child,
.standings-table td:first-child {
  padding-left: var(--card-padding);
}

.standings-table th:last-child,
.standings-table td:last-child {
  padding-right: var(--card-padding);
}

.standings-table th.th-team {
  text-align: left;
}

.standings-table td {
  padding: 0.6rem 0.3rem;
  color: var(--color-text-main);
  border-bottom: 1px solid var(--color-border-subtle);
  background-color: var(--color-surface);
  transition: background-color var(--transition-fast);
}

.standings-table tbody tr:last-child td {
  border-bottom: none;
}

.standings-table tbody tr:hover td {
  background-color: var(--color-surface-muted);
}

.standings-table td.td-team {
  text-align: left;
}

.team-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.team-name-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 96px;
}

@media (min-width: 640px) {
  .standings-table th,
  .standings-table td {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

@media (min-width: 480px) {
  .team-name-cell {
    max-width: 220px;
  }
}

@media (min-width: 900px) {
  .team-name-cell {
    max-width: none;
  }
}

/* Keep the team column visible while scrolling horizontally on mobile */
.standings-table .th-pos,
.standings-table td.td-pos {
  position: sticky;
  left: 0;
  z-index: 1;
}

.standings-table .th-team,
.standings-table td.td-team {
  position: sticky;
  left: var(--pos-col-width);
  z-index: 1;
}

.standings-table td.td-pos {
  font-weight: 700;
  color: var(--color-text-subtle);
  width: var(--pos-col-width);
  min-width: var(--pos-col-width);
  text-align: left;
}

.standings-table th.th-pos {
  text-align: left;
  width: var(--pos-col-width);
  min-width: var(--pos-col-width);
}

.table-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}

.standings-table td.td-pts {
  font-weight: 800;
  color: var(--color-secondary);
  font-size: 0.92rem;
}

/* Optional columns (GF / GC) are hidden on narrow screens */
@media (max-width: 479px) {
  .standings-table .col-optional {
    display: none;
  }
}

/* User's team highlight row */
.standings-table tbody tr.my-team-row td {
  background-color: var(--color-primary-light);
  font-weight: 700;
}

.standings-table tbody tr.my-team-row:hover td {
  background-color: #ffe4e6;
}

.standings-table tbody tr.my-team-row td.td-pos {
  box-shadow: inset 3px 0 0 var(--color-primary);
  color: var(--color-primary);
}

.standings-table tbody tr.my-team-row td.td-team {
  color: var(--color-primary);
}

.badge-my-team {
  display: none;
  background-color: var(--color-primary);
  color: white;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
}

@media (min-width: 640px) {
  .badge-my-team {
    display: inline-block;
  }
}

/* ==========================================================================
   CALENDAR / FIXTURES VIEW
   ========================================================================== */

/* Segmented tabs */
.calendar-tabs {
  display: inline-flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  padding: 4px;
  background-color: var(--color-surface-hover);
  border-radius: var(--radius-full);
  width: 100%;
}

@media (min-width: 640px) {
  .calendar-tabs {
    width: auto;
  }

  .calendar-tabs .tab-btn {
    white-space: nowrap;
    padding: 0.5rem 1.1rem;
  }
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.5rem 0.75rem;
  min-height: 40px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: var(--color-text-main);
}

.tab-btn.active {
  background-color: var(--color-surface);
  color: var(--color-secondary);
  box-shadow: 0 1px 3px rgb(15 23 42 / 0.12);
}

.calendar-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Mobile: stacked scoreboard (home / away rows, score on the right) */
.fixture-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "date  date"
    "home  score"
    "away  score";
  align-items: center;
  column-gap: 0.75rem;
  row-gap: 0.35rem;
  background-color: var(--color-surface-muted);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.875rem;
  font-size: 0.85rem;
}

.fixture-item.highlight {
  background-color: var(--color-primary-light);
  border-color: var(--color-primary-border);
}

.fixture-date {
  grid-area: date;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-subtle);
}

.fixture-side {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.fixture-side.home {
  grid-area: home;
  flex-direction: row-reverse;
  justify-content: flex-end;
}

.fixture-side.away {
  grid-area: away;
}

/* Wider screens: classic home - score - away row */
@media (min-width: 640px) {
  .fixture-item {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas:
      "date date date"
      "home score away";
    padding: 0.75rem 1rem;
    column-gap: 1rem;
  }

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

  .fixture-side.home {
    flex-direction: row;
    text-align: right;
  }
}

.fixture-team-name {
  font-weight: 600;
  line-height: 1.25;
  min-width: 0;
  overflow-wrap: break-word;
  hyphens: auto;
}

.fixture-side.my-team .fixture-team-name {
  color: var(--color-primary);
  font-weight: 800;
}

.fixture-score {
  grid-area: score;
  font-weight: 800;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 56px;
  text-align: center;
  background: var(--color-surface);
  color: var(--color-secondary);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.fixture-score.pending {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-subtle);
  text-transform: uppercase;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 1.25rem 0 max(1.25rem, env(safe-area-inset-bottom));
  margin-top: auto;
  font-size: 0.78rem;
  color: var(--color-text-subtle);
  text-align: center;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

@media (min-width: 640px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
  }
}

.footer-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.footer-link:hover {
  text-decoration: underline;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
