/* Material Design 3 (MD3) Design System for 56 Ethnicities */
:root {
  /* Primary Color Palette - Blue theme */
  --md-sys-color-primary: #1B6CD6;
  --md-sys-color-on-primary: #FFFFFF;
  --md-sys-color-primary-container: #D8E2FF;
  --md-sys-color-on-primary-container: #001D43;
  
  /* Secondary Color Palette */
  --md-sys-color-secondary: #5B5F72;
  --md-sys-color-on-secondary: #FFFFFF;
  --md-sys-color-secondary-container: #DFE0EB;
  --md-sys-color-on-secondary-container: #171B2C;
  
  /* Tertiary Color Palette */
  --md-sys-color-tertiary: #775662;
  --md-sys-color-on-tertiary: #FFFFFF;
  --md-sys-color-tertiary-container: #FFD8E3;
  --md-sys-color-on-tertiary-container: #2D131D;
  
  /* Neutral Colors */
  --md-sys-color-background: #FDF8FF;
  --md-sys-color-on-background: #1A1C20;
  --md-sys-color-surface: #FDF8FF;
  --md-sys-color-on-surface: #1A1C20;
  --md-sys-color-surface-variant: #E0E2EC;
  --md-sys-color-on-surface-variant: #44474E;
  --md-sys-color-outline: #74777F;
  --md-sys-color-outline-variant: #C4C6D0;
  
  /* Error Color */
  --md-sys-color-error: #BA1A1A;
  --md-sys-color-on-error: #FFFFFF;
  
  /* Surface Tints */
  --md-sys-color-surface-tint: #1B6CD6;
  --md-sys-color-surface-container-lowest: #FFFFFF;
  --md-sys-color-surface-container-low: #F7F9FF;
  --md-sys-color-surface-container: #F1F3FA;
  --md-sys-color-surface-container-high: #EBEEF5;
  --md-sys-color-surface-container-highest: #E6E8EF;
  
  /* Typography */
  --md-sys-typescale-display-large: 400 57px/64px 'Roboto', sans-serif;
  --md-sys-typescale-display-medium: 400 45px/52px 'Roboto', sans-serif;
  --md-sys-typescale-display-small: 400 36px/44px 'Roboto', sans-serif;
  --md-sys-typescale-headline-large: 400 32px/40px 'Roboto', sans-serif;
  --md-sys-typescale-headline-medium: 400 28px/36px 'Roboto', sans-serif;
  --md-typescale-headline-small: 400 24px/32px 'Roboto', sans-serif;
  --md-sys-typescale-title-large: 400 22px/28px 'Roboto', sans-serif;
  --md-sys-typescale-title-medium: 500 16px/24px 'Roboto', sans-serif;
  --md-sys-typescale-title-small: 500 14px/20px 'Roboto', sans-serif;
  --md-sys-typescale-body-large: 400 16px/24px 'Roboto', sans-serif;
  --md-sys-typescale-body-medium: 400 14px/20px 'Roboto', sans-serif;
  --md-sys-typescale-body-small: 400 12px/16px 'Roboto', sans-serif;
  --md-sys-typescale-label-large: 500 14px/20px 'Roboto', sans-serif;
  --md-sys-typescale-label-medium: 500 12px/16px 'Roboto', sans-serif;
  --md-sys-typescale-label-small: 500 11px/16px 'Roboto', sans-serif;
  
  /* Shape */
  --md-sys-shape-corner-none: 0px;
  --md-sys-shape-corner-extra-small: 4px;
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-extra-large: 28px;
  --md-sys-shape-corner-full: 9999px;
  
  /* Elevation */
  --md-sys-elevation-1: 0 1px 2px rgba(0,0,0,0.12), 0 1px 3px 1px rgba(0,0,0,0.08);
  --md-sys-elevation-2: 0 1px 2px rgba(0,0,0,0.12), 0 2px 6px 2px rgba(0,0,0,0.08);
  --md-sys-elevation-3: 0 4px 8px 3px rgba(0,0,0,0.12), 0 1px 3px rgba(0,0,0,0.08);
  
  /* Shadows */
  --md-sys-shadow-key-umbra: 0 4px 8px 4px rgba(0,0,0,0.15);
  --md-sys-shadow-key-penumbra: 0 1px 3px rgba(0,0,0,0.3);
  --md-sys-shadow-ambient: 0 3px 6px 2px rgba(0,0,0,0.1);
}

/* Reset & Base */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font: var(--md-sys-typescale-body-large);
  background-color: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
  line-height: 1.6;
  min-height: 100vh;
}

/* Top App Bar */
.top-app-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--md-sys-elevation-2);
}

.top-app-bar h1 {
  font: var(--md-sys-typescale-headline-large);
  flex: 1;
}

.back-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--md-sys-shape-corner-full);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.back-btn:hover {
  background-color: var(--md-sys-color-surface-container-high);
}

.back-btn svg {
  width: 24px;
  height: 24px;
  fill: var(--md-sys-color-on-surface);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* Grid Layout for Index Page */
.ethnicity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 16px 0;
}

/* Card Component */
.ethnicity-card {
  background-color: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-large);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.ethnicity-card:hover {
  background-color: var(--md-sys-color-surface-container);
  box-shadow: var(--md-sys-elevation-2);
  transform: translateY(-2px);
}

.ethnicity-card:active {
  transform: translateY(0);
  box-shadow: var(--md-sys-elevation-1);
}

.card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background-color: var(--md-sys-color-surface-container-highest);
}

.card-content {
  padding: 16px;
  flex: 1;
}

.card-title {
  font: var(--md-sys-typescale-title-large);
  color: var(--md-sys-color-on-surface);
  margin-bottom: 8px;
}

.card-subtitle {
  font: var(--md-sys-typescale-body-medium);
  color: var(--md-sys-color-on-surface-variant);
}

.card-tag {
  display: inline-block;
  padding: 4px 12px;
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-radius: var(--md-sys-shape-corner-extra-small);
  font: var(--md-sys-typescale-label-medium);
  margin-top: 8px;
}

/* Detail Page Styles */
.detail-hero {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: var(--md-sys-shape-corner-extra-large);
  margin-bottom: 24px;
  background-color: var(--md-sys-color-surface-container-highest);
}

.detail-section {
  background-color: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-large);
  padding: 24px;
  margin-bottom: 16px;
}

.detail-section h2 {
  font: var(--md-sys-typescale-title-large);
  color: var(--md-sys-color-primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--md-sys-color-primary-container);
}

.detail-section p {
  font: var(--md-sys-typescale-body-large);
  color: var(--md-sys-color-on-surface);
  margin-bottom: 12px;
  text-align: justify;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.info-item {
  background-color: var(--md-sys-color-surface-container);
  padding: 16px;
  border-radius: var(--md-sys-shape-corner-medium);
}

.info-label {
  font: var(--md-sys-typescale-label-large);
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 4px;
}

.info-value {
  font: var(--md-sys-typescale-body-large);
  color: var(--md-sys-color-on-surface);
  font-weight: 500;
}

/* Navigation Chips */
.nav-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 24px 0;
}

.nav-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  border-radius: var(--md-sys-shape-corner-full);
  font: var(--md-sys-typescale-label-large);
  text-decoration: none;
  transition: all 0.2s;
}

.nav-chip:hover {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

/* FAB (Floating Action Button) */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: var(--md-sys-shape-corner-large);
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--md-sys-elevation-3);
  transition: all 0.3s;
}

.fab:hover {
  box-shadow: 0 6px 14px 4px rgba(0,0,0,0.15);
  transform: scale(1.05);
}

.fab svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 16px;
  }
  
  .ethnicity-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
  
  .card-image {
    height: 120px;
  }
  
  .detail-hero {
    height: 200px;
  }
  
  .top-app-bar {
    padding: 12px 16px;
  }
  
  .top-app-bar h1 {
    font-size: 20px;
  }
}

/* Loading placeholder for images */
.image-placeholder {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, var(--md-sys-color-primary-container) 0%, var(--md-sys-color-tertiary-container) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--md-sys-color-on-primary-container);
  font-size: 48px;
}

.detail-image-placeholder {
  width: 100%;
  height: 300px;
  background: linear-gradient(135deg, var(--md-sys-color-primary-container) 0%, var(--md-sys-color-tertiary-container) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--md-sys-color-on-primary-container);
  font-size: 72px;
  border-radius: var(--md-sys-shape-corner-extra-large);
  margin-bottom: 24px;
}

/* Chip filter */
.filter-section {
  margin-bottom: 24px;
}

.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 8px 16px;
  border-radius: var(--md-sys-shape-corner-full);
  border: 1px solid var(--md-sys-color-outline);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  font: var(--md-sys-typescale-label-large);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-chip:hover {
  background-color: var(--md-sys-color-surface-container-high);
}

.filter-chip.active {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-color: transparent;
}
