/* CSS Custom Properties for Theme Support */
:root {
  /* Dark theme colors (default and only theme) */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-gradient: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  
  /* Text colors */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;
  
  /* Border colors */
  --border-light: #334155;
  --border-medium: #475569;
  --border-dark: #64748b;
  
  /* Accent colors */
  --accent-primary: #3b82f6;
  --accent-secondary: #8b5cf6;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.3), 0 8px 10px -6px rgb(0 0 0 / 0.3);
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  color: var(--text-primary);
  transition: all 0.3s ease;
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Header styles */
.header {
  width: 100%;
  position: sticky;
  top: 0;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  margin-bottom: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid var(--border-light);
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.header-left h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  margin: 0;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  letter-spacing: -0.025em;
  color: #ffffff;
}

.header-logo {
  height: clamp(56px, 8.4vw, 84px);
  width: auto;
  object-fit: contain;
  filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.5));
}

.header-left p {
  font-size: clamp(0.85rem, 2vw, 1rem);
  opacity: 0.8;
  font-weight: 500;
  margin: 0;
  color: #cccccc;
}

.header-right {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* Header navigation tabs */
.header-nav-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 4px;
  margin-right: 1rem;
}

.header-tab-button {
  background: transparent;
  border: none;
  padding: 8px 16px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.header-tab-button:hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.1);
}

.header-tab-button.active {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.header-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.header-btn:active {
  transform: translateY(0);
}

.header-btn span:first-child {
  font-size: 1.1rem;
}

.auth-btn#login-btn:hover {
  background: rgba(76, 175, 80, 0.2);
  border-color: rgba(76, 175, 80, 0.4);
}

.auth-btn#logout-btn:hover {
  background: rgba(244, 67, 54, 0.2);
  border-color: rgba(244, 67, 54, 0.4);
}

/* Profile dropdown styles */
.profile-dropdown {
  position: relative;
}

.profile-btn {
  position: relative;
}

.dropdown-arrow {
  transition: transform 0.3s ease;
  font-size: 0.8rem;
}

.profile-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  min-width: 200px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
  backdrop-filter: blur(20px);
}

.profile-dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.dropdown-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.dropdown-item:first-child {
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.dropdown-item:last-child {
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

.dropdown-divider {
  margin: 4px 8px;
  border: none;
  border-top: 1px solid var(--border-light);
}

.logout-item:hover {
  background: rgba(244, 67, 54, 0.1);
  color: #ff6b6b;
}


/* Tab navigation */
.nav-tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 2rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 8px;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-button {
  background: transparent;
  border: none;
  padding: 16px 24px;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.tab-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.tab-button:hover::before {
  opacity: 1;
}

.tab-button.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* Tab content */
.tab-content {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 2.5rem;
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
}

.tab-content {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
  display: block;
}

.tab-content.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  position: absolute;
  left: -9999px;
}

.tab-content.fade-in {
  opacity: 1;
  transform: translateY(0);
  position: relative;
  left: auto;
}

/* Search sections */
.search-section h2 {
  color: var(--text-primary);
  margin-bottom: 2rem;
  font-size: 2.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-subsection {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

.search-subsection h3 {
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-subsection h4 {
  color: var(--text-secondary);
  margin: 1.5rem 0 1rem 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.search-input {
  padding: 16px 20px;
  border: 2px solid var(--border-light);
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 500;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
  background: var(--bg-card);
}

.search-input.small {
  max-width: 150px;
}

.search-button {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: var(--text-inverse);
  border: none;
  padding: 16px 32px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
}

.search-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.search-button:active {
  transform: translateY(0);
}

/* Example tags */
.example-tags {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.example-text {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
}

.example-tag {
  background: var(--bg-tertiary);
  color: var(--accent-primary);
  padding: 8px 12px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
}

.example-tag:hover {
  background: var(--accent-primary);
  color: var(--text-inverse);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Search options */
.search-options {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-light);
}

.search-options h3 {
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  font-weight: 600;
}

/* Ranking controls */
.ranking-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.league-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

/* Results styles */
.results {
  margin-top: 2rem;
}

/* Card styles */
.player-card, .clan-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
  border-radius: 20px;
  padding: 2.5rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
}

/* Clan badge styles */
.clan-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.clan-badge-small {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  margin-right: 4px;
  vertical-align: middle;
}

.clan-badge-large {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.clan-badge-xl {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: var(--shadow-lg);
  flex-shrink: 0;
}

.player-card:hover, .clan-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.player-header, .clan-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.clan-header-text {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.clan-header-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.player-header h3, .clan-header h3 {
  font-size: 1.75rem;
  color: var(--text-primary);
  font-weight: 700;
}

.player-tag, .clan-tag {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: var(--text-inverse);
  padding: 6px 12px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.player-tag:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
}

.player-level, .clan-level {
  background: linear-gradient(135deg, var(--accent-success), #059669);
  color: var(--text-inverse);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

/* Stats sections */
.stats-section {
  margin-bottom: 1.5rem;
}

.stats-section h4 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

/* Stats grid */
.player-stats, .clan-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-tertiary);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
  gap: 0.75rem;
}

.stat-item:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.stat-label {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.95rem;
}

.stat-value {
  font-weight: 800;
  color: var(--text-primary);
  font-size: 1.25rem;
}

/* Info sections */
.player-clan, .player-league, .player-donations, .clan-description, .clan-members {
  margin-top: 2rem;
  padding: 2rem;
  background: var(--bg-tertiary);
  border-radius: 16px;
  border: 1px solid var(--border-light);
}

.player-clan h4, .player-league h4, .player-donations h4, 
.clan-description h4, .clan-members h4 {
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
  font-weight: 700;
}

.clan-info {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.clan-name {
  font-weight: 700;
  color: var(--text-primary);
}

.clan-role {
  background: linear-gradient(135deg, var(--accent-warning), #f97316);
  color: var(--text-inverse);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}

.no-clan {
  color: var(--text-muted);
  font-style: italic;
}

.league-name {
  font-weight: 700;
  color: var(--accent-primary);
}

.league-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.league-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

.league-icon-small {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
  vertical-align: middle;
  margin-right: 4px;
}

.league-icon-inline {
  width: 24px;
  height: 24px;
  object-fit: contain;
  vertical-align: middle;
  flex-shrink: 0;
}

.player-league-inline {
  display: flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  box-shadow: var(--shadow-sm);
}

.donation-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.donation-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-light);
}

.donation-label {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
}

.donation-value {
  font-weight: 800;
  color: var(--text-primary);
  font-size: 1.1rem;
}

/* Members list */
.members-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.member-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
  cursor: pointer;
}

.member-item:hover {
  background: var(--bg-card-hover);
  transform: translateX(4px);
}

.member-name {
  font-weight: 700;
  color: var(--text-primary);
}

.member-role {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}

.member-trophies {
  font-weight: 700;
  color: var(--accent-warning);
}

.member-more {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: 8px;
}

/* Clan search results */
.clan-search-results h3 {
  color: var(--text-primary);
  margin-bottom: 2rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.clans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
}

.clan-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.clan-result-card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.clan-result-header {
  margin-bottom: 1rem;
}

.clan-result-header .clan-header-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.clan-result-header h4 {
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 700;
}

.clan-result-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.clan-result-stats .stat {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.clan-location {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.clan-location-labels {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.clan-labels-inline {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* League Clan Items */
.league-clan-item {
  border: 2px solid var(--border-light);
  border-radius: 12px;
  padding: 1rem;
  background: var(--bg-card);
  transition: all 0.3s ease;
  cursor: pointer;
  margin-bottom: 0.5rem;
}

.league-clan-item:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.league-clan-item .clan-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.league-clan-item .clan-members-count {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.league-clan-item .war-result {
  margin-top: 0.5rem;
}

.war-status.tbd {
  color: var(--text-muted);
  font-style: italic;
}

.war-status.won {
  color: var(--accent-success);
  font-weight: 600;
}

.war-status.lost {
  color: var(--accent-danger);
  font-weight: 600;
}

.war-status.tie {
  color: var(--accent-warning);
  font-weight: 600;
}

.damage-percentage {
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.damage-percentage.pending {
  color: var(--text-muted);
}

.damage-percentage.damage-info {
  color: var(--text-secondary);
  font-weight: 500;
}

.damage-percentage.damage-partial {
  color: var(--text-secondary);
}

/* League Matchups */
.league-matchups-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.league-matchup {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-light);
}

.league-matchup .league-clan-item {
  flex: 1;
  margin-bottom: 0;
}

.league-clan-item.current-clan {
  border-color: var(--border-light);
  background: var(--bg-card);
}

.league-clan-item.current-clan:hover,
.league-clan-item.opponent-clan:hover {
  border-color: var(--accent-secondary);
}

.league-clan-item.clan-won {
  border-color: var(--accent-success);
  background: rgba(16, 185, 129, 0.1);
}

.league-clan-item.clan-tied {
  border-color: var(--accent-warning);
  background: rgba(245, 158, 11, 0.1);
}

.vs-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  min-width: 120px;
}

.vs-separator {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent-primary);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.vs-section .war-result {
  margin: 0;
}

.vs-section .damage-percentage {
  text-align: center;
  font-size: 0.75rem;
}

.war-result.clickable {
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.war-result.clickable:hover {
  opacity: 0.8;
}

/* Clan Modal Actions */
.clan-modal-actions {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
}

.view-war-btn {
  background: var(--accent-primary);
  color: var(--text-primary);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
}

.view-war-btn:hover {
  background: var(--accent-secondary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* War Details Modal */
.war-details-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1.5rem;
}

.war-details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.war-clans-detailed {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2rem;
}

.war-clan-detailed {
  flex: 1;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 1rem;
  min-width: 0;
}

.war-clan-detailed.winner {
  border: 3px solid #4CAF50;
}

.war-clan-detailed h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  min-width: 0;
}

.war-clan-detailed h4 > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.war-clan-detailed h4 .clan-tag {
  flex-shrink: 0;
  white-space: nowrap;
}

.war-vs-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.war-vs-detailed {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-primary);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* War State Color Coding */
.war-state-preparation {
  color: var(--accent-primary);
  font-weight: 600;
}

.war-state-battle {
  color: var(--accent-success);
  font-weight: 600;
}

.war-state-ended {
  color: var(--text-secondary);
  font-weight: 600;
}

.war-state-default {
  color: var(--text-primary);
  font-weight: 600;
}

/* War Members Dropdown */
.war-members-dropdown {
  margin-top: 1rem;
}

.view-members-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border: none;
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.view-members-btn:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.war-members-list {
  margin-top: 0.5rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

.war-members-list.show {
  max-height: 300px;
  overflow-y: auto;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.war-member-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
}

.war-member-item:last-child {
  border-bottom: none;
}

.member-position {
  color: var(--accent-primary);
  font-weight: 600;
  min-width: 30px;
}

.member-name {
  flex: 1;
  margin: 0 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-stats {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.member-stars {
  color: var(--accent-warning);
  font-weight: 600;
  font-size: 0.8rem;
}

.member-attacks {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.no-members {
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

/* War Members Section */
.war-members-section {
  margin-top: 2rem;
}

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

.clan-members-column h5 {
  text-align: center;
  margin: 0 0 1rem 0;
  padding: 0.5rem;
  background: var(--bg-tertiary);
  border-radius: 6px;
  color: var(--text-primary);
  font-weight: 600;
}

@media (max-width: 768px) {
  .members-grid {
    grid-template-columns: 1fr;
  }
}

.war-stats-detailed {
  display: flex;
  justify-content: space-around;
  margin-top: 1rem;
}

.war-members-detailed {
  margin-top: 1.5rem;
}

.war-members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.war-member-detailed {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.war-member-detailed:hover {
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.war-member-detailed .member-position {
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 0.5rem;
}

.war-member-detailed .member-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.war-member-detailed .member-war-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Rankings */
.rankings-list h3 {
  color: var(--text-primary);
  margin-bottom: 2rem;
  font-size: 2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.ranking-item:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
  transform: translateX(8px);
  background: var(--bg-card-hover);
}

/* Top 3 ranking colors */
.ranking-item.rank-1 {
  border-color: #ffd700;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 215, 0, 0.05));
  animation: pulseGold 2s ease-in-out infinite;
}

.ranking-item.rank-1:hover {
  animation-play-state: paused;
  border-color: #ffd700;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.08));
  box-shadow: 0 8px 25px rgba(255, 215, 0, 0.3);
}

.ranking-item.rank-2 {
  border-color: #c0c0c0;
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.1), rgba(192, 192, 192, 0.05));
  animation: pulseSilver 2s ease-in-out infinite;
}

.ranking-item.rank-2:hover {
  animation-play-state: paused;
  border-color: #c0c0c0;
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.15), rgba(192, 192, 192, 0.08));
  box-shadow: 0 8px 25px rgba(192, 192, 192, 0.3);
}

.ranking-item.rank-3 {
  border-color: #cd7f32;
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.1), rgba(205, 127, 50, 0.05));
  animation: pulseBronze 2s ease-in-out infinite;
}

.ranking-item.rank-3:hover {
  animation-play-state: paused;
  border-color: #cd7f32;
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.15), rgba(205, 127, 50, 0.08));
  box-shadow: 0 8px 25px rgba(205, 127, 50, 0.3);
}

.ranking-item.rank-4,
.ranking-item.rank-5 {
  animation: pulseBackground 3s ease-in-out infinite;
}

.ranking-item.rank-4:hover,
.ranking-item.rank-5:hover {
  animation-play-state: paused;
}

.rank {
  font-weight: 800;
  color: var(--accent-primary);
  font-size: 1.25rem;
  min-width: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  padding: 8px;
  border-radius: 8px;
}

.player-info, .clan-info {
  flex: 1;
  min-width: 0;
}

.player-name, .clan-name {
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  margin-bottom: 0.25rem;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.player-stats, .clan-stats {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.trophies, .points, .capital-points {
  font-weight: 700;
  color: var(--accent-warning);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.level, .members {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.clan {
  color: var(--accent-success);
  font-size: 0.9rem;
  font-weight: 600;
}

/* Leagues */
.leagues-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
}

.league-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.league-card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.league-icon {
  margin-bottom: 1.5rem;
}

.league-icon img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(var(--shadow-sm));
}

.league-info h4 {
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
}

.league-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.league-id {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  margin: 0;
}

.trophy-requirements {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid var(--border-light);
}

.trophy-range {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: center;
}

.trophy-label {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.trophy-values {
  color: var(--accent-warning);
  font-weight: 700;
  font-size: 1rem;
  background: var(--bg-card);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  display: inline-block;
}

/* Gold Pass */
.goldpass-info h3 {
  color: var(--text-primary);
  margin-bottom: 2rem;
  font-size: 2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.goldpass-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-tertiary) 100%);
  border: 1px solid var(--accent-warning);
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}

.goldpass-dates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.date-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-light);
}

.date-label {
  color: var(--text-secondary);
  font-weight: 600;
}

.date-value {
  font-weight: 800;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.goldpass-description {
  color: var(--text-secondary);
  line-height: 1.7;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 500;
}

/* Loading spinner */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 1000;
  color: var(--text-inverse);
  backdrop-filter: blur(8px);
}

.loading.hidden {
  display: none;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top: 4px solid var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Top 3 Podium Layout */
.top-three-podium {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  justify-content: center;
  align-items: flex-end;
}

.podium-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 300px;
}

/* Podium container ordering */
.podium-container:has(.rank-1) {
  order: 2;
}

.podium-container:has(.rank-2) {
  order: 1;
}

.podium-container:has(.rank-3) {
  order: 3;
}

.podium-rank-image {
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
  z-index: 10;
}

.large-rank-image {
  width: 120px !important;
  height: 120px !important;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.podium-position {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.podium-position:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  background: var(--bg-card-hover);
}

/* First place (center) - tallest */
.podium-position.rank-1 {
  border-color: #ffd700 !important;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 215, 0, 0.05)) !important;
  animation: pulseGold 2s ease-in-out infinite;
  order: 2;
  min-height: 350px !important;
  height: 350px;
}

.podium-position.rank-1:hover {
  animation-play-state: paused;
  border-color: #ffd700 !important;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.08)) !important;
  box-shadow: 0 12px 30px rgba(255, 215, 0, 0.4) !important;
}

/* Second place (left) - 95% of #1 height (331px) */
.podium-position.rank-2 {
  border-color: #c0c0c0 !important;
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.1), rgba(192, 192, 192, 0.05)) !important;
  animation: pulseSilver 2s ease-in-out infinite;
  order: 1;
  min-height: 331px !important;
  height: 331px;
}

.podium-position.rank-2:hover {
  animation-play-state: paused;
  border-color: #c0c0c0 !important;
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.15), rgba(192, 192, 192, 0.08)) !important;
  box-shadow: 0 12px 30px rgba(192, 192, 192, 0.4) !important;
}

/* Third place (right) - 95% of #2 height (313px) */
.podium-position.rank-3 {
  border-color: #cd7f32 !important;
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.1), rgba(205, 127, 50, 0.05)) !important;
  animation: pulseBronze 2s ease-in-out infinite;
  order: 3;
  min-height: 313px !important;
  height: 313px;
}

.podium-position.rank-3:hover {
  animation-play-state: paused;
  border-color: #cd7f32 !important;
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.15), rgba(205, 127, 50, 0.08)) !important;
  box-shadow: 0 12px 30px rgba(205, 127, 50, 0.4) !important;
}

/* Podium content styling */
.podium-position .rank {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.podium-position .player-info,
.podium-position .clan-info {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.podium-position .player-stats,
.podium-position .clan-stats {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: center;
  margin-top: 0.5rem;
}

.podium-position .clan-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin: 0.5rem 0;
}

/* Remaining rankings styling */
.remaining-rankings {
  margin-top: 1rem;
}

/* Responsive design for podium */
@media (max-width: 768px) {
  .top-three-podium {
    flex-direction: column;
    align-items: center;
  }
  
  .podium-container {
    order: initial !important;
    max-width: 100%;
    width: 100%;
  }
  
  .podium-position {
    min-height: auto !important;
    height: auto !important;
  }
  
  .large-rank-image {
    width: 90px !important;
    height: 90px !important;
  }
}

/* Pulsing animations for top ranks */
@keyframes pulseGold {
  0%, 100% {
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.3);
    border-color: #ffd700;
  }
  50% {
    box-shadow: 0 8px 35px rgba(255, 215, 0, 0.6);
    border-color: #ffed4e;
  }
}

@keyframes pulseSilver {
  0%, 100% {
    box-shadow: 0 8px 25px rgba(192, 192, 192, 0.3);
    border-color: #c0c0c0;
  }
  50% {
    box-shadow: 0 8px 35px rgba(192, 192, 192, 0.6);
    border-color: #e0e0e0;
  }
}

@keyframes pulseBronze {
  0%, 100% {
    box-shadow: 0 8px 25px rgba(205, 127, 50, 0.3);
    border-color: #cd7f32;
  }
  50% {
    box-shadow: 0 8px 35px rgba(205, 127, 50, 0.6);
    border-color: #e69548;
  }
}

@keyframes pulseBackground {
  0%, 100% {
    box-shadow: 0 4px 15px rgba(30, 41, 59, 0.2);
    border-color: var(--border-light);
  }
  50% {
    box-shadow: 0 6px 20px rgba(30, 41, 59, 0.4);
    border-color: var(--border-medium);
  }
}

.loading p {
  font-size: 1.2rem;
  font-weight: 600;
}

/* Chat Sidebar */
.chat-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 350px;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border-light);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  z-index: 110;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.chat-sidebar.open {
  transform: translateX(0);
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 111;
}

.chat-header h3 {
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.chat-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.chat-toggle:hover {
  background: var(--bg-card-hover);
  transform: scale(1.05);
}

.chat-filters {
  padding: 1rem 1.25rem;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-light);
}

.chat-filters h4 {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
}

.chat-filter-select {
  width: 100%;
  padding: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.chat-filter-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(var(--accent-primary-rgb), 0.2);
}

.chat-filter-select:hover {
  border-color: var(--accent-primary);
}

.chat-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  position: relative;
}

.chat-messages {
  flex: 1;
  padding: 0.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: var(--bg-secondary);
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 3px;
}

.chat-welcome {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  border: 2px dashed var(--border-light);
  border-radius: 12px;
  background: var(--bg-tertiary);
}

.chat-welcome p {
  margin: 0.25rem 0;
  font-weight: 500;
}

.chat-message {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  max-width: 85%;
  word-wrap: break-word;
}

.chat-message.own {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: var(--text-inverse);
  align-self: flex-end;
  margin-left: auto;
}

.chat-message.other {
  background: var(--bg-card);
  color: var(--text-primary);
  align-self: flex-start;
}

.chat-username {
  font-weight: 700;
  font-size: 0.75rem;
  margin-bottom: 0.1rem;
  opacity: 0.8;
}

.chat-text {
  font-size: 0.85rem;
  line-height: 1.2;
  margin: 0;
}

.chat-timestamp {
  font-size: 0.65rem;
  opacity: 0.6;
  margin-top: 0.1rem;
  text-align: right;
}

.chat-input-container {
  display: flex;
  padding: 1rem;
  gap: 0.75rem;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-light);
  position: sticky;
  bottom: 0;
  z-index: 111;
}

.chat-input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.chat-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chat-send-btn {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: var(--text-inverse);
  border: none;
  border-radius: 8px;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
  min-width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Chat header button (inherits header-btn styles) */
#chat-open-btn.hidden {
  display: none;
}

/* Error message */
.error-message {
  position: fixed;
  top: 24px;
  right: 24px;
  background: var(--accent-danger);
  color: var(--text-inverse);
  padding: 1.25rem 1.75rem;
  border-radius: 12px;
  box-shadow: var(--shadow-xl);
  z-index: 1001;
  animation: slideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
  max-width: 400px;
}

.error-message.hidden {
  display: none;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* No results */
.no-results {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 3rem;
  background: var(--bg-tertiary);
  border-radius: 16px;
  border: 2px dashed var(--border-medium);
  font-size: 1.1rem;
  font-weight: 500;
}

/* Modal styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal:not(.hidden) {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 24px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-light);
  max-width: 95vw;
  max-height: 90vh;
  width: 1000px;
  position: relative;
  z-index: 2001;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal:not(.hidden) .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 2.5rem 1rem;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h2 {
  color: var(--text-primary);
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  line-height: 1;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.modal-body {
  padding: 1rem 2.5rem 2.5rem;
  max-height: calc(90vh - 120px);
  overflow-y: auto;
}

.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--border-dark);
}

/* Modal Z-Index Overrides for Proper Layering */
#player-modal {
  z-index: 2100;
}

#player-modal .modal-content {
  z-index: 2101;
}

#war-details-modal {
  z-index: 2000;
}

#war-details-modal .modal-content {
  z-index: 2001;
}

/* Dynamic modal stacking - will be controlled by JavaScript */
#clan-modal {
  z-index: 2200;
}

#clan-modal .modal-content {
  z-index: 2201;
}

/* Modal stacking classes for dynamic layering - using !important to override ID selectors */
.modal-stack-1 { z-index: 2000 !important; }
.modal-stack-1 .modal-content { z-index: 2001 !important; }

.modal-stack-2 { z-index: 2100 !important; }
.modal-stack-2 .modal-content { z-index: 2101 !important; }

.modal-stack-3 { z-index: 2200 !important; }
.modal-stack-3 .modal-content { z-index: 2201 !important; }

.modal-stack-4 { z-index: 2300 !important; }
.modal-stack-4 .modal-content { z-index: 2301 !important; }

.modal-stack-5 { z-index: 2400 !important; }
.modal-stack-5 .modal-content { z-index: 2401 !important; }

/* Clan Modal Specific Styles */
.clan-modal-card {
  max-width: 100%;
}

.clan-modal-header {
  display: flex;
  gap: 2rem;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
  border-radius: 16px;
  border: 1px solid var(--border-light);
}

.clan-castle-design {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  min-width: 120px;
}

.clan-castle-badge {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--accent-primary);
  box-shadow: var(--shadow-lg);
  object-fit: cover;
}

.castle-decoration {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 1.2rem;
}

.castle-flag {
  animation: wave 2s ease-in-out infinite;
}

.castle-tower {
  filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
}

.castle-wall {
  font-size: 0.8rem;
  letter-spacing: -2px;
}

@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(5deg); }
  75% { transform: rotate(-5deg); }
}

.clan-modal-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.clan-modal-info h3 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.clan-location {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
}

.clan-modal-stats {
  margin-bottom: 2rem;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.clan-modal-description {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  border-left: 4px solid var(--accent-primary);
}

.clan-modal-description h4 {
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.clan-modal-description p {
  color: var(--text-secondary);
  line-height: 1.6;
  font-style: italic;
}

.clan-modal-members {
  margin-bottom: 2rem;
}

.clan-modal-members h4 {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.member-modal-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: all 0.3s ease;
}

.member-modal-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.member-rank {
  font-weight: 800;
  color: var(--accent-primary);
  min-width: 40px;
  text-align: center;
  font-size: 1.1rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.member-rank.rank-1 {
  background: linear-gradient(135deg, #ffd700, #ffb000);
  color: #000;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.member-rank.rank-2 {
  background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
  color: #000;
  box-shadow: 0 2px 8px rgba(192, 192, 192, 0.3);
}

.member-rank.rank-3 {
  background: linear-gradient(135deg, #cd7f32, #b8860b);
  color: #fff;
  box-shadow: 0 2px 8px rgba(205, 127, 50, 0.3);
}

.member-rank.rank-top-10 {
  background: linear-gradient(135deg, #9370db, #7b68ee);
  color: #fff;
  box-shadow: 0 2px 8px rgba(147, 112, 219, 0.2);
}

.member-rank.rank-top-20 {
  background: linear-gradient(135deg, #20b2aa, #008b8b);
  color: #fff;
  box-shadow: 0 2px 8px rgba(32, 178, 170, 0.2);
}

.member-rank.rank-default {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.member-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.member-name {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.05rem;
}

.member-role {
  font-size: 0.85rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: fit-content;
}

.member-role.leader {
  background: linear-gradient(135deg, #ffd700, #ffb000);
  color: #000;
}

.member-role.co-leader {
  background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
  color: #000;
}

.member-role.elder {
  background: linear-gradient(135deg, #cd7f32, #b8860b);
  color: #fff;
}

.member-role.member {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.member-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.member-trophies {
  font-weight: 700;
  color: var(--accent-warning);
  font-size: 1rem;
}

.member-donations {
  font-size: 0.9rem;
  color: var(--accent-success);
  font-weight: 600;
}

.member-more-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-light);
  margin-top: 0.5rem;
}

.more-text {
  color: var(--text-muted);
  font-style: italic;
  flex: 1;
  text-align: center;
}

.view-all-members-btn-inline {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  min-width: fit-content;
}

.view-all-members-btn-inline:hover {
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.view-all-members-btn-inline:active {
  transform: translateY(0);
}

.clan-modal-labels {
  margin-bottom: 1rem;
}

.clan-modal-labels h4 {
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.labels-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.clan-label {
  background: var(--accent-primary);
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
}

/* Player Clan Castle Design */
.clan-info-clickable {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
  border-radius: 16px;
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 0.75rem;
}

.clan-info-clickable:hover {
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.player-clan-castle-design {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  min-width: 80px;
}

.player-clan-badge {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
  box-shadow: var(--shadow-sm);
  object-fit: cover;
}

.player-castle-decoration {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 1rem;
}

.clan-info-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.clan-primary-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.clan-role-tag-line {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.clan-secondary-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.clan-info-text .clan-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.clan-info-text .clan-tag {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.clan-info-text .clan-role {
  font-size: 0.85rem;
  padding: 0.3rem 0.8rem;
  border-radius: 16px;
  font-weight: 600;
  letter-spacing: 0.3px;
  width: fit-content;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.clan-info-text .clan-members {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.no-clan-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(var(--text-muted-rgb), 0.1);
  border-radius: 8px;
  border: 1px dashed var(--border-light);
}

.no-clan-icon {
  font-size: 1.5rem;
  opacity: 0.6;
}

.no-clan {
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
}

.click-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.clan-info-clickable:hover .click-hint {
  opacity: 1;
  color: var(--accent-primary);
}

/* Responsive design */
@media (max-width: 1024px) {
  .container {
    padding: 16px;
  }
  
  .tab-content {
    padding: 2rem;
  }
  
  .clans-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
  
  .leagues-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  .league-card {
    padding: 1.5rem;
  }

  .trophy-requirements {
    padding: 0.75rem;
  }

  .trophy-values {
    font-size: 0.9rem;
    padding: 0.4rem 0.6rem;
  }
  
  .modal-content {
    width: 95vw;
    max-height: 95vh;
  }
  
  .modal-header, .modal-body {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.25rem 1.5rem;
  }
  
  .header-left {
    text-align: center;
  }
  
  .header-right {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .header-btn {
    font-size: 0.85rem;
    padding: 0.6rem 0.8rem;
  }
  
  /* Chat responsive */
  .chat-sidebar {
    width: 100vw;
    right: 0;
  }
  
  
  .nav-tabs {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .tab-button {
    font-size: 0.9rem;
    padding: 12px 18px;
  }
  
  .tab-content {
    padding: 1.5rem;
  }
  
  .search-form {
    grid-template-columns: 1fr;
  }
  
  .ranking-controls, .league-controls {
    grid-template-columns: 1fr;
  }
  
  .player-stats, .clan-stats {
    grid-template-columns: 1fr;
  }
  
  .clans-grid {
    grid-template-columns: 1fr;
  }
  
  .leagues-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
  
  .member-item {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 0.5rem;
  }
  
  .ranking-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .rank {
    align-self: flex-start;
  }
  
  .modal-header {
    padding: 1.5rem 1rem 1rem;
  }
  
  .modal-body {
    padding: 1rem 1rem 1.5rem;
  }
  
  .modal-header h2 {
    font-size: 1.5rem;
  }

  .clan-modal-members h4 {
    font-size: 1.25rem;
  }

  .member-more-info {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }

  .view-all-members-btn-inline {
    padding: 0.6rem 1.2rem;
    font-size: 0.8rem;
    width: 100%;
  }

  .clan-info-clickable {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
    padding: 1.25rem;
  }

  .clan-info-text .clan-name {
    font-size: 1.1rem;
  }

  .player-clan-badge {
    width: 50px;
    height: 50px;
  }

  .leagues-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .trophy-label {
    font-size: 0.85rem;
  }

  .trophy-values {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 2rem;
  }
  
  .header p {
    font-size: 1rem;
  }
  
  .player-header, .clan-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .example-tags {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .search-section h2 {
    font-size: 1.75rem;
  }
  
  .tab-content {
    padding: 1.25rem;
  }
  
  .stat-item {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }
}

/* Settings Modal */
.settings-section {
  padding: 0;
}

.settings-section h3 {
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
  font-weight: 600;
}

.setting-item {
  margin-bottom: 1.5rem;
}

.setting-item label {
  display: block;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.setting-hint {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.25rem;
  font-style: italic;
}

.settings-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

.search-button.secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.search-button.secondary:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Clan War Specific Styles */
.clan-war-card {
  max-width: 100%;
}

.clan-war-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1.75rem 2rem;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.clan-war-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s ease;
}

.clan-war-header:hover::before {
  left: 100%;
}

.clan-war-header h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.war-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.war-state {
  font-size: 1rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-primary);
}

.war-timer {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.war-clans {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 2rem;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-light);
}

.war-clan {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.clan-war-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.war-clan-badge {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
}

.war-stats {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.war-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.war-vs {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--accent-danger);
  text-align: center;
  padding: 0.5rem;
  background: var(--bg-secondary);
  border-radius: 50%;
  min-width: 70px;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--accent-primary);
  box-shadow: var(--shadow-md);
}

.vs-image {
  width: 50px;
  height: 50px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.war-status-message {
  text-align: center;
  padding: 3rem 2rem;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-light);
}

.no-war-message {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.war-hint {
  color: var(--text-muted);
}

.war-members-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-light);
}

.war-members-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.war-member-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: all 0.2s ease;
}

.war-member-item:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.member-position {
  font-weight: 600;
  color: var(--accent-primary);
  min-width: 40px;
}

.member-th {
  font-size: 0.8rem;
  color: var(--accent-warning);
  font-weight: 600;
}

.member-war-stats {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
}

.attack-info, .defense-info {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.attacks-used {
  color: var(--accent-primary);
}

.best-attack {
  color: var(--accent-success);
}

.best-destruction {
  color: var(--accent-warning);
}

.opponent-attacks {
  color: var(--text-secondary);
}

.best-defense {
  color: var(--accent-danger);
}

.no-attacks {
  color: var(--text-muted);
}

/* Bookmarks Modal */
.bookmark-section {
  margin-bottom: 2rem;
}

.bookmark-section h3 {
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-size: 1.2rem;
}

.bookmark-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bookmark-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border-light);
  transition: all 0.2s ease;
}

.bookmark-item:hover {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
}

.bookmark-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  flex: 1;
}

.bookmark-name {
  font-weight: 600;
  color: var(--text-primary);
}

.bookmark-tag {
  font-family: 'Courier New', monospace;
  color: var(--accent-primary);
  background: var(--bg-tag);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.bookmark-remove {
  background: var(--accent-danger);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: all 0.2s ease;
}

.bookmark-remove:hover {
  background: #d32f2f;
  transform: scale(1.1);
}

.bookmark-btn {
  background: var(--accent-warning);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  margin-left: 0.5rem;
}

.bookmark-btn:hover {
  background: var(--accent-warning-dark);
  transform: scale(1.05);
}

.bookmark-btn.bookmarked {
  background: var(--accent-success);
}

.bookmark-btn.bookmarked:hover {
  background: var(--accent-success-dark);
}

.clan-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.clan-title-row h3 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
}

.clan-title-extras {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.clan-title-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.clan-tag-level {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.clan-description {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 0.9rem;
  width: 100%;
  margin-top: 0.25rem;
}

.bookmark-btn.inline {
  padding: 0.25rem 0.5rem;
  font-size: 12px;
  margin: 0;
}

.view-war-btn.inline {
  background: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  color: white;
  font-size: inherit;
  padding: 0.25rem 0.5rem;
  margin: 0;
  cursor: pointer;
  border-radius: 8px;
  text-decoration: none;
}

.view-war-btn.inline:hover {
  background: var(--accent-primary-dark);
  border-color: var(--accent-primary-dark);
  transform: none;
}

.view-war-btn {
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.view-war-btn:hover {
  background: var(--accent-primary-dark);
  transform: scale(1.05);
}

.no-bookmarks {
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
  padding: 2rem;
}


.auto-refresh-indicator {
  color: var(--accent-primary);
  font-size: 14px;
}

.refresh-spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
}

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

/* Rankings refresh animation - smooth fade in/out */
#rankings-results.refreshing {
  animation: fadeRefresh 0.8s ease-in-out;
}

@keyframes fadeRefresh {
  0% {
    opacity: 1;
  }
  40% {
    opacity: 0.2;
  }
  60% {
    opacity: 0.2;
  }
  100% {
    opacity: 1;
  }
}

/* Player Verification Styles */
.verified-players-container {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 1rem 0;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-tertiary);
}

.verified-player-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-light);
  transition: all 0.2s ease;
  cursor: pointer;
}

.verified-player-card:hover {
  background: var(--bg-card-hover);
  transform: translateX(4px);
  border-left: 3px solid var(--accent-primary);
  padding-left: calc(1rem - 3px);
}

.verified-player-card:last-child {
  border-bottom: none;
}

.player-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.player-name-tag {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.player-name {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1rem;
}

.player-tag {
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
  background: var(--bg-primary);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border-light);
  display: inline-block;
  width: fit-content;
  font-size: 0.875rem;
}

.loading-players {
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
}

.verification-date {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.player-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: var(--accent-primary);
  color: white;
  transition: all 0.2s ease;
}

.btn-small:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-small.btn-danger {
  background: var(--accent-danger);
}

.player-verification-section {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.player-verification-section h4 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.verification-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.verification-form .search-input {
  margin-bottom: 0;
}

.no-verified-players {
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
}

/* Username input group styling */
.username-input-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.username-input-group .search-input {
  flex: 1;
  margin-bottom: 0;
}

.username-input-group .search-button {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Responsive adjustments for verification UI */
@media (max-width: 768px) {
  .verified-player-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .player-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  .verification-form {
    gap: 0.5rem;
  }
  
  .username-input-group {
    flex-direction: column;
    align-items: stretch;
  }
  
  .username-input-group .search-button {
    width: 100%;
  }
}

/* CWL Loading States */
.loading-war-league {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
  padding: 2rem;
}

.loading-content {
  text-align: center;
  color: var(--text-secondary);
}

.loading-content .spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 1.5rem;
}

.loading-content h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
}

.loading-content p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.error-content {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-secondary);
}

.error-content h3 {
  color: var(--accent-danger);
  margin-bottom: 1rem;
}

.error-content p {
  margin-bottom: 2rem;
}

/* Enhanced refresh spinner for CWL individual wars */
.war-status .refresh-spinner,
.damage-percentage .refresh-spinner {
  margin-right: 0.25rem;
}

/* CWL On-Demand Loading Styles */
.click-to-load {
  color: var(--accent-primary);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.click-to-load:hover {
  color: var(--accent-secondary);
  transform: scale(1.05);
}

.war-preview {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-style: italic;
}

.war-status.error {
  color: var(--accent-danger);
  cursor: pointer;
}

/* Clickable war matchup styling */
.clickable-war {
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 8px;
  padding: 0.5rem;
  margin: -0.5rem;
}

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

.clickable-war .league-clan-item:hover {
  background: var(--accent-primary);
  color: white;
  border-radius: 4px;
}

/* Prevent clan items from triggering the main hover when they have their own hover */
.clickable-war .league-clan-item {
  transition: all 0.2s ease;
}

.war-result.clickable:hover {
  background: var(--bg-card-hover);
  border-radius: 4px;
  padding: 0.25rem;
  margin: -0.25rem;
}

/* Chat temporary message and rate limiting styles */
.chat-expiration {
  font-size: 0.75rem;
  color: var(--accent-warning);
  font-style: italic;
  margin-top: 0.25rem;
}

.chat-message.temporary {
  border-left: 3px solid var(--accent-warning);
  background: rgba(245, 158, 11, 0.1);
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* Chat input disabled state */
#chat-input:disabled {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: not-allowed;
}

#chat-send-btn:disabled {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: not-allowed;
}

/* Chat cooldown indicator */
.chat-cooldown-active {
  border: 2px solid var(--accent-warning);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

/* Profile Verified Accounts Styles */
.profile-verified-accounts {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-light);
}

.profile-verified-accounts h3 {
  margin: 0 0 1rem 0;
  color: var(--text-primary);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.verified-players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.profile-verified-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.profile-verified-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

.verified-card-header .player-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.verified-checkmark {
  font-size: 0.9rem;
  filter: drop-shadow(0 0 2px rgba(0, 255, 0, 0.3));
}

.verified-card-header .player-tag {
  font-family: 'Courier New', monospace;
  color: var(--text-secondary);
  font-size: 0.9rem;
  background: var(--bg-tertiary);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.verified-card-stats {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.stat-icon {
  font-size: 1rem;
}

.stat-value {
  font-weight: 500;
  color: var(--text-primary);
}

.verified-card-footer {
  border-top: 1px solid var(--border-light);
  padding-top: 0.75rem;
}

.verified-card-footer small {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.verified-accounts-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 1rem 0 0 0;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: 6px;
}

.link-button {
  background: none;
  border: none;
  color: var(--accent-primary);
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  padding: 0;
}

.link-button:hover {
  color: var(--accent-secondary);
}

.no-verified-accounts {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 150px;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h4 {
  margin: 0 0 0.5rem 0;
  color: var(--text-secondary);
}

.empty-state p {
  margin: 0 0 1rem 0;
  font-size: 0.9rem;
}

.error-state {
  text-align: center;
  color: var(--accent-danger);
  padding: 2rem;
}

.error-state .error-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

/* Role badges */
.role-badge {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 12px;
    margin-left: 4px;
    font-weight: bold;
}

.role-badge.admin {
    background-color: #ffd700;
    color: #333;
}

.role-badge.moderator {
    background-color: #4CAF50;
    color: white;
}

.role-badge.member {
    background-color: #666;
    color: white;
    font-size: 0.7rem;
}

/* Chat message role indicators */
.chat-message .username .role-indicator {
    font-size: 0.7rem;
    margin-left: 4px;
}

.chat-message .username .role-indicator.admin {
    color: #ffd700;
}

.chat-message .username .role-indicator.moderator {
    color: #4CAF50;
}

/* Town Hall level display in chat */
.chat-username .th-level {
    background-color: #8b5cf6;
    color: white;
    font-size: 0.7rem;
    padding: 2px 4px;
    border-radius: 4px;
    margin-left: 4px;
    font-weight: bold;
}

/* Town Hall level in verified player cards */
.player-name-tag .player-th {
    background-color: #3b82f6;
    color: white;
    font-size: 0.7rem;
    padding: 2px 4px;
    border-radius: 4px;
    margin-left: 4px;
    font-weight: bold;
}

/* Admin-only section styling */
.admin-only {
    border: 2px solid #ffd700;
    border-radius: 8px;
    padding: 1rem;
    background-color: rgba(255, 215, 0, 0.1);
    margin-top: 1rem;
}

.admin-only label {
    color: #ffd700;
    font-weight: bold;
}

.admin-tools {
    margin-top: 0.5rem;
}

/* Danger button styling */
.search-button.danger {
    background-color: #ef4444;
    border-color: #ef4444;
}

.search-button.danger:hover {
    background-color: #dc2626;
    border-color: #dc2626;
}

.search-button.danger:disabled {
    background-color: #991b1b;
    border-color: #991b1b;
    opacity: 0.7;
}

.danger-text {
    color: #ef4444 !important;
    font-weight: bold;
}

