/* CSS Custom Properties for Theming */
:root {
  --primary-sage: #a8c09a;
  --primary-cream: #effaf0;
  --primary-coral: #88d498;
  --accent-gold: #68b678;
  --accent-blue: #b2e0b2;
  --text-dark: #4a5568;
  --text-light: #718096;
  --white: #ffffff;
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.12);
  --shadow-hard: 0 8px 30px rgba(0, 0, 0, 0.16);
  --border-radius: 16px;
  --border-radius-small: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Gender-based theme overrides */
.theme-boy {
  --primary-sage: #a8c5d6;
  --primary-cream: #f8fbff;
  --primary-coral: #b8d4e6;
  --accent-gold: #8bb8d6;
  --accent-blue: #9bc5e6;
}

.theme-girl {
  --primary-sage: #e2b4c4;
  --primary-cream: #faf4f7;
  --primary-coral: #ecc0cc;
  --accent-gold: #e4a4b4;
  --accent-blue: #eec0cc;
}

.theme-neutral {
  --primary-sage: #a8c09a;
  --primary-cream: #effaf0;
  --primary-coral: #88d498;
  --accent-gold: #68b678;
  --accent-blue: #b2e0b2;
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, var(--primary-cream) 0%, #f0f4f0 50%, var(--primary-sage) 100%);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
  background-attachment: fixed;
}

/* App Container */
.app-container {
  min-height: 100vh;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 1500px;
  margin: 0 auto;
}

/* Navigation */
.sidebar {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--white);
  border-radius: 50px;
  padding: 1rem;
  box-shadow: var(--shadow-medium);
  display: flex;
  gap: 0.5rem;
  z-index: 100;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar button {
  background: transparent;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.sidebar button:hover {
  background: var(--primary-sage);
  color: var(--white);
  transform: translateY(-2px);
}

.sidebar button.active {
  background: var(--primary-coral);
  color: var(--white);
  box-shadow: 0 4px 15px rgba(244, 166, 166, 0.3);
}

/* Main Content */
.main-content {
  width: 100%;
  max-width: 1500px; /* Increased from 800px to accommodate charts better */
  margin-bottom: 10px; /* Space for floating nav */
}

/* Page Styles */
.page {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 2.5rem;
  box-shadow: var(--shadow-soft);
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.page::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-sage), var(--primary-coral), var(--accent-gold));
}

/* Login Page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  margin: 0;
  background: none;
  box-shadow: none;
  padding: 0;
}

.login-box {
  background: var(--white);
  padding: 3rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-medium);
  max-width: 400px;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.login-box::before {
  content: '👶';
  position: absolute;
  top: -1rem;
  right: -1rem;
  font-size: 4rem;
  opacity: 0.1;
  transform: rotate(15deg);
}

.login-buttons {
  padding: 1rem;
}

/* Page Headers */
.page-header {
  text-align: center;
  margin-bottom: 2.5rem;
  position: relative;
}

.page-header h2 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 0.5rem 0;
  background: linear-gradient(135deg, var(--primary-sage), var(--primary-coral));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header p {
  color: var(--text-light);
  font-size: 1.1rem;
  margin: 0;
  max-width: 500px;
  margin: 0 auto;
}

/* Typography */
h2, h3, h4 {
  color: var(--text-dark);
  font-weight: 600;
}

h3 {
  font-size: 1.5rem;
  margin: 1.5rem 0 1rem 0;
}

/* Form Elements */
input, select, textarea {
  width: 100%;
  padding: 1rem 1.25rem;
  border: 2px solid #e2e8f0;
  border-radius: var(--border-radius-small);
  font-size: 1rem;
  background: var(--white);
  transition: var(--transition);
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-sage);
  box-shadow: 0 0 0 3px rgba(168, 192, 154, 0.1);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* Buttons */
button {
  font-family: inherit;
  cursor: pointer;
  padding: 0.875rem 1.75rem;
  border: none;
  border-radius: var(--border-radius-small);
  font-size: 1rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Primary Button */
.btn-primary, button:not(.btn-secondary):not(.btn-outline):not(.toggle-btn) {
  background: linear-gradient(135deg, var(--primary-sage), var(--primary-coral));
  color: var(--white);
  box-shadow: 0 4px 15px rgba(168, 192, 154, 0.3);
}

.btn-primary:hover, button:not(.btn-secondary):not(.btn-outline):not(.toggle-btn):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(168, 192, 154, 0.4);
}

/* Secondary Button */
.btn-secondary {
  background: var(--white);
  color: var(--text-dark);
  border: 2px solid #e2e8f0;
}

.btn-secondary:hover {
  border-color: var(--primary-sage);
  background: var(--primary-sage);
  color: var(--white);
}

/* Outline Button */
.btn-outline {
  background: transparent;
  color: var(--primary-sage);
  border: 2px solid var(--primary-sage);
}

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

/* Button Groups */
.button-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.button-group.center {
  justify-content: center;
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--shadow-soft);
  transition: var(--transition);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.code-card {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--shadow-soft);
  transition: var(--transition);
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-top: 16px;
}

.code-title {
  margin-top: 0px;
}

/* Name Display */
.name-display {
  text-align: center;
  padding: 3rem 2rem;
  background: linear-gradient(135deg, var(--primary-cream), var(--white));
  border-radius: var(--border-radius);
  margin: 2rem 0;
  position: relative;
  overflow: hidden;
}

.name-display::before {
  content: '✨';
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
  opacity: 0.3;
}

.name-title {
  font-size: 3rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
  background: linear-gradient(135deg, var(--primary-sage), var(--primary-coral));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Vote Buttons */
.vote-buttons {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-top: 2rem;
}

.vote-buttons button {
  padding: 1rem 2rem;
  font-size: 2rem;
  font-weight: 600;
  min-width: 120px;
  position: relative;
}

.vote-buttons .accept-btn {
  background: linear-gradient(135deg, #82ecae, #55c78a) !important;
  color: var(--white);
}

.vote-buttons .accept-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(72, 187, 120, 0.4);
}

.vote-buttons .reject-btn {
  background: linear-gradient(135deg, #f5a5a5, #d87a7a) !important;
  color: var(--white);
}

.vote-buttons .reject-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(245, 101, 101, 0.4);
}

/* Head to Head Styling */
.head2head-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 2rem;
  align-items: start;
  margin: 2rem 0;
}

.head2head-name {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--shadow-soft);
  transition: var(--transition);
  position: relative;
}

.head2head-name:hover {
  /* transform: translateY(-4px); */
  box-shadow: var(--shadow-hard);
}

.vs-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;;
}

.vs-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-light);
  background: var(--accent-gold);
  color: var(--white);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  box-shadow: var(--shadow-soft);
  margin-top: 2rem;
}

.cant-decide-button {
  margin-top: 10rem;
  background: var(--white);
  color: var(--text-dark);
  font-size: 1.5rem;
  padding: 1rem 1rem;
  border-radius: var(--border-radius-small);
  border: 1px solid var(--accent-gold);
  width: auto;
}

.cant-decide-button:hover {
  background: var(--accent-gold);
  color: var(--white);
}

.pick-name-button {
  width: 100%;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, var(--primary-sage), var(--accent-gold));
}

/* Progress Bar */
.progress-section {
  margin: 1rem 0 2rem;
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: #e2e8f0;
  border-radius: var(--border-radius-small);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary-sage), var(--accent-gold));
  transition: width 0.4s ease;
}

.progress-message {
  margin-top: 0.5rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-light);
}

/* Stats and Tables */
.stats-layout {
  display: grid;
  grid-template-columns: 525px 1fr;
  gap: 2rem;
  margin: 2rem 0;
  min-width: 0;
}

.name-details {
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.name-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--border-radius-small);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  table-layout: fixed; /* Ensure table respects container width */
}

.name-table th,
.name-table td {
  padding: 1rem;
  text-align: left;
  overflow: hidden; /* Prevent cell content from overflowing */
  text-overflow: ellipsis; /* Add ellipsis for long text */
  white-space: nowrap; /* Prevent text wrapping */
}

.name-table th {
  background: var(--primary-sage);
  color: var(--white);
  font-weight: 600;
}

.name-table td {
  border-bottom: 1px solid #f7fafc;
  transition: var(--transition);
}

.name-table tbody tr:hover {
  background: var(--primary-cream);
  cursor: pointer;
}

.name-table tbody tr.selected {
  background: var(--primary-coral);
  color: var(--white);
}

.name-table tbody tr.dragging {
  opacity: 0.6;
}

.name-table tbody tr.drop-target {
  border-top: 2px solid var(--accent-blue);
}

/* Toggle Buttons */
.toggle-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  background: #f7fafc;
  padding: 0.5rem;
  border-radius: var(--border-radius-small);
  width: fit-content;
}

.toggle-btn {
  background: transparent !important;
  border: none !important;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-small);
  font-weight: 500;
  color: var(--text-light);
  transition: var(--transition);
  font-size: 0.9rem;
  white-space: nowrap;
  box-shadow: none !important;
}

.toggle-btn:hover {
  background: rgba(168, 192, 154, 0.1) !important;
  color: var(--primary-sage);
  transform: none !important;
}

.toggle-btn.active {
  background: var(--primary-sage) !important;
  color: var(--white) !important;
  box-shadow: var(--shadow-soft) !important;
  transform: translateY(-1px) !important;
  font-weight: 600;
}

/* Name Info Component */
.name-info {
  background: linear-gradient(135deg, var(--primary-cream), var(--white));
  border-radius: var(--border-radius);
  padding: 2rem;
  margin: 1.5rem 0;
  border: 1px solid rgba(168, 192, 154, 0.2);
  min-width: 0; /* Allow component to shrink */
  overflow: hidden; /* Prevent content overflow */
}

.name-info-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.info-title {
  color: var(--primary-sage);
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
}

.behind-name-link {
  color: var(--primary-coral);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border: 2px solid var(--primary-coral);
  border-radius: var(--border-radius-small);
  background: var(--white);
  transition: var(--transition);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.behind-name-link:hover {
  background: var(--primary-coral);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(244, 166, 166, 0.3);
}

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

.meta-stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.meta-stats li {
  background: var(--white);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-small);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Charts */
.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); /* Reduced from 350px to 300px */
  gap: 2rem;
  margin: 2rem 0;
}

.chart {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-soft);
  text-align: center;
  border: 1px solid rgba(168, 192, 154, 0.1);
  overflow: hidden;
  min-width: 0; /* Allow chart to shrink */
}

.chart-title {
  color: var(--text-dark);
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.chart-container {
  width: 100%;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1rem 0;
  /* overflow: hidden; /* Prevent SVG from overflowing */
}

.chart-control {
  margin-bottom: 1rem;
  text-align: left;
}

.chart-control label {
  font-size: 0.9rem;
  color: var(--text-light);
  font-weight: 500;
}

.chart-control select {
  margin-left: 0.5rem;
  padding: 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: var(--border-radius-small);
  background: var(--white);
  font-size: 0.9rem;
}

.no-data {
  color: var(--text-light);
  background: #f7fafc;
  border: 2px dashed #e2e8f0;
  padding: 2rem;
  border-radius: var(--border-radius-small);
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-style: italic;
}

/* Loading States */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-light);
  font-size: 1.1rem;
}

.loading::before {
  content: '👶';
  margin-right: 0.5rem;
  animation: bounce 2s infinite;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10;
  font-size: 1.1rem;
  color: var(--text-light);
}

.loading-overlay::before {
  content: '👶';
  margin-right: 0.5rem;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .app-container {
    padding: 1rem;
  }
  
  .page {
    padding: 1.5rem;
  }
  
  .sidebar {
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    transform: none;
    justify-content: space-around;
  }
  
  .sidebar button {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }

  .names-panel,
  .name-details,
  .name-info,
  .head2head-name {
    width: 100%;
    padding: 1rem;
  }
  
  .head2head-pair {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .cant-decide-button {
    margin-top: 1.5rem;
    width: 100%;
  }

  .pick-name-button {
    font-size: 1.2rem;
    padding: 1rem;
  }

  .vs-divider {
    display: none;
  }
  
  .stats-layout {
    grid-template-columns: 1fr;
  }
  
  .name-title {
    font-size: 2rem;
  }
  
  .page-header h2 {
    font-size: 2rem;
  }
  
  .charts {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .chart-container {
    height: 240px;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .button-group {
    flex-direction: column;
    gap: 0.5rem;
  }

  .button-group button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .sidebar {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
  }

  .sidebar button {
    flex: 1 0 33%;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }
  .charts {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .chart {
    padding: 1rem;
  }
  
  .chart-container {
    height: 200px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus Styles */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary-sage);
  outline-offset: 2px;
}

/* Cluster Toggle Styling */
.cluster-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-end;
}

.cluster-names {
  font-size: 0.9rem;
  color: var(--text-light);
  text-align: right;
}

.cluster-toggle-wrapper {
  position: relative;
}

.cluster-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-light);
  transition: var(--transition);
  user-select: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--border-radius-small);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(168, 192, 154, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.cluster-toggle:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--primary-sage);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.cluster-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.cluster-toggle-slider {
  position: relative;
  width: 36px;
  height: 20px;
  background: #e2e8f0;
  border-radius: 20px;
  transition: var(--transition);
  flex-shrink: 0;
}

.cluster-toggle-slider::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--white);
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cluster-toggle input:checked + .cluster-toggle-slider {
  background: var(--primary-sage);
}

.cluster-toggle input:checked + .cluster-toggle-slider::before {
  transform: translateX(16px);
  background: var(--white);
}

.cluster-toggle-text {
  font-weight: 500;
  white-space: nowrap;
}

.cluster-toggle input:checked ~ .cluster-toggle-text {
  color: var(--primary-sage);
  font-weight: 600;
}

/* Responsive adjustments for cluster toggle */
@media (max-width: 768px) {
  .cluster-section {
    align-items: stretch;
  }
  
  .cluster-names {
    text-align: left;
  }
  
  .cluster-toggle {
    justify-content: flex-start;
  }
  
  .cluster-toggle-text {
    font-size: 0.8rem;
  }
}

/* Chart Tooltip Styling */
.chart-tooltip {
  z-index: 1000;
  margin-bottom: 10px;
}

.tooltip-content {
  background: var(--white);
  border: 1px solid var(--primary-sage);
  border-radius: var(--border-radius-small);
  padding: 0.5rem 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 0.85rem;
  text-align: center;
  min-width: 80px;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.95);
}

.tooltip-year {
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.25rem;
}

.tooltip-value {
  color: var(--primary-sage);
  font-weight: 500;
}

/* Responsive adjustments for name info header */
@media (max-width: 768px) {
  .name-info-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .behind-name-link {
    align-self: flex-start;
  }
  
  .cluster-section {
    align-items: stretch;
  }
  
  .cluster-names {
    text-align: left;
  }
  
  .cluster-toggle {
    justify-content: flex-start;
  }
  
  .cluster-toggle-text {
    font-size: 0.8rem;
  }
}

/* Welcome Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.welcome-modal {
  background: var(--white);
  border-radius: var(--border-radius);
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-medium);
  position: relative;
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to { 
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  background: linear-gradient(135deg, var(--primary-sage), var(--primary-coral));
  color: var(--white);
  padding: 2.5rem 2rem 2rem 2rem;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  text-align: center;
  position: relative;
}

.modal-header h2 {
  margin: 0 0 1rem 0;
  font-size: 2rem;
  font-weight: 700;
  color: var(--white);
  background: none;
  -webkit-text-fill-color: var(--white);
}

.modal-header p {
  margin: 0;
  font-size: 1.1rem;
  opacity: 0.95;
  line-height: 1.5;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-weight: bold;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.modal-steps {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.step-card {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 2rem;
  align-items: center;
  background: linear-gradient(135deg, var(--primary-cream), var(--white));
  padding: 1rem;
  border-radius: var(--border-radius-small);
  border: 2px solid transparent;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

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

.step-number {
  background: var(--primary-sage);
  color: var(--white);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 2px 8px rgba(168, 192, 154, 0.3);
}

.step-emoji {
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-content {
  min-width: 0;
}

.step-content h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-dark);
}

.step-content p {
  margin: 0;
  color: var(--text-light);
  line-height: 1.5;
}

.step-icon {
  font-size: 1.5rem;
  opacity: 0.7;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-footer {
  background: var(--primary-cream);
  padding: 2rem;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  text-align: center;
}

.modal-start-btn {
  font-size: 1.1rem;
  font-weight: 600;
  padding: 1rem 2rem;
  min-width: 200px;
}

/* Similar Names Component */
.similar-names {
  margin-top: 2rem;
  padding: 1.5rem;
  background: #faf7f0;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.similar-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #2d3748;
}

.similar-description {
  margin: 0 0 1rem 0;
  color: #718096;
  font-size: 0.9rem;
  line-height: 1.4;
}

.similar-list {
  display: grid;
  gap: 0.75rem;
}

.similar-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: white;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

.similar-item:hover {
  border-color: #a8c09a;
  box-shadow: 0 2px 4px rgba(168, 192, 154, 0.1);
}

.similar-name {
  font-weight: 600;
  color: #2d3748;
  font-size: 1rem;
}

.similar-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: #718096;
}

.similarity-score {
  font-weight: 500;
  color: #a8c09a;
}

.peak-info, .current-info {
  color: #718096;
}

.no-similar {
  color: #718096;
  font-style: italic;
  margin: 0;
}

.similar-names.loading {
  text-align: center;
  color: #718096;
  font-style: italic;
}

/* Signup Page Styles */
.signup-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-group {
  position: relative;
}

.input-status {
  font-size: 0.85rem;
  margin-top: 0.25rem;
  font-weight: 500;
}

.input-error {
  border-color: #f56565 !important;
  box-shadow: 0 0 0 3px rgba(245, 101, 101, 0.1) !important;
}

.error-message {
  background: #fed7d7;
  color: #c53030;
  padding: 0.75rem;
  border-radius: var(--border-radius-small);
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid #feb2b2;
}

.save-confirmation {
  color: var(--primary-sage);
  font-size: 0.9rem;
  text-align: center;
  margin-top: 0.5rem;
}

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

.signup-buttons button {
  width: 100%;
  padding: 0.875rem 1.5rem;
}

.signup-buttons button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.auth-disclaimer {
  color: var(--text-light);
  font-size: 0.8rem;
  margin-top: 1rem;
}

/* Login Page Error Message */
.login-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.login-buttons button {
  width: 100%;
  padding: 0.875rem 1.5rem;
}

/* Filter Panel Styles */
.filter-panel {
  background: var(--white);
  border-radius: var(--border-radius);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(168, 192, 154, 0.2);
  overflow: hidden;
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--primary-cream), var(--white));
  border-bottom: 1px solid rgba(168, 192, 154, 0.1);
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--primary-sage) !important; 
  border: none !important;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-small);
  font-weight: 500;
  color: var(--text-dark);
  transition: var(--transition);
  position: relative;
  box-shadow: none !important;
}

.filter-toggle.active {
  background: var(--primary-sage) !important;
  color: var(--white) !important;
}

.filter-icon {
  font-size: 1.2rem;
}

.filter-badge {
  background: var(--primary-coral);
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  min-width: 20px;
  text-align: center;
}

.clear-filters-btn {
  border: 1px solid var(--primary-coral) !important;
  color: var(--primary-coral);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-small);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
  box-shadow: none !important;
}

.filter-content {
  padding: 1.5rem;
  background: var(--white);
}

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

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-label {
  font-weight: 600;
  color: var(--text-dark);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-select {
  padding: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: var(--border-radius-small);
  background: var(--white);
  font-size: 0.9rem;
  color: var(--text-dark);
  transition: var(--transition);
  width: 100%;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary-sage);
  box-shadow: 0 0 0 3px rgba(168, 192, 154, 0.1);
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--primary-cream);
  border-radius: var(--border-radius-small);
  border: 2px solid transparent;
  transition: var(--transition);
}

.filter-checkbox:hover {
  border-color: var(--primary-sage);
}

.filter-checkbox input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--primary-sage);
  transform: scale(1.2);
}

.filter-checkbox label {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-dark);
  cursor: pointer;
  font-weight: 500;
}

.dual-slider {
  width: 100%;
  position: relative;
  padding: 2rem 0;
}

.slider-container {
  position: relative;
  height: 2px;
  background: #e2e8f0;
  border-radius: 1px;
}

.slider-track-fill {
  position: absolute;
  height: 100%;
  background-color: #4299e1;
  z-index: 1;
  top: 0;
  border-radius: 1px;
}

input[type="range"] {
  position: absolute;
  width: 100%;
  height: 0;
  pointer-events: none;
  z-index: 2;
  background: none;
}

.thumb {
  pointer-events: auto;
  appearance: none;
  height: 2px;
  background: none;
}

.thumb::-webkit-slider-thumb {
  appearance: none;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: #2b6cb0;
  border: 2px solid white;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.thumb::-moz-range-thumb {
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: #2b6cb0;
  border: 2px solid white;
  cursor: pointer;
}

.labels {
  position: relative;
  margin-top: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #4a5568;
}

.label {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

.filter-reset {
  text-align: center;
  margin-top: 2rem;
}

/* Responsive adjustments for filter panel */
@media (max-width: 768px) {
  .filter-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .filter-toggle {
    justify-content: center;
  }
  
  .filter-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .filter-content {
    padding: 1rem;
  }
}

/* Back Button Styles */
.back-button-container {
  margin-top: 1.5rem;
  text-align: center;
}

.back-btn {
  color: var(--text-light);
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-small);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.back-btn:hover {
  background: var(--text-light) !important;
  color: var(--white);
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(113, 128, 150, 0.3) !important;
}

.back-btn:active {
  transform: translateY(0) !important;
}

.takeLoveit {
  color: #48bb78;
}
.takeLikeit {
  color: #38a169;
}
.takeItsok {
  color: #ecc94b;
}
.takeMeh {
  color: #ed8936;
}
.takeWTF {
  color: #f56565;
}

/* Responsive adjustments for back button */
@media (max-width: 768px) {
  .back-btn {
    font-size: 0.85rem;
    padding: 0.65rem 1.25rem;
  }
}

/* About link styling */
.about-link {
  margin-top: 0;
  margin-bottom: 120px; /* space for floating nav */
  font-size: 0.9rem;
}

.about-link a {
  color: var(--text-light);
  text-decoration: none;
  transition: var(--transition);
}

.about-link a:hover {
  color: var(--text-dark);
  text-decoration: underline;
}

/* About Page Table */
.dataset-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.dataset-table th,
.dataset-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e0e0e0;
  text-align: left;
}

.dataset-table th {
  background: var(--primary-sage);
  color: var(--white);
  font-weight: 600;
}

.dataset-table a {
  color: var(--accent-blue);
  text-decoration: none;
}

.dataset-table a:hover {
  text-decoration: underline;
}

/* Layout tweaks for about page */
.about-page {
  max-width: 800px;
  margin: 0 auto;
}

.under-construction {
  margin: 2rem;
}