/* ARR Great Reviewers - Main Stylesheet */

:root {
  --primary-color: #2563eb;
  --secondary-color: #1e40af;
  --accent-color: #3b82f6;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header Styles */
header {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 2rem 0;
  box-shadow: var(--shadow-lg);
}

.header-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.title-with-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.logo-title-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
}

.logo-title-link:hover {
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

.site-logo {
  height: 80px;
  width: auto;
  background: white;
  padding: 4px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.site-logo:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
  text-align: center;
  letter-spacing: -0.02em;
}

header p {
  text-align: center;
  font-size: 1.125rem;
  opacity: 0.9;
  margin-bottom: 1.5rem;
}

/* Navigation */
nav {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: background-color 0.3s ease;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

.mobile-nav-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

nav a {
  color: white;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 500;
  transition: all 0.3s ease;
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

nav a:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

nav a.active {
  background-color: rgba(255, 255, 255, 0.25);
  box-shadow: var(--shadow-md);
}

/* Main Content */
main {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

/* Hero Section */
.hero-section {
  background: var(--bg-primary);
  border-radius: 1rem;
  padding: 3rem;
  margin-bottom: 3rem;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.hero-section h2 {
  font-size: 2.25rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-weight: 700;
}

.hero-section p {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 800px;
  margin: 0 auto;
}

/* Cycle Navigation */
.cycle-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.cycle-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.cycle-link:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.cycle-current {
  font-weight: 700;
  color: white;
  padding: 0.5rem 1rem;
  background-color: var(--primary-color);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transition: all 0.3s ease;
}

.cycle-current:hover {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 1rem;
  box-sizing: border-box;
}

.stat-card {
  background: var(--bg-primary);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
  min-width: 0;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.stat-card h3 {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  line-height: 1.2;
}

.stat-card .value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.stat-card .change {
  font-size: 0.875rem;
  color: var(--success-color);
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Institution Profile Stats */
.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.5rem;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.2;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Content Section */
.content-section {
  background: var(--bg-primary);
  border-radius: 1rem;
  padding: 2.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

.content-section h2 {
  font-size: 1.875rem;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.content-section h3 {
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

/* Table Container */
.table-container {
  overflow-x: auto;
  margin: 1.5rem 0;
  position: relative;
}

.table-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: center;
}

.table-search {
  flex: 1;
  min-width: 250px;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

.table-search:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.view-toggle {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  overflow: hidden;
  background-color: var(--bg-primary);
}

.view-toggle button {
  padding: 0.5rem 1rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.view-toggle button.active {
  background-color: var(--primary-color);
  color: white;
}

.view-toggle button:hover:not(.active) {
  background-color: var(--bg-secondary);
}

.column-toggles {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.column-toggle {
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.column-toggle.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.column-toggle:hover {
  background-color: var(--accent-color);
  color: white;
}

/* Cards View */
.cards-container {
  display: none;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.data-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.data-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
}

.data-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0.25rem 0 0 0;
}

.card-rank {
  flex-shrink: 0;
  margin-left: 1rem;
}

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

.card-metric {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.card-metric-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-metric-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-metric-bar {
  margin-top: 0.5rem;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.card-action {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.card-action:hover {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.search-highlight {
  background-color: #fef3c7;
  padding: 0.1rem 0.2rem;
  border-radius: 0.25rem;
}

.no-results {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

.no-results svg {
  width: 4rem;
  height: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

table thead {
  background-color: var(--bg-tertiary);
}

table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color);
}

table th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background-color 0.2s ease;
}

table th.sortable:hover {
  background-color: var(--bg-secondary);
}

table th.sortable::after {
  content: '↕';
  position: absolute;
  right: 0.5rem;
  opacity: 0.5;
  font-size: 0.875rem;
}

table th.sortable.sort-asc::after {
  content: '↑';
  opacity: 1;
  color: var(--primary-color);
}

table th.sortable.sort-desc::after {
  content: '↓';
  opacity: 1;
  color: var(--primary-color);
}

table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

table tr:hover {
  background-color: var(--bg-secondary);
}

/* Links */
.reviewer-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  display: inline-block;
}

.reviewer-link:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.reviewer-link:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.institution-link {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.institution-link:hover {
  text-decoration: underline;
  color: var(--secondary-color);
}

/* Rank Badges */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.875rem;
}

.rank-1 { background-color: #fbbf24; color: #92400e; }
.rank-2 { background-color: #e5e7eb; color: #374151; }
.rank-3 { background-color: #c9975e; color: #7c2d12; }
.rank-badge:not(.rank-1):not(.rank-2):not(.rank-3) {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 0.5rem;
  background-color: var(--bg-tertiary);
  border-radius: 0.25rem;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--accent-color);
  transition: width 0.3s ease;
}

/* Footer */
footer {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 2rem;
  text-align: center;
  border-top: 1px solid var(--border-color);
}

footer p {
  margin-bottom: 0.5rem;
}

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

footer a:hover {
  text-decoration: underline;
}

/* Nav Search Styles */
.nav-search-container {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-search-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  min-width: 44px;
  min-height: 44px;
  font-size: inherit;
  font-family: inherit;
}

.nav-search-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.nav-search-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: white;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-xl);
  padding: 0.5rem;
  min-width: 320px;
  max-width: 90vw;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1100;
}

.nav-search-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-search-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.nav-search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.nav-search-results {
  margin-top: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
}

.nav-search-result {
  padding: 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}

.nav-search-result:hover {
  background: var(--bg-secondary);
  transform: translateX(4px);
}

.nav-search-result-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: var(--primary-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.125rem;
}

.nav-search-result-info {
  flex: 1;
  min-width: 0;
}

.nav-search-result-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.125rem;
}

.nav-search-result-institution {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-search-no-results {
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Profile Finder Section Styles */
.profile-finder-section {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 1rem;
  padding: 3rem;
  margin-bottom: 3rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  animation: shimmerGradient 20s ease infinite;
  background-size: 200% 200%;
}

.profile-finder-section::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 60%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  transform: rotate(45deg);
}

.profile-finder-container {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.profile-finder-icon {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.profile-finder-icon svg {
  width: 48px;
  height: 48px;
  color: white;
}

.profile-finder-content {
  flex: 1;
  color: white;
}

.profile-finder-content h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: white;
}

.profile-finder-content p {
  font-size: 1.125rem;
  opacity: 0.9;
  margin-bottom: 1.5rem;
}

.profile-finder-search {
  position: relative;
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.profile-search-input {
  flex: 1;
  padding: 1rem 1.5rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 0.75rem;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

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

.profile-search-input:focus {
  outline: none;
  border-color: white;
  background: white;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.profile-search-button {
  padding: 1rem 1.5rem;
  background: white;
  border: none;
  border-radius: 0.75rem;
  color: var(--primary-color);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-search-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.profile-search-results {
  background: white;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-xl);
  max-height: 300px;
  overflow-y: auto;
  display: none;
  animation: slideDown 0.3s ease;
}

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

.profile-search-result {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: var(--text-primary);
  position: relative;
  overflow: hidden;
  animation: fadeInResult 0.3s ease forwards;
  opacity: 0;
}

.profile-search-result:nth-child(1) { animation-delay: 0s; }
.profile-search-result:nth-child(2) { animation-delay: 0.05s; }
.profile-search-result:nth-child(3) { animation-delay: 0.1s; }
.profile-search-result:nth-child(4) { animation-delay: 0.15s; }
.profile-search-result:nth-child(5) { animation-delay: 0.2s; }
.profile-search-result:nth-child(6) { animation-delay: 0.25s; }
.profile-search-result:nth-child(7) { animation-delay: 0.3s; }
.profile-search-result:nth-child(8) { animation-delay: 0.35s; }

.profile-search-result::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(59, 130, 246, 0.05) 50%, transparent 100%);
  transition: left 0.6s ease;
}

.profile-search-result:hover::before {
  left: 100%;
}

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

.profile-search-result:hover {
  background: var(--bg-secondary);
  padding-left: 1.5rem;
}

.profile-search-result-avatar {
  width: 48px;
  height: 48px;
  background: var(--primary-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.profile-search-result-info {
  flex: 1;
  min-width: 0;
}

.profile-search-result-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.profile-search-result-details {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.profile-search-result-stat {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.profile-search-no-results {
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
}

/* Enhanced animations */
.profile-search-input:focus ~ .profile-search-button {
  background: linear-gradient(135deg, white 0%, #f0f9ff 100%);
}

/* Loading state for search */
.profile-search-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.profile-search-loading::after {
  content: '';
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Animations */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmerGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

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

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

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

.animate-fade-in {
  animation: fadeIn 0.6s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
  header {
    padding: 1.5rem 0;
  }

  .title-with-logo {
    flex-direction: column;
    gap: 0.75rem;
  }

  .site-logo {
    height: 40px;
    padding: 6px;
  }
  
  header h1 {
    font-size: 1.75rem;
  }
  
  header p {
    font-size: 1rem;
    margin-bottom: 1rem;
    padding: 0 1rem;
  }
  
  .mobile-nav-toggle {
    display: flex;
    position: absolute;
    top: 1rem;
    right: 1rem;
  }
  
  nav {
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    margin-top: 1rem;
  }
  
  nav.mobile-nav-open {
    max-height: 400px; /* Increased to accommodate search button */
    padding: 0.5rem;
  }
  
  nav a {
    padding: 0.75rem;
    margin: 0.25rem 0;
    text-align: center;
    border-radius: 0.25rem;
  }
  
  .nav-search-container {
    width: 100%;
    margin: 0;
    order: 10; /* Place at the end */
  }
  
  .nav-search-toggle {
    width: 100%;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 0.75rem;
    margin: 0.25rem 0;
    border-radius: 0.25rem;
    min-height: unset;
  }
  
  .nav-search-toggle::after {
    content: 'Find Your Profile';
  }
  
  .nav-search-toggle:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }
  
  .nav-search-dropdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    right: auto;
    width: 90%;
    max-width: 400px;
  }
  
  .nav-search-dropdown.active {
    transform: translate(-50%, -50%);
  }
  
  .profile-finder-section {
    padding: 2rem 1.5rem;
    margin-bottom: 2rem;
  }
  
  .profile-finder-container {
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
  }
  
  .profile-finder-icon {
    width: 60px;
    height: 60px;
  }
  
  .profile-finder-icon svg {
    width: 36px;
    height: 36px;
  }
  
  .profile-finder-content h2 {
    font-size: 1.5rem;
  }
  
  .profile-finder-content p {
    font-size: 1rem;
  }
  
  .profile-finder-search {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .profile-search-input {
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
  }
  
  .profile-search-button {
    width: 100%;
    padding: 0.875rem;
  }
  
  main {
    padding: 2rem 1rem;
  }
  
  .hero-section {
    padding: 2rem 1.5rem;
    margin-bottom: 2rem;
  }
  
  .hero-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }
  
  .hero-section p {
    font-size: 1rem;
  }
  
  .stats-grid,
  .profile-header .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
  }
  
  .stat-card {
    padding: 1.25rem;
    text-align: center;
  }
  
  .stat-card .value {
    font-size: 2rem;
    word-break: break-word;
    overflow-wrap: break-word;
  }
  
  .content-section {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
  }
  
  .content-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }
  
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    /* Ensure table is visible by default */
    min-height: 200px;
  }

  .table-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .table-search {
    min-width: unset;
    width: 100%;
  }

  .view-toggle {
    align-self: center;
  }

  .column-toggles {
    justify-content: center;
  }

  .cards-container {
    display: flex;
    flex-direction: column;
  }

  .data-card {
    margin-bottom: 0.5rem;
  }

  .card-content {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .card-metric {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .card-metric-label {
    font-size: 0.8rem;
  }

  .card-metric-value {
    font-size: 1.1rem;
  }

  .card-actions {
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .card-action {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.8rem;
  }
  
  table {
    font-size: 0.8rem;
    min-width: 600px;
    /* Keep table visible initially on mobile */
    visibility: visible;
  }
  
  table th, table td {
    padding: 0.75rem 0.5rem;
    white-space: nowrap;
  }
  
  table th.sortable::after {
    right: 0.25rem;
    font-size: 0.75rem;
  }
  
  .rank-badge {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
  }
  
  .cycle-nav {
    gap: 0.5rem;
    padding-top: 1.5rem;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
  }
  
  .cycle-nav h3 {
    display: none;
  }
  
  .cycle-link, .cycle-current {
    padding: 0.5rem 0.75rem;
    text-align: center;
    font-size: 0.875rem;
    white-space: nowrap;
    flex-shrink: 0;
  }
  
  footer {
    padding: 1.5rem 1rem;
    text-align: center;
  }
  
  footer p {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .site-logo {
    height: 32px;
    padding: 4px;
  }

  header h1 {
    font-size: 1.5rem;
  }
  
  header p {
    font-size: 0.9rem;
  }
  
  .hero-section {
    padding: 1.5rem 1rem;
  }
  
  .hero-section h2 {
    font-size: 1.25rem;
  }
  
  .stats-grid,
  .profile-header .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .stat-card {
    padding: 1rem;
  }
  
  .stat-card h3 {
    font-size: 0.75rem;
    letter-spacing: 0.02em;
  }
  
  .stat-card .value {
    font-size: 1.5rem;
    word-break: break-word;
    overflow-wrap: break-word;
  }
  
  .stat-card .change {
    font-size: 0.75rem;
  }
  
  .stat-label {
    font-size: 0.75rem;
  }
  
  .stat-number {
    font-size: 2rem;
  }
  
  .content-section {
    padding: 1rem;
  }
  
  .content-section h2 {
    font-size: 1.25rem;
  }
  
  table {
    font-size: 0.75rem;
  }
  
  table th, table td {
    padding: 0.5rem 0.25rem;
  }
  
  .cycle-nav {
    position: relative;
    padding-left: 0;
    padding-right: 0;
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .cycle-nav::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2rem;
    background: linear-gradient(to right, transparent, var(--bg-primary));
    pointer-events: none;
  }
  
  .cycle-link, .cycle-current {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
  }
}

/* Very small screens (below 360px) */
@media (max-width: 360px) {
  .stats-grid,
  .profile-header .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .stat-card {
    padding: 0.75rem;
    min-width: 0;
  }
  
  .stat-card h3 {
    font-size: 0.7rem;
    letter-spacing: 0.01em;
  }
  
  .stat-card .value {
    font-size: 1.25rem;
  }
  
  .stat-card .change {
    font-size: 0.7rem;
  }
  
  .stat-label {
    font-size: 0.7rem;
    letter-spacing: 0.01em;
  }
  
  .stat-number {
    font-size: 1.25rem;
  }
  
  main {
    padding: 1.5rem 0.5rem;
  }
  
  .hero-section {
    padding: 1.25rem 0.75rem;
  }
  
  .content-section {
    padding: 0.75rem;
  }
}

/* Extra small screens (below 350px) */
@media (max-width: 350px) {
  /* Force single column for all stats grids */
  .stats-grid,
  .profile-header .stats-grid {
    grid-template-columns: 1fr !important;
  }
  
  .stat-card {
    padding: 0.625rem;
  }
  
  .stat-card h3 {
    font-size: 0.65rem;
    letter-spacing: 0;
  }
  
  .stat-card .value {
    font-size: 1.1rem;
  }
  
  .stat-card .change {
    font-size: 0.65rem;
  }
  
  .stat-label {
    font-size: 0.65rem;
    letter-spacing: 0;
  }
  
  .stat-number {
    font-size: 1.1rem;
  }
  
  .hero-section h2 {
    font-size: 1.1rem;
  }
  
  .hero-section p {
    font-size: 0.875rem;
  }
}

/* Ultra small screens (below 320px) */
@media (max-width: 320px) {
  .stats-grid,
  .profile-header .stats-grid {
    gap: 0.5rem;
    grid-template-columns: 1fr !important;
  }
  
  .stat-card {
    padding: 0.5rem;
  }
  
  .stat-card h3 {
    font-size: 0.55rem;
    margin-bottom: 0.25rem;
    letter-spacing: 0;
    text-transform: none;
  }
  
  .stat-card .value {
    font-size: 1rem;
    margin-bottom: 0.25rem;
  }
  
  .stat-card .change {
    font-size: 0.6rem;
  }
  
  .stat-label {
    font-size: 0.55rem;
    letter-spacing: 0;
    text-transform: none;
  }
  
  .stat-number {
    font-size: 1rem;
  }
  
  main {
    padding: 1rem 0.25rem;
  }
  
  .hero-section {
    padding: 1rem 0.5rem;
  }
  
  .hero-section h2 {
    font-size: 1rem;
  }
  
  .hero-section p {
    font-size: 0.8rem;
  }
}

/* Tablet/Medium screens */
@media (max-width: 1024px) {
  .cycle-nav {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
  }
  
  .cycle-link, .cycle-current {
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    flex: 0 0 auto;
  }
}

/* Large screens - limit cards to 3-4 columns max */
@media (min-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    max-width: 1600px;
  }
}

@media (min-width: 1600px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    max-width: 1800px;
  }
}

@media (min-width: 1024px) {
  .data-card {
    min-width: 250px;
  }
}