﻿@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap");

/* ── View Transitions ── */
@view-transition {
  navigation: auto;
}

/* Content: fast crossfade */
::view-transition-old(page-content) {
  animation: vt-out 0.12s ease-out both;
}
::view-transition-new(page-content) {
  animation: vt-in 0.15s ease-out both;
}

@keyframes vt-out {
  to { opacity: 0; }
}
@keyframes vt-in {
  from { opacity: 0; }
}

/* ── Scroll Reveal ── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Ensure hidden attribute is never overridden by display rules ── */
[hidden] { display: none !important; }

/* ── Page entrance ── */
@keyframes page-enter {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Content area gets the view transition name */
.page-content {
  view-transition-name: page-content;
  padding-top: 56px;
  animation: page-enter 0.35s ease-out;
}
/* Calendar page: full-viewport layout */
[data-page="calendar"] .page-content {
  display: flex;
  flex-direction: column;
  height: 100vh;
}
[data-page="calendar"] .site-footer {
  display: none;
}

:root {
  /* ── Accent & brand ── */
  --accent: #00b4d8;
  --accent-soft: rgba(0, 180, 216, 0.10);
  --accent-hover: #0096c7;
  --navbar-bg: rgba(0, 150, 199, 0.95);
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --shadow: 0 2px 8px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  /* ── Level colours ── */
  --gold: #d4af37;
  --gold-bg: #fdf6e3;
  --silver: #8c92ac;
  --silver-bg: #eeeef4;
  --bronze: #cd7f32;
  --bronze-bg: #fdf0e2;
  --promises: #7b1fa2;
  --promises-bg: #f0e0f5;
  --national: #c62828;
  --national-bg: #fce4e4;
  --regional: #e65100;
  --regional-bg: #fdeee0;
  --c10k: #0077b6;
  --c10k-bg: #dff0fc;
  --c5k: #2e7d32;
  --c5k-bg: #e4f2e5;
  --c2k: #00838f;
  --c2k-bg: #ddf5f7;
  --veterans: #4e342e;
  --veterans-bg: #ebe5e2;
  --masters: #f57f17;
  --masters-bg: #fdf9e0;
  --international: #ad1457;
  --international-bg: #f9e0ea;
  --club: #99a6ad;
  --club-bg: #eaedee;
  /* ── Surface ── */
  --bg: #ffffff;
  --card-bg: #f4f6f9;
  --card-cats-bg: #eef1f5;
  --text: #0a0f1a;
  --text-light: #5a6172;
  --border: #d4d9e0;
  --section-hover: #f2f4f6;
  --filter: none;
}

[data-theme="dark"] {
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --accent-hover: #7dd3fc;
  --navbar-bg: rgba(78, 112, 180, 0.98);
  --gold-bg: #2e2814;
  --silver-bg: #22232c;
  --bronze-bg: #2e2414;
  --promises-bg: #221430;
  --national-bg: #2c1414;
  --regional-bg: #2e200c;
  --c10k-bg: #0c2030;
  --c5k-bg: #142214;
  --c2k-bg: #142224;
  --veterans-bg: #201814;
  --masters-bg: #2e280c;
  --international-bg: #2c1420;
  --club-bg: #181c1e;
  --bg: #0f1729;
  --card-bg: #182338;
  --card-cats-bg: #141e32;
  --text: #dce4ee;
  --text-light: #8a9ab4;
  --border: #243552;
  --section-hover: #1c2a42;
  --filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.15);
  --shadow: 0 2px 8px rgba(0,0,0,0.25), 0 1px 3px rgba(0,0,0,0.15);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3), 0 2px 6px rgba(0,0,0,0.2);
}

[data-theme="dark"] a,
[data-theme="dark"] a:visited {
  color: #f8fafc;
}

[data-theme="dark"] a:hover,
[data-theme="dark"] a:focus {
  color: #ffffff;
}

[data-theme="dark"] .card-links a {
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
}
[data-theme="dark"] .card-links a:hover {
  background: rgba(56, 189, 248, 0.28);
}

.leaflet-layer,
.leaflet-control-zoom-in,
.leaflet-control-zoom-out,
.leaflet-control-attribution {
  filter: var(--filter);
}

.padel-marker {
  background: none !important;
  border: none !important;
}

.leaflet-popup-content-wrapper {
  background: var(--card-bg);
  border-radius: var(--radius) !important;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: var(--shadow-md) !important;
}

.leaflet-popup-content-wrapper .card-name,
.leaflet-popup-content-wrapper .card-detail,
.leaflet-popup-content-wrapper .card-detail span,
.leaflet-popup-content-wrapper .card-zones-label {
  color: var(--text) !important;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Visually hidden – accessible to screen readers and search engines */
.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;
}

body {
  font-family:
    "Inter",
    -apple-system,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ── Navbar ── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  background: linear-gradient(135deg, #0096c7, #00b4a0);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(0,180,216,0.3);
  color: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
  transition: transform 0.25s ease;
}
.navbar.navbar-hidden {
  transform: translateY(-100%);
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.3px;
  flex-shrink: 0;
}
.navbar-brand:visited { color: #fff; }
.navbar-brand-logo {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}
.navbar-brand-text {
  color: #fff;
  -webkit-text-fill-color: #fff;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.78rem;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.nav-link:visited { color: rgba(255, 255, 255, 0.65); }
.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 #fff;
}
.nav-link-icon {
  display: flex;
  align-items: center;
}
.nav-link-icon svg {
  width: 16px;
  height: 16px;
}
.nav-link-label {}

.nav-sep {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
  margin: 0 1rem;
}

/* Profile icon */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}
.nav-profile-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  overflow: hidden;
}
.nav-profile-btn:visited { color: rgba(255, 255, 255, 0.8); }
.nav-profile-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  transform: scale(1.08);
}
.nav-profile-btn.active {
  background: rgba(255, 255, 255, 0.2);
  border-color: #fff;
  color: #fff;
}
.nav-profile-btn svg {
  width: 18px;
  height: 18px;
}
.nav-profile-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.stats-bar-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-light);
  letter-spacing: 0.3px;
  font-weight: 500;
}
.stat-num-inline {
  font-weight: 800;
  color: var(--accent);
}
.stat-sep {
  color: var(--text-light);
  opacity: 0.4;
}

.container {
  max-width: 100%;
  margin: 0 0 1.5rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-height: 0;
}

/* Filters toggle (mobile only) */
.filters-toggle-btn {
  display: none;
}

/* ── Filters top bar ── */
.filters-top {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 0.75rem 100px;
  background: var(--bg);
}

.data-updated {
  font-size: 0.72rem;
  color: var(--text-light);
  opacity: 0.5;
  padding: 0.25rem 100px 0;
  text-align: right;
  margin-right: 0.75rem;
}
.data-updated-mobile {
  display: none;
}

.filters-section--inline {
  flex: 1 1 0;
  min-width: 0;
}
.filters-section--inline .search-input {
  min-width: 150px;
  width: 100%;
}
.filters-section--dates {
  flex: 0 0 auto;
}
.filters-section--cats {
  flex: 0 1 auto;
  min-width: 0;
}
/* Filter container cards */
.filter-container {
  background: var(--card-bg);
  border: none;
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  box-shadow: var(--shadow-sm);
}
.filters-section--view {
  background: none;
  box-shadow: none;
  padding: 0;
}
.filter-container-title {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-light);
  margin-bottom: 0.4rem;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-input-icon {
  position: absolute;
  left: 0.6rem;
  color: var(--text-light);
  pointer-events: none;
  flex-shrink: 0;
}

.search-input.search-input--icon {
  padding-left: 2.4rem;
}

.filter-inline-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.filter-inline-icon {
  color: var(--text-light);
  flex-shrink: 0;
}

/* Map toggle bar (mobile only) */
.map-toggle-bar {
  display: none;
}

/* ── Main row: map left + tournaments right ── */
.main-row {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  padding: 0 100px;
  background: var(--bg);
  gap: 0.75rem;
}
.map-column {
  width: 40%;
  min-width: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  transition: width 0.35s ease, margin-left 0.35s ease;
  overflow: hidden;
}
.map-column.map-hidden {
  width: 0;
  margin-left: 0;
}
/* Reopen button (visible when map is collapsed) */
.map-reopen-btn {
  display: none;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: var(--accent);
  border: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.75rem 0.4rem;
  cursor: pointer;
  color: #fff;
  transition: background 0.15s;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  box-shadow: var(--shadow);
}
.map-reopen-btn:hover {
  background: var(--accent-hover);
  color: #fff;
}
.map-reopen-btn .map-reopen-label {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}
.map-column.map-hidden ~ .map-reopen-btn {
  display: flex;
}
.tournaments-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --- Map --- */
.map-section {
  background: var(--card-bg);
  border-right: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
/* Action buttons overlaid on map */
.map-action-btn {
  position: absolute;
  left: 11px;
  z-index: 800;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-light);
  box-shadow: var(--shadow);
  transition: background 0.15s, color 0.15s;
}
.map-action-btn:hover {
  background: var(--section-hover);
  color: var(--accent);
}
#mapFitBtn {
  top: 80px;
}
#mapToggle {
  top: 118px;
}

#mapContainer {
  flex: 1;
  min-height: 0;
}

/* --- Filters --- */
.filters-section {
  background: transparent;
  border-radius: var(--radius);
  padding: 0;
  border: none;
}
.filters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.filters-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-light);
}
.filters-clear {
  font-size: 0.7rem;
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  border: none;
  background: none;
  font-family: inherit;
  display: none;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
}
.filters-clear:hover {
  background: var(--c10k-bg);
}
.filters-clear.visible {
  display: inline-block;
}
.search-input {
  background: var(--bg);
  color: var(--text);
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.filters-hint {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-bottom: 0.6rem;
  font-style: italic;
  opacity: 0.7;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.filter-btn {
  padding: 0.3rem 0.75rem;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.filter-btn:hover {
  background: var(--card-cats-bg);
  color: var(--accent);
}
.filter-btn.active {
  color: white;
  border-color: transparent;
  box-shadow: none;
}
.filter-btn[data-level="all"].active {
  background: #1a1a2e;
}
.filter-btn[data-level="absolutos"].active {
  background: var(--accent-hover);
}
.filter-btn[data-level="veteranos"].active {
  background: #4e342e;
}
.filter-btn[data-level="jovens"].active {
  background: #7b1fa2;
}
.filter-btn[data-level="fip-gold"].active {
  background: var(--gold);
  color: #333;
}
.filter-btn[data-level="fip-only"].active {
  background: var(--gold);
  color: #333;
}
.filter-btn[data-level="fip-silver"].active {
  background: var(--silver);
}
.filter-btn[data-level="fip-bronze"].active {
  background: var(--bronze);
}
.filter-btn[data-level="fip-promises"].active {
  background: var(--promises);
}
.filter-btn[data-level="national"].active {
  background: var(--national);
}
.filter-btn[data-level="regional"].active {
  background: var(--regional);
}
.filter-btn[data-level="c10k"].active {
  background: var(--c10k);
}
.filter-btn[data-level="c5k"].active {
  background: var(--c5k);
}
.filter-btn[data-level="c2k"].active {
  background: var(--c2k);
}
.filter-btn[data-level="veterans"].active {
  background: var(--veterans);
}
.filter-btn[data-level="masters"].active {
  background: var(--masters);
  color: #333;
}
.filter-btn[data-level="international"].active {
  background: var(--international);
}
.filter-btn[data-level="club"].active {
  background: var(--club);
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100% !important;
  padding: 0.5rem 2rem 0.5rem 0.75rem !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  background-color: var(--bg) !important;
  color: var(--text) !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 20px !important;
  cursor: pointer !important;
}

[data-theme="light"] select {
  background-image: url('data:image/svg+xml;utf8,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6 9L12 15L18 9" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke="%231a1a2e"/></svg>') !important;
}
[data-theme="dark"] select {
  background-image: url('data:image/svg+xml;utf8,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6 9L12 15L18 9" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke="%23f1f5f9"/></svg>') !important;
}

.count-badge {
  display: inline-block;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 50px;
  padding: 0 0.35rem;
  font-size: 0.65rem;
  margin-left: 0.3rem;
  font-weight: 600;
}
.filter-btn.active .count-badge {
  background: rgba(255, 255, 255, 0.25);
}

/* --- Tournaments scroll container --- */
.tournaments-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
  min-height: 0;
}

/* --- Month nav buttons --- */
.month-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-light);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  padding: 0;
  box-shadow: var(--shadow-sm);
}
.month-nav-btn:hover {
  background: var(--card-cats-bg);
  color: var(--accent);
}
.month-nav-btn svg {
  width: 13px;
  height: 13px;
}

/* --- Tournaments --- */
.month-section {
  margin-bottom: 1rem;
  padding: 0 0.75rem;
  scroll-margin-top: 0;
}
.month-header {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--card-cats-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: -0.3px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
}
.month-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.month-header-arrows {
  display: flex;
  gap: 0.25rem;
}
.month-header .month-count {
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.1rem 0.5rem;
  border-radius: 50px;
}
.month-section.hidden {
  display: none;
}

.tournament-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
  transition: grid-template-columns 0.3s ease;
}

/* In grid mode (default): show list icon, hide grid icon */
.view-icon-grid { display: none; }
.view-icon-list { display: block; }
/* In list mode: show grid icon, hide list icon */
.view-list .view-icon-grid { display: block; }
.view-list .view-icon-list { display: none; }

/* List view: single column */
.view-list .tournament-grid {
  grid-template-columns: 1fr;
}

/* --- View toggle button --- */
.view-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border: none;
  border-radius: 8px;
  padding: 0.8rem;
  cursor: pointer;
  color: var(--accent);
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}
.view-toggle-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* Card layout animation on view switch */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  border: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.3s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

/* View switch animation */
.view-switching .card {
  animation: viewFade 0.35s ease;
}
@keyframes viewFade {
  0%   { opacity: 0; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1); }
}
.card-bg-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0.3;
  pointer-events: none;
  z-index: 0;
}
.card-bg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--card-bg);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}
.card > *:not(.card-bg-image):not(.card-bg-overlay) {
  position: relative;
  z-index: 1;
}
[data-theme="dark"] .card-bg-image {
  opacity: 0.3;
}
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  z-index: 2;
  border-radius: var(--radius) 0 0 var(--radius);
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card.hidden {
  display: none;
}

.card[data-level="fip-gold"]::before {
  background: var(--gold);
}
.card[data-level="fip-silver"]::before {
  background: var(--silver);
}
.card[data-level="fip-bronze"]::before {
  background: var(--bronze);
}
.card[data-level="fip-promises"]::before {
  background: var(--promises);
}
.card[data-level="national"]::before {
  background: var(--national);
}
.card[data-level="regional"]::before {
  background: var(--regional);
}
.card[data-level="c10k"]::before {
  background: var(--c10k);
}
.card[data-level="c5k"]::before {
  background: var(--c5k);
}
.card[data-level="c2k"]::before {
  background: var(--c2k);
}
.card[data-level="veterans"]::before {
  background: var(--veterans);
}
.card[data-level="masters"]::before {
  background: var(--masters);
}
.card[data-level="international"]::before {
  background: var(--international);
}
.card[data-level="club"]::before {
  background: var(--club);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}
.card-name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
  flex: 1;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 50px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-fip-gold {
  background: var(--gold-bg);
  color: #8b7000;
}
.badge-fip-silver {
  background: var(--silver-bg);
  color: #4a4e69;
}
.badge-fip-bronze {
  background: var(--bronze-bg);
  color: #8b5e20;
}
.badge-fip-promises {
  background: var(--promises-bg);
  color: var(--promises);
}
.badge-national {
  background: var(--national-bg);
  color: var(--national);
}
.badge-regional {
  background: var(--regional-bg);
  color: var(--regional);
}
.badge-c10k {
  background: var(--c10k-bg);
  color: var(--c10k);
}
.badge-c5k {
  background: var(--c5k-bg);
  color: var(--c5k);
}
.badge-c2k {
  background: var(--c2k-bg);
  color: var(--c2k);
}
.badge-veterans {
  background: var(--veterans-bg);
  color: var(--veterans);
}
.badge-masters {
  background: var(--masters-bg);
  color: #9e6d00;
}
.badge-international {
  background: var(--international-bg);
  color: var(--international);
}
.badge-club {
  background: var(--club-bg);
  color: var(--club);
}

.badge-abs {
  background: #e0f2fe;
  color: #0277bd;
}
.badge-vet {
  background: #efebe9;
  color: #5d4037;
}
.badge-juv {
  background: #f3e5f5;
  color: #7b1fa2;
}

.badge-split {
  padding: 0;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  border-radius: 50px;
  border: 1px solid currentColor;
  background: transparent;
}

.badge-prefix {
  padding: 0.15rem 0.4rem;
  background: currentColor;
  border-radius: 0 50px 50px 0;
}

.badge-prefix > span {
  color: #fff;
}

.badge-value {
  padding: 0.15rem 0.4rem;
}

.card-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text);
}
.card-detail {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.card-detail svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.6;
}



.fip-points {
  display: inline-block;
  background: #fff3e0;
  color: #e65100;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.2px;
}
.card[data-level="fip-gold"] .fip-points {
  background: var(--gold-bg);
  color: #8b7000;
}
.card[data-level="fip-silver"] .fip-points {
  background: var(--silver-bg);
  color: #4a4e69;
}
.card[data-level="fip-bronze"] .fip-points {
  background: var(--bronze-bg);
  color: #8b5e20;
}
.card[data-level="c10k"] .fip-points {
  background: var(--c10k-bg);
  color: var(--c10k);
}
.card[data-level="c5k"] .fip-points {
  background: var(--c5k-bg);
  color: var(--c5k);
}
.card[data-level="c2k"] .fip-points {
  background: var(--c2k-bg);
  color: var(--c2k);
}
.card[data-level="veterans"] .fip-points {
  background: var(--veterans-bg);
  color: var(--veterans);
}
.card[data-level="masters"] .fip-points {
  background: var(--masters-bg);
  color: #9e6d00;
}
.card[data-level="national"] .fip-points {
  background: var(--national-bg);
  color: var(--national);
}
.card[data-level="regional"] .fip-points {
  background: var(--regional-bg);
  color: var(--regional);
}
.card[data-level="fip-promises"] .fip-points {
  background: var(--promises-bg);
  color: var(--promises);
}

.card-cats {
  margin-top: 0.4rem;
  font-size: 0.7rem;
  color: var(--text-light);
  background: var(--card-cats-bg);
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.4rem;
}

.card-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.card-tag-prize {
  background: #ecfdf5;
  color: #047857;
}

.card-tag-sym {
  font-weight: 700;
  opacity: 0.7;
}

.card-tag-cats {
  background: var(--card-cats-bg);
  color: var(--text-light);
  font-weight: 500;
}

.card-tag-svg {
  width: 11px;
  height: 11px;
  opacity: 0.6;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1.5rem;
  margin-bottom: 0.3rem;
}

.card-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.15);
  color: #0369a1;
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 600;
  transition: background 0.15s;
}

.card-links a:hover {
  background: rgba(59, 130, 246, 0.28);
  text-decoration: underline;
}

.card-links a svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.card-zones {
  margin-top: 0.25rem;
}

.card-zones-label {
  font-weight: 600;
  margin-right: 0.25rem;
}

.card-zones-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.35rem;
  margin-top: 0.2rem;
}

.card-zones-links a {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.12);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 500;
  transition: background 0.15s;
}

.card-zones-links a:hover {
  background: rgba(59, 130, 246, 0.25);
  text-decoration: underline;
}

.card-footer-details {
  margin-top: auto;
  padding-top: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-light);
}

.card-status-bar {
  min-height: 20px;
  margin: 0.55rem -1rem -0.9rem;
  border-radius: 0 0 var(--radius) var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.card-status-live {
  background: var(--c10k);
  color: #ffffff;
}

.card-status-finished {
  background: var(--c5k);
  color: #ffffff;
}

.no-results {
  text-align: center;
  padding: 3rem;
  color: var(--text-light);
  font-size: 1.1rem;
  display: none;
}

/* --- Leaflet popup --- */
.popup-tournament {
  margin-bottom: 0.6rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid #eee;
}
.popup-tournament:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.popup-name {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
  color: #1a1a2e;
}
.popup-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 0.25rem;
}
.popup-detail {
  font-size: 0.75rem;
  color: #6b7280;
  line-height: 1.4;
}
.popup-prize {
  color: #047857;
  font-weight: 600;
}
.popup-scroll {
  max-height: none;
  overflow: visible;
  padding-right: 0.15rem;
}
.popup-cards {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 320px;
}
.leaflet-popup-content .popup-card {
  margin: 0;
}
.leaflet-popup-content .popup-card:hover {
  transform: none;
}
.leaflet-popup-content {
  min-width: 340px;
  max-width: 420px;
  overflow: visible;
}

.theme-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--card-bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: all 0.2s;
  z-index: 1000;
}
.theme-toggle:hover {
  box-shadow: var(--shadow-md);
}
.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: var(--text);
}

.calc-layout {
  max-width: 100%;
  margin: 0;
  padding: 1rem 1.5rem;
}
.calc-card {
  background: var(--card-bg);
  border: none;
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}
.calc-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.calc-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
}
.calc-result {
  margin-top: 0.8rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  border: none;
  background: var(--card-cats-bg);
}
.calc-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
}
/* ── Calculator tabs (Absolutos / Jovens / Veteranos) ── */
.source-toggle--wide {
  max-width: none;
  margin-bottom: 1rem;
}

.calc-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.calc-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}
.calc-table th,
.calc-table td {
  border: 1px solid var(--border);
  padding: 0.6rem 0.7rem;
  text-align: center;
  font-size: 0.86rem;
}
.calc-table th:first-child,
.calc-table td:first-child {
  text-align: left;
  font-weight: 600;
  min-width: 150px;
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--card-bg);
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.06);
}
.calc-table thead th {
  background: var(--card-cats-bg);
  color: var(--text);
}
.calc-table thead th:first-child {
  background: var(--card-cats-bg);
  z-index: 2;
}

.rankings-layout {
  max-width: 100%;
}

.rankings-table {
  min-width: 1080px;
}

.rankings-table th,
.rankings-table td {
  white-space: nowrap;
}

.rankings-table th:first-child,
.rankings-table td:first-child {
  min-width: 6ch;
  width: 6ch;
  max-width: 6ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rankings-table th:nth-child(4),
.rankings-table td:nth-child(4),
.rankings-table th:nth-child(6),
.rankings-table td:nth-child(6) {
  text-align: left;
}

.rankings-table tbody tr:nth-child(even) {
  background: var(--card-cats-bg);
}

.rankings-table tbody tr:hover {
  background: var(--section-hover);
}

.rankings-table a,
.rankings-table a:visited,
.rankings-table a:hover,
.rankings-table a:focus {
  color: inherit;
}

.rankings-table th:last-child,
.rankings-table td:last-child {
  display: none;
}

.rankings-pagination {
  margin-top: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
}

.rankings-page-info {
  font-size: 0.82rem;
  color: var(--text-light);
  min-width: 95px;
  text-align: center;
}

.rankings-filters {
  display: grid;
  grid-template-columns: minmax(280px, 1.6fr) repeat(2, minmax(160px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}

.rankings-filters #rankingsSource {
  display: flex;
  max-width: none;
}

.rankings-filters #rankingsSearch {
  grid-column: 1; /* force to start of the second row */
}

.rankings-filters > :not(#rankingsSource) {
  min-width: 0;
}

/* ── Searchable select ── */
.searchable-select {
  position: relative;
  min-width: 0;
}

.searchable-select > input {
  padding-right: 2rem;
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 20px;
}

[data-theme="light"] .searchable-select > input {
  background-image: url('data:image/svg+xml;utf8,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6 9L12 15L18 9" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke="%231a1a2e"/></svg>');
}
[data-theme="dark"] .searchable-select > input {
  background-image: url('data:image/svg+xml;utf8,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6 9L12 15L18 9" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke="%23f1f5f9"/></svg>');
}

.searchable-select-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 220px;
  overflow-y: auto;
  margin-top: 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.searchable-select-dropdown.visible {
  display: block;
}

.searchable-select-option {
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text);
}

.searchable-select-option:hover {
  background: var(--accent-soft);
}

.searchable-select-option.selected {
  background: var(--accent-soft);
  font-weight: 600;
}

.rank-fip-filters {
  grid-template-columns: minmax(280px, 1.6fr) repeat(2, minmax(180px, 1fr));
}

.rank-fip-filters #rankingsSource {
  grid-column: 1 / -1;
}

/* ── Source toggle ── */
.source-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 280px;
}

.source-toggle-btn {
  flex: 1;
  padding: 0.45rem 1.1rem;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  border: none;
  cursor: pointer;
  background: var(--bg);
  color: var(--text-light);
  transition: background 0.15s, color 0.15s;
}

.source-toggle-btn:not(:last-child) {
  border-right: 1px solid var(--border);
}

.source-toggle-btn:hover {
  background: var(--accent-soft);
}

.source-toggle-btn.active {
  background: var(--accent);
  color: #fff;
}

.rank-fip-layout {
  max-width: 900px;
  margin: 0 auto;
}

.rank-fip-table {
  min-width: 600px;
}

.rank-fip-table th,
.rank-fip-table td {
  white-space: nowrap;
}

.rank-fip-table th:first-child,
.rank-fip-table td:first-child {
  min-width: 6ch;
  width: 6ch;
  max-width: 6ch;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.rank-fip-table th:nth-child(2),
.rank-fip-table td:nth-child(2) {
  text-align: left;
}

.rank-fip-table tbody tr:nth-child(even) {
  background: var(--card-cats-bg);
}

.rank-fip-table tbody tr:hover {
  background: var(--section-hover);
}

.rank-fip-photo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
}

.rank-fip-name-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.rank-fip-flag {
  font-size: 1.15em;
  vertical-align: middle;
  margin-right: 0.3em;
}

@media (max-width: 600px) {
  /* Navbar mobile */
  .nav-hamburger {
    display: flex;
  }
  .nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    flex-direction: column;
    padding: 0.5rem 1rem 1rem;
    background: linear-gradient(135deg, #0096c7, #00b4a0);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    gap: 0.15rem;
    animation: nav-slide-down 0.25s ease-out;
  }
  .nav-links.open {
    display: flex;
  }
  @keyframes nav-slide-down {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .nav-link {
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
    border-radius: 8px;
  }
  .nav-link-icon svg {
    width: 18px;
    height: 18px;
  }
  .navbar-brand-text {
    font-size: 0.95rem;
  }

  .tournament-grid {
    grid-template-columns: 1fr;
  }
  .filters-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--card-bg);
    border: none;
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    font-family: inherit;
  }
  .filters-toggle-btn:hover {
    color: var(--text);
  }
  .filters-toggle-btn.open,
  .filters-toggle-btn.open:hover {
    background: var(--accent);
    color: #fff;
  }
  .filters-toggle-btn.open .filters-toggle-chevron {
    transform: rotate(180deg);
  }
  .filters-top {
    flex-direction: column;
    padding: 0 0.75rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.35s ease;
  }
  .filters-top.filters-open {
    max-height: 500px;
    opacity: 1;
    padding: 0.5rem 0.75rem;
  }
  .filters-section--inline,
  .filters-section--dates,
  .filters-section--cats {
    width: 100%;
  }
  .filters-section--view {
    display: none;
  }
  .data-updated {
    display: none;
  }
  .data-updated-mobile {
    display: block;
  }
  /* Calendar page: natural scroll on mobile */
  [data-page="calendar"] .page-content {
    height: auto;
    overflow: visible;
  }
  .container {
    flex: none;
  }
  .data-updated {
    padding: 0.25rem 0.75rem 0;
    margin-right: 0;
  }
  .main-row {
    flex-direction: column;
    height: auto;
    flex: none;
    padding: 0;
    overflow: visible;
  }
  .map-toggle-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--card-bg);
    border: none;
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    font-family: inherit;
  }
  .map-toggle-bar:hover {
    color: var(--text);
  }
  .map-toggle-bar.open,
  .map-toggle-bar.open:hover {
    background: var(--accent);
    color: #fff;
  }
  .map-toggle-bar.open .map-toggle-bar-chevron {
    transform: rotate(180deg);
  }
  .map-column {
    width: 100% !important;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    flex-shrink: 0;
    transition: max-height 0.35s ease, opacity 0.25s ease;
  }
  .map-column.map-visible-mobile {
    max-height: 300px;
    opacity: 1;
  }
  .map-column.map-visible-mobile .map-section {
    height: 250px;
  }
  .map-column.map-visible-mobile #mapContainer {
    height: 250px;
  }
  .map-column.map-hidden {
    max-height: 0;
    opacity: 0;
    width: 100% !important;
  }
  .map-action-btn {
    display: none;
  }
  .map-reopen-btn {
    display: none !important;
  }
  .tournaments-column {
    flex: none;
    overflow: visible;
  }
  .tournaments-scroll {
    height: auto;
    overflow: visible;
  }
  .theme-toggle {
    bottom: 0.8rem;
    right: 0.8rem;
    width: 40px;
    height: 40px;
  }
  .calc-grid {
    grid-template-columns: 1fr;
  }
  .rankings-filters {
    grid-template-columns: 1fr;
  }
  .profile-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Profile page ── */
.profile-layout {
  max-width: 720px;
  margin: 0 auto;
}

.profile-card {
  margin-bottom: 1.5rem;
}

.profile-section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.profile-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0;
}

.profile-heading-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.profile-share-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, color 0.2s;
  box-shadow: var(--shadow-sm);
}

.profile-share-btn:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.profile-share-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.profile-share-btn.copied {
  color: var(--c5k);
  box-shadow: 0 0 0 2px var(--c5k-bg);
}

.profile-subtitle {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 0.6rem;
}

.profile-subtitle--spaced {
  margin-top: 1rem;
}

.profile-source-row {
  margin-bottom: 0.8rem;
  max-width: 280px;
}

.profile-search-wrapper {
  position: relative;
  margin-bottom: 0.8rem;
}

.profile-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: none;
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 320px;
  overflow-y: auto;
  z-index: 100;
  list-style: none;
  margin: 0;
  padding: 0;
  box-shadow: var(--shadow-md);
}

.profile-result-item {
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

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

.profile-result-item:hover {
  background: var(--section-hover);
}

.profile-result-item.profile-no-result {
  cursor: default;
  color: var(--text-light);
  font-style: italic;
}

.profile-result-item.profile-no-result:hover {
  background: transparent;
}

.profile-result-name {
  font-weight: 600;
  font-size: 0.88rem;
}

.profile-result-meta {
  font-size: 0.75rem;
  color: var(--text-light);
}

.profile-info {
  margin-bottom: 0.8rem;
}

/* Profile header row (image + name/club) */
.profile-header-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.profile-image-wrapper {
  flex-shrink: 0;
}
.profile-image {
  width: 90px;
  height: 90px;
  border-radius: var(--radius);
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}
.profile-header-details {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.profile-header-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.profile-header-club {
  font-size: 0.85rem;
  color: var(--text-light);
}

.profile-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.profile-detail {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.profile-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
}

.profile-value {
  font-size: 0.95rem;
  font-weight: 500;
}

.profile-highlight {
  font-weight: 700;
  color: var(--accent-hover);
}

.profile-clear-btn {
  font-size: 0.75rem;
  margin: 0;
  padding: 0.3rem 0.7rem;
}

.profile-levels {
  margin-top: 1rem;
}

.profile-levels-table-wrapper {
  overflow-x: auto;
}

.profile-levels-table {
  min-width: 380px;
}

.profile-level-reached {
  color: #2e7d32;
  font-weight: 600;
}

.profile-level-needed {
  color: var(--text-light);
}

.profile-level-row-reached td {
  background: rgba(46, 125, 50, 0.12);
  color: #2e7d32;
  font-weight: 600;
}

.profile-level-row-reached td:first-child {
  background: rgba(46, 125, 50, 0.12);
}

.profile-summary {
  margin-top: 1rem;
}

.profile-playable-levels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.profile-playable-badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
}

.profile-playable-none {
  color: var(--national);
  font-weight: 500;
  font-size: 0.88rem;
  padding: 0.4rem 0;
}

/* ── Tournaments page ── */
.tournaments-layout {
  max-width: 100%;
}

.tournaments-filters {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.6rem;
  margin-bottom: 1rem;
  align-items: end;
}

.tournaments-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.tournaments-section-title--dropdown {
  margin-top: 1.5rem;
  color: var(--regional);
}

/* ---------- Tournaments table (standalone – no .calc-table dependency) ---------- */
.tournaments-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.tournaments-table th,
.tournaments-table td {
  border: 1px solid var(--border);
  padding: 0.6rem 0.7rem;
  text-align: center;
  font-size: 0.86rem;
  white-space: nowrap;
}

.tournaments-table thead th {
  background: var(--card-cats-bg);
  color: var(--text);
}

.tournaments-table thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
}

.tournaments-table td[rowspan] {
  vertical-align: middle;
}

/* Alternating pair backgrounds (every 2 rows share the same color) */
.tournaments-table tbody tr:nth-child(4n+3),
.tournaments-table tbody tr:nth-child(4n+4) {
  background: var(--card-cats-bg);
}

/* Sticky first column */
.tournaments-table tbody td:first-child {
  text-align: center;
  font-weight: 600;
  min-width: 100px;
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--card-bg);
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.06);
}

/* The second row of each pair has no ranking <td> (it uses rowspan from the
   first row), so td:first-child is actually the player-name cell.  Reset the
   sticky behaviour so the name doesn't float over the ranking column. */
.tournaments-table tbody tr.pair-row-second td:first-child {
  position: static;
  min-width: auto;
  background: transparent;
  box-shadow: none;
}

/* Sticky column must match the alternating pair background */
.tournaments-table tbody tr:nth-child(4n+3) td:first-child,
.tournaments-table tbody tr:nth-child(4n+4) td:first-child {
  background: var(--card-cats-bg);
}

/* Hover highlights the entire pair (including sticky column) */
.tournaments-table tbody tr.pair-row-first:hover,
.tournaments-table tbody tr.pair-row-first:hover + tr.pair-row-second {
  background: var(--section-hover);
}
.tournaments-table tbody tr.pair-row-first:hover td:first-child,
.tournaments-table tbody tr.pair-row-first:hover + tr.pair-row-second td:first-child {
  background: var(--section-hover);
}

.tournaments-table tbody tr.pair-row-second:hover {
  background: var(--section-hover);
}
.tournaments-table tbody tr.pair-row-second:hover td:first-child {
  background: var(--section-hover);
}

.tournaments-sortable {
  cursor: pointer;
  user-select: none;
}

.tournaments-sortable:hover {
  color: var(--accent);
}

/* ── Rank-status badges (Quadro / Possível qualy / qualy) ── */
.rank-status {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
.rank-quadro {
  color: #2e7d32;
}
.rank-possible-qualy {
  color: #f9a825;
}
.rank-qualy {
  color: #e65100;
}
[data-theme="dark"] .rank-quadro {
  color: #66bb6a;
}
[data-theme="dark"] .rank-possible-qualy {
  color: #fdd835;
}
[data-theme="dark"] .rank-qualy {
  color: #ff9800;
}

/* ── Tournaments notice ── */
.tournaments-notice {
  margin-top: 0.3rem;
}
.tournaments-notice a {
  color: inherit;
  text-decoration: underline;
}

.tournaments-share-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--card-bg);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, color 0.2s;
  align-self: end;
  box-shadow: var(--shadow-sm);
}

.tournaments-share-btn:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.tournaments-share-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.tournaments-share-btn.copied {
  color: var(--c5k);
  box-shadow: 0 0 0 2px var(--c5k-bg);
}

@media (max-width: 600px) {
  .tournaments-filters {
    grid-template-columns: 1fr auto;
  }

  .tournaments-filters select:first-child {
    grid-column: 1 / -1;
  }
}

/* ── Inline-style replacements ── */

.period-filter-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.period-filter-select {
  width: auto;
  flex: 1;
  min-width: 120px;
}

.period-filter-separator {
  color: var(--text-light);
  font-size: 0.8rem;
}

.filters-header--tight {
  margin-bottom: 0.9rem;
}

.filters-hint--flush {
  margin: 0.25rem 0 0;
}

.filters-hint--flush-bottom {
  margin: 0 0 0.3rem;
}

.filters-hint--flush-bottom-lg {
  margin: 0 0 0.6rem;
}

.calc-grid--spaced {
  margin-bottom: 1rem;
}

/* ── Site footer ── */

.site-footer {
  text-align: center;
  padding: 1.2rem 1rem;
  color: var(--text-light);
  font-size: 0.7rem;
  border-top: 1px solid var(--border);
  margin-top: 1.5rem;
  line-height: 1.6;
}

.site-footer a {
  color: var(--text-light);
  text-decoration: none;
  font-weight: 500;
}

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

.site-footer .footer-built-by {
  margin-top: 0.25rem;
}

/* ── About page ── */
.about-layout {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.about-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 1.25rem;
}

.about-card-icon {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.about-card-icon svg {
  width: 22px;
  height: 22px;
}

.about-card-icon--credits {
  background: #e25555;
}

.about-credits {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-light);
  opacity: 0.6;
  margin-top: 0.5rem;
}

.about-credits a {
  color: var(--text-light);
  text-decoration: underline;
  text-decoration-color: var(--text-light);
  text-underline-offset: 2px;
}

.about-credits a:hover {
  color: var(--text);
}

.about-card-body {
  flex: 1;
  min-width: 0;
}

.about-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.about-text {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

.about-github-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1.1rem;
  background: var(--card-cats-bg);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.2s;
}

.about-github-link:hover {
  background: var(--section-hover);
}

.about-github-link svg {
  flex-shrink: 0;
}

