/* ============================================
   PadelThailand.com — Dark/Light Neutral Theme
   Organizer colors come from Google Sheet data
   ============================================ */

/* ---- Design Tokens ---- */
:root {
  /* Spacing scale (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Transitions */
  --transition: 0.2s ease;
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Elevation / Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.16);
  --shadow-xl: 0 12px 36px rgba(0,0,0,0.2);

  /* Typography scale */
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --text-2xl: 24px;

  /* Focus ring */
  --focus-ring: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--focus-color);
}

/* ---- Theme Variables ---- */
[data-theme="dark"] {
  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #242424;
  --bg-hover: #2e2e2e;
  --border: #333;
  --text-primary: #f0f0f0;
  --text-secondary: #aaa;
  --text-muted: #888;
  --header-bg: rgba(15, 15, 15, 0.88);
  --shadow: var(--shadow-md);
  --focus-color: #6b9fff;
}

[data-theme="light"] {
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #eaeaea;
  --bg-hover: #e0e0e0;
  --border: #ddd;
  --text-primary: #1a1a1a;
  --text-secondary: #555;
  --text-muted: #777;
  --header-bg: rgba(245, 245, 245, 0.88);
  --shadow: var(--shadow-md);
  --focus-color: #2563eb;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition-smooth), color var(--transition-smooth);
  font-size: var(--text-base);
  letter-spacing: -0.01em;
}

/* ---- Global Focus Styles ---- */
*:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ---- Header ---- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-img {
  height: 36px;
  width: auto;
  object-fit: contain;
}

/* Theme-specific logos */
[data-theme="dark"] .logo-light,
[data-theme="light"] .logo-dark {
  display: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
}

/* Theme Toggle */
.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

[data-theme="dark"] .theme-icon-sun { display: block; }
[data-theme="dark"] .theme-icon-moon { display: none; }
[data-theme="light"] .theme-icon-sun { display: none; }
[data-theme="light"] .theme-icon-moon { display: block; }

/* Language Toggle */
.lang-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  height: 40px;
  padding: 0 14px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 600;
}

.lang-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ---- Controls Bar ---- */
.controls {
  position: sticky;
  top: 60px;
  z-index: 50;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) var(--space-5);
  transition: background var(--transition-smooth), border-color var(--transition-smooth);
}

.controls-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.controls-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* Search Input */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 16px;
  padding-right: 34px;
  border-radius: 20px;
  font-size: var(--text-base);
  font-family: inherit;
  outline: none;
  height: 40px;
  width: 180px;
  transition: all var(--transition);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--focus-color);
  background: var(--bg-secondary);
  width: 240px;
  box-shadow: 0 0 0 3px rgba(99, 155, 255, 0.15);
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  padding: 0;
}

.search-clear:hover {
  background: var(--text-muted);
  color: var(--bg-primary);
}

.search-wrap.has-query .search-clear {
  display: flex;
}

/* Hide Past Toggle */
.hide-past-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 14px;
  height: 40px;
  border-radius: 20px;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.hide-past-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.hide-past-btn.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

/* Summary Bar */
.summary-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
  flex: 1;
  justify-content: center;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
}

.summary-bar strong {
  color: var(--text-secondary);
  font-weight: 700;
}

.summary-sep {
  color: var(--border);
}

/* Filters */
.filters {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

/* Filters row scrollable on mobile */

.filter-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 16px;
  height: 40px;
  border-radius: 20px;
  font-size: var(--text-base);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}

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

.filter-btn.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
  font-weight: 600;
}

.filter-btn-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: rgba(255,255,255,0.25);
  margin-left: 6px;
  line-height: 1;
}

.filter-btn[data-organizer="all"] .filter-btn-count {
  background: rgba(0,0,0,0.12);
  color: var(--text-secondary);
}

.filter-btn.active .filter-btn-count {
  background: rgba(255,255,255,0.3);
  color: var(--bg-primary);
}

.filter-btn-org {
  transition: all var(--transition), opacity var(--transition);
}

.filter-btn-org:hover {
  opacity: 0.85 !important;
  transform: translateY(-1px);
}

.filter-btn-org.active {
  box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px currentColor;
  transform: translateY(-1px);
}

/* View Toggle */
.view-toggle {
  display: flex;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 10px 14px;
  min-width: 44px;
  min-height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.view-btn:hover {
  color: var(--text-secondary);
  background: rgba(128, 128, 128, 0.1);
}

.view-btn.active {
  background: var(--bg-hover);
  color: var(--text-primary);
  box-shadow: inset 0 -2px 0 0 var(--text-primary);
}

/* ---- Calendar View ---- */
.calendar-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-5);
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.cal-nav-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.cal-nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: scale(1.05);
}

.cal-month-title {
  font-size: var(--text-xl);
  font-weight: 700;
  min-width: 200px;
  text-align: center;
  letter-spacing: -0.02em;
}

/* Today Button */
.today-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 16px;
  height: 40px;
  border-radius: 20px;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

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

.today-btn.is-current {
  opacity: 0.4;
  pointer-events: none;
}

/* Calendar Grid */
.calendar-grid {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: background var(--transition-smooth), border-color var(--transition-smooth);
  box-shadow: var(--shadow-sm);
}

.cal-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.cal-header span {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.cal-body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  transition: opacity 0.25s ease;
}

.cal-body.fade-out {
  opacity: 0;
}

.cal-body.fade-in {
  opacity: 1;
}

.cal-day {
  min-height: 90px;
  padding: var(--space-2);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: background var(--transition), box-shadow var(--transition);
  cursor: default;
}

.cal-day:nth-child(7n) {
  border-right: none;
}

/* Calendar day with events — show clickable cursor and hover */
.cal-day.has-events {
  cursor: pointer;
}

.cal-day.has-events:hover {
  background: var(--bg-hover);
  box-shadow: inset 0 0 0 1px var(--border);
}

.cal-day.other-month {
  opacity: 0.3;
}

.cal-day.today {
  background: var(--bg-tertiary);
}

.cal-day.past-day {
  opacity: 0.5;
}

.cal-day-number {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

.cal-day.today .cal-day-number {
  background: var(--text-primary);
  color: var(--bg-primary);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
}

/* Multi-day event bars */
.cal-event-bar {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 3px 6px;
  margin-bottom: 2px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--transition), transform var(--transition);
  color: #fff;
  position: relative;
  /* Default: full rounded */
  border-radius: 4px;
}

.cal-event-bar.bar-start {
  border-radius: 4px 0 0 4px;
  margin-right: -1px;
}

.cal-event-bar.bar-middle {
  border-radius: 0;
  margin-left: -1px;
  margin-right: -1px;
}

.cal-event-bar.bar-end {
  border-radius: 0 4px 4px 0;
  margin-left: -1px;
}

.cal-event-bar.bar-single {
  border-radius: 4px;
}

.cal-event-bar:hover {
  opacity: 0.9;
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.cal-event-bar.past-event {
  opacity: 0.4;
}

/* Month-TBC row at bottom of calendar */
.cal-month-tbc-row {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 6px 6px;
  border-top: 1px dashed var(--border);
  background: var(--bg-tertiary);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.cal-tbc-bar {
  border: 1.5px dashed currentColor;
  background: transparent !important;
  color: inherit;
  opacity: 0.85;
}

.cal-tbc-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  padding: 0 4px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: middle;
  line-height: 1.6;
  letter-spacing: 0.5px;
}

/* Calendar Legend */
.cal-legend {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: var(--space-4);
  padding: 0 var(--space-1);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Empty month state */
.cal-empty-month {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-10) var(--space-5);
  color: var(--text-muted);
  font-size: var(--text-md);
}

.cal-empty-month-icon {
  font-size: 40px;
  margin-bottom: var(--space-3);
  display: block;
  opacity: 0.6;
}

/* ---- Year View ---- */
.year-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-5);
}

.year-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  align-items: stretch;
}

.year-month {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.year-month:hover {
  background: var(--bg-tertiary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.year-month.is-current-month {
  border-color: var(--text-muted);
}

.year-month-name {
  font-size: var(--text-base);
  font-weight: 700;
  margin-bottom: var(--space-2);
  color: var(--text-primary);
  text-align: center;
  letter-spacing: -0.01em;
}

.year-month.is-current-month .year-month-name {
  color: var(--text-primary);
}

.year-month.past-month {
  opacity: 0.5;
}

.year-mini-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 2px;
}

.year-mini-header span {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 600;
}

.year-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}

.year-mini-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
  border-radius: 3px;
  position: relative;
}

.year-mini-day.other-month {
  visibility: hidden;
}

.year-mini-day.today {
  background: var(--text-primary);
  color: var(--bg-primary);
  font-weight: 700;
  border-radius: 50%;
}

.year-mini-day.has-event {
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  z-index: 1;
  transition: transform 0.15s ease;
}

.year-mini-day.has-event:hover {
  transform: scale(1.1);
  z-index: 2;
}

/* Year view multi-day oval highlights */
.year-mini-day.oval-single {
  border-radius: 50%;
}

.year-mini-day.oval-left {
  border-radius: 50% 0 0 50%;
}

.year-mini-day.oval-right {
  border-radius: 0 50% 50% 0;
}

.year-mini-day.oval-mid {
  border-radius: 0;
}

.year-mini-day.oval-left.oval-right {
  border-radius: 50%;
}

/* Today inside an event oval */
.year-mini-day.today.has-event {
  z-index: 3;
}

/* Year view event pills */
.year-month-events {
  display: flex;
  flex-direction: column;
  margin-top: auto;
  padding-top: 8px;
  gap: 3px;
}

.year-event-pill {
  font-size: 9px;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 3px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: opacity var(--transition);
}

.year-event-pill:hover {
  opacity: 0.8;
}

.year-event-pill-tbc {
  border: 1.5px dashed currentColor;
  color: inherit;
  font-weight: 500;
}

.year-event-count {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  padding-top: 2px;
}

/* ---- List View ---- */
.list-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-5);
}

.list-section.fade-enter {
  animation: fadeSlideIn 0.35s ease;
}

.list-container {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ---- List Toolbar ---- */
.list-toolbar {
  display: flex;
  justify-content: flex-end;
  padding-bottom: var(--space-2);
}

.list-toggle-all-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  padding: 8px 12px;
  min-height: 36px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  font-family: inherit;
}

.list-toggle-all-btn:hover {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

/* ---- Collapsible Year/Month Groups ---- */
.list-year-group {
  display: flex;
  flex-direction: column;
}

.list-year-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--text-primary);
  padding: var(--space-5) 0 var(--space-3);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  letter-spacing: -0.02em;
  min-height: 44px;
}

.list-year-group:first-child .list-year-header {
  padding-top: 0;
}

.list-year-header:hover {
  opacity: 0.8;
}

.list-year-content {
  display: flex;
  flex-direction: column;
}

.list-year-content.collapsed {
  display: none;
}

.list-month-group {
  display: flex;
  flex-direction: column;
}

.list-month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-secondary);
  padding: var(--space-4) 0 var(--space-2);
  border-bottom: 1px solid var(--border);
  margin-top: var(--space-2);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  z-index: 10;
  background: var(--bg-primary);
  min-height: 44px;
  transition: box-shadow var(--transition);
}

.list-month-header:hover {
  color: var(--text-primary);
}

.list-month-group:first-child .list-month-header {
  margin-top: 0;
}

.list-month-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-3);
}

.list-month-content.collapsed {
  display: none;
}

/* Chevron icon */
.list-chevron {
  flex-shrink: 0;
  transition: transform 0.25s ease;
  color: var(--text-muted);
}

.list-year-header:hover .list-chevron,
.list-month-header:hover .list-chevron {
  color: var(--text-secondary);
}

.list-year-header.collapsed .list-chevron,
.list-month-header.collapsed .list-chevron {
  transform: rotate(-90deg);
}

.tournament-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  cursor: pointer;
  transition: all var(--transition);
  border-left: 4px solid transparent;
  box-shadow: var(--shadow-sm);
}

.tournament-card:hover {
  background: var(--bg-tertiary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-left-width: 5px;
}

.tournament-card.past-card {
  opacity: 0.45;
}

.card-date {
  text-align: center;
  min-width: 52px;
  flex-shrink: 0;
}

.card-date-day {
  font-size: var(--text-2xl);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.card-date-month {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.card-date-tbc {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: 1px;
  opacity: 0.7;
}

.card-org-logo-col {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 64px;
}

.card-org-logo {
  height: 64px;
  max-width: 64px;
  object-fit: contain;
}

.card-org-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

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

.card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-1);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.card-meta {
  font-size: var(--text-base);
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.card-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Countdown badge */
.countdown-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.countdown-badge.soon {
  background: #3b2a00;
  color: #f0c040;
  border-color: #5a4000;
}

[data-theme="light"] .countdown-badge.soon {
  background: #fff3d0;
  color: #8a6d00;
  border-color: #e0c040;
}

.countdown-badge.live {
  background: #1a3a1a;
  color: #4ade80;
  border-color: #2a5a2a;
  animation: pulse 2s ease infinite;
}

[data-theme="light"] .countdown-badge.live {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.countdown-badge.imminent {
  background: #3a1a1a;
  color: #ff6b6b;
  border-color: #5a2a2a;
  animation: pulse 2s ease infinite;
}

[data-theme="light"] .countdown-badge.imminent {
  background: #ffe5e5;
  color: #cc3333;
  border-color: #ff9999;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.card-organizer-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
  margin-bottom: var(--space-1);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.register-btn {
  background: var(--text-primary);
  color: var(--bg-primary);
  border: none;
  padding: 10px 18px;
  min-height: 40px;
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: all var(--transition);
  font-family: inherit;
}

.register-btn:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

/* ---- TBC Section ---- */
.tbc-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

.tbc-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.tbc-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.tbc-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-left: 4px solid transparent;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.tbc-card:hover {
  background: var(--bg-tertiary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.tbc-card-info {
  flex: 1;
}

.tbc-card-title {
  font-size: 14px;
  font-weight: 600;
}

.tbc-card-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: var(--space-8);
  position: relative;
  transform: translateY(12px) scale(0.96);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-xl);
}

.modal-overlay.visible .modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-4);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.modal-organizer {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 12px;
  color: #fff;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.modal-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: var(--space-5);
  letter-spacing: -0.02em;
  line-height: 1.3;
  overflow-wrap: break-word;
  word-break: break-word;
}

.modal-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.modal-detail {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-md);
}

.modal-detail-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.modal-detail-label {
  color: var(--text-secondary);
  min-width: 60px;
  font-size: var(--text-base);
}

.modal-detail-value {
  font-weight: 600;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.modal-register {
  display: block;
  width: 100%;
  padding: 14px;
  text-align: center;
  border-radius: var(--radius-sm);
  font-size: var(--text-md);
  font-weight: 700;
  text-decoration: none;
  color: #fff;
  transition: all var(--transition);
  min-height: 48px;
}

.modal-register:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.modal-secondary-actions {
  display: flex;
  gap: var(--space-2);
}

.modal-action-btn {
  flex: 1;
  padding: 10px;
  text-align: center;
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
}

.modal-action-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* ---- Tooltip ---- */
.tooltip {
  position: fixed;
  z-index: 150;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  max-width: 280px;
}

.tooltip.visible {
  opacity: 1;
}

.tooltip-name {
  font-weight: 700;
  margin-bottom: 2px;
}

.tooltip-meta {
  color: var(--text-secondary);
  font-size: 11px;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Organizer Logos in Filter Buttons ---- */
.filter-btn-logo {
  height: 20px;
  width: auto;
  vertical-align: middle;
  margin-right: 6px;
  border-radius: 2px;
  object-fit: contain;
}

/* ---- Legend Logos ---- */
.legend-logo {
  height: 24px;
  width: auto;
  border-radius: 3px;
  object-fit: contain;
}

/* (Card poster thumbnail removed — replaced by Instagram embed in modal) */

/* ---- Badge Logo ---- */
.badge-logo {
  height: 18px;
  width: auto;
  vertical-align: middle;
  margin-right: 4px;
  border-radius: 2px;
  object-fit: contain;
}

/* ---- Card Social Links ---- */
.card-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
  flex-shrink: 0;
}

.card-social-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: scale(1.05);
}

.card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
  flex-shrink: 0;
  text-align: right;
}

.card-location {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.card-location-city {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-secondary);
}

.card-location-club {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ---- Category Tags ---- */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-2);
  margin-bottom: 0;
}

.card-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 500;
  border: 1px solid var(--border);
}

/* ---- Modal Tags ---- */
.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.modal-tag {
  font-size: var(--text-sm);
  padding: 4px 12px;
  border-radius: 12px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 500;
  border: 1px solid var(--border);
}

/* ---- Featured Tournament ---- */
.featured-card {
  position: relative;
  border-left-color: #e0c040 !important;
  box-shadow: var(--shadow-sm), 0 0 12px rgba(224, 192, 64, 0.12);
}

.featured-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(224, 192, 64, 0.05), transparent 50%);
  pointer-events: none;
}

.featured-star {
  position: absolute;
  top: 8px;
  right: 8px;
  color: #e0c040;
  z-index: 1;
  display: flex;
}

.bar-star {
  display: inline-flex;
  color: #e0c040;
  margin-right: 3px;
  vertical-align: middle;
}

/* ---- Modal Instagram Embed ---- */
.modal-ig-embed {
  width: 100%;
  margin-top: var(--space-5);
  margin-bottom: 0;
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.modal-ig-embed .instagram-media {
  margin: 0 !important;
  min-width: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
  border-radius: var(--radius-md) !important;
}


.modal-header-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.modal-org-logo {
  height: 20px;
  width: auto;
  vertical-align: middle;
  margin-right: 6px;
  border-radius: 2px;
  object-fit: contain;
}

.modal-featured-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: #e0c040;
  color: #1a1a1a;
}

/* ---- Organizer Profiles Section ---- */
.org-profiles-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

.org-profiles-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.org-profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.org-profile-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-4);
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-sm);
}

.org-profile-card:hover {
  background: var(--bg-tertiary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.org-profile-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.org-profile-logo {
  height: 48px;
  width: auto;
  max-width: 120px;
  border-radius: 4px;
  object-fit: contain;
}

.org-profile-dot {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  flex-shrink: 0;
  display: inline-block;
}

.org-profile-name {
  font-size: 14px;
  font-weight: 700;
}

.org-social-links {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.org-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition);
}

.org-social-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: scale(1.05);
}

/* ---- Footer ---- */
/* ---- Back to Top ---- */
.back-to-top {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: var(--shadow-lg);
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
}

.footer {
  text-align: center;
  padding: var(--space-8) var(--space-5);
  color: var(--text-muted);
  font-size: var(--text-base);
  border-top: 1px solid var(--border);
}

/* ---- Utility ---- */
.hidden {
  display: none !important;
}

/* Loading state */
.loading {
  text-align: center;
  padding: 80px var(--space-5);
  color: var(--text-muted);
  font-size: var(--text-md);
}

.loading::after {
  content: '';
  display: block;
  width: 32px;
  height: 32px;
  margin: var(--space-4) auto 0;
  border: 3px solid var(--border);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Loading skeleton placeholders */
.skeleton {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
  animation: shimmer 1.5s ease infinite;
}

[data-theme="light"] .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.07), transparent);
}

.skeleton-card {
  height: 88px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
}

.skeleton-header {
  height: 28px;
  width: 180px;
  margin-bottom: var(--space-4);
}

.skeleton-bar {
  height: 20px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.skeleton-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}

.skeleton-cal-day {
  min-height: 90px;
  border-radius: 2px;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* View transitions */
.view-transition-enter {
  animation: fadeSlideIn 0.3s ease forwards;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px var(--space-5);
  color: var(--text-muted);
  font-size: var(--text-md);
}

.empty-state-icon {
  font-size: 48px;
  display: block;
  margin-bottom: var(--space-3);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.empty-state-hint {
  font-size: var(--text-base);
  color: var(--text-muted);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .header-inner {
    height: 52px;
  }

  .logo-img {
    height: 28px;
  }

  .nav {
    gap: var(--space-2);
  }

  .search-input {
    width: 120px;
    height: 36px;
    font-size: var(--text-sm);
    padding-right: 30px;
  }

  .search-input:focus {
    width: 160px;
  }

  .search-clear {
    width: 20px;
    height: 20px;
    font-size: 12px;
    right: 6px;
  }

  .hide-past-label {
    display: none;
  }

  .hide-past-btn {
    padding: 6px 8px;
    height: 36px;
  }

  .cal-month-title {
    font-size: 17px;
    min-width: 160px;
  }

  .calendar-nav {
    gap: var(--space-2);
  }

  .cal-nav-btn {
    width: 40px;
    height: 40px;
  }

  .cal-day {
    min-height: 60px;
    padding: var(--space-1);
  }

  .cal-day-number {
    font-size: var(--text-xs);
  }

  .cal-event-bar {
    font-size: 9px;
    padding: 1px 4px;
  }

  .cal-month-tbc-row {
    padding: 6px 4px 4px;
  }

  .cal-tbc-badge {
    font-size: 8px;
    padding: 0 3px;
  }

  .cal-header span {
    font-size: 10px;
  }

  .controls {
    top: 52px;
    padding: var(--space-2) var(--space-3);
  }

  .list-month-header {
    top: auto;
  }

  .tournament-card {
    flex-wrap: wrap;
    padding: var(--space-3) var(--space-4);
    gap: var(--space-3);
  }

  .card-org-logo-col {
    display: none;
  }

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

  .card-right {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--space-2);
    border-top: 1px solid var(--border);
  }

  .card-location {
    align-items: flex-start;
    text-align: left;
  }

  .register-btn {
    text-align: center;
    min-height: 36px;
    padding: 8px 14px;
    font-size: var(--text-sm);
  }

  .controls-inner {
    gap: var(--space-2);
  }

  .controls-row {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .summary-bar {
    display: none;
  }

  .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 2px;
  }

  .filters::-webkit-scrollbar {
    display: none;
  }

  .filter-btn {
    height: 36px;
    padding: 6px 12px;
    font-size: var(--text-sm);
  }

  .view-btn {
    min-width: 38px;
    min-height: 36px;
    padding: 8px 10px;
  }

  .modal {
    padding: var(--space-5);
    margin: var(--space-2);
  }

  .modal-details {
    padding: var(--space-3);
  }

  .tbc-container {
    grid-template-columns: 1fr;
  }

  .modal-secondary-actions {
    flex-direction: column;
  }

  .year-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

}

@media (max-width: 480px) {

  .year-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
  }

  .year-month {
    padding: var(--space-2);
  }

  .year-mini-day {
    font-size: 8px;
  }

  .cal-header span {
    font-size: 9px;
    letter-spacing: 0;
  }

  .cal-day {
    min-height: 48px;
    padding: 3px;
  }

  .cal-event-bar {
    font-size: 8px;
    padding: 1px 3px;
  }

  .today-btn {
    display: none;
  }

  .nav-link {
    display: none;
  }

  .card-date-day {
    font-size: var(--text-xl);
  }

  .card-title {
    font-size: var(--text-md);
  }

  .summary-bar {
    flex-wrap: wrap;
    gap: var(--space-1);
  }
}
