/* Navajo Profile CSS Theme */
:root {
  /* Primary Colors - Matching 164Tracker theme */
  --color-primary: #008bc8;
  --color-primary-dark: #0078a3;
  --color-accent: #40e0d0;
  --color-accent-dark: #20c0b0;
  --color-accent-3: #00bec8;
  
  /* Text Colors */
  --color-text: #333;
  --color-text-light: #666;
  --color-text-white: #fff;
  
  /* Background Colors */
  --color-bg-light: #f8f9fa;
  --color-bg-white: #fff;
  --color-border: #ddd;
  
  /* Status Colors */
  --color-success: #28a745;
  --color-warning: #ffc107;
  --color-error: #dc3545;
  --color-info: #17a2b8;
}

/* Global Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Roboto', Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--color-bg-light);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
  max-width: 100vw;
  box-sizing: border-box;
}

/* Main Container */
.navajo-profile-container {
  width: 100%;
  background-color: var(--color-bg-white);
}

/* Page Container adjustments for navbar integration */
.page-container {
  min-height: calc(100vh - 60px); /* Account for navbar height */
}

/* Tab Navigation */
.navajo-profile-nav {
  display: flex;
  background-color: var(--color-bg-light);
  border-bottom: 3px solid var(--color-accent);
  padding: 0;
  margin: 0;
  list-style: none;
}

.navajo-profile-tab {
  flex: 1;
  text-align: center;
  padding: 15px 20px;
  background-color: transparent;
  border: none;
  color: var(--color-text-light);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-bottom: 3px solid transparent;
}

.navajo-profile-tab:hover {
  background-color: rgba(64, 224, 208, 0.1);
  color: var(--color-accent);
}

.navajo-profile-tab.active {
  background-color: var(--color-accent);
  color: var(--color-text-white);
  border-bottom-color: var(--color-accent-dark);
}

/* Hero Section */
.hero-section {
  position: relative;
  height: 400px;
  background-image: url('https://navajoprofile-wind-dev.sks.com/images/profileImage.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 40px;
  color: var(--color-text-white);
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.2) 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 600px;
}

.hero-title {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 20px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-description {
  font-size: 18px;
  line-height: 1.6;
  margin-bottom: 0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Statistics Section */
.stats-section {
  background-color: var(--color-bg-white);
  padding: 40px;
  border-bottom: 1px solid var(--color-border);
}

.stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 36px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 8px;
  display: block;
}

.stat-label {
  font-size: 14px;
  color: var(--color-text-light);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-source {
  font-size: 12px;
  color: var(--color-text-light);
  margin-top: 5px;
  font-style: italic;
}

/* Content Layout */
.content-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 40px;
  padding: 40px;
  max-width: 100vw;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  overflow-x: hidden;
}

.content-main {
  background-color: var(--color-bg-white);
  min-width: 0; /* Allows grid item to shrink below content size */
  overflow-x: hidden;
}

.content-sidebar {
  background-color: var(--color-bg-light);
  padding: 20px;
  border-radius: 8px;
  height: fit-content;
  min-width: 0;
  flex-shrink: 0;
}

/* Section Styles */
.profile-section {
  margin-bottom: 30px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--color-primary);
  margin: 0;
}

.section-buttons {
  display: flex;
  gap: 10px;
}

.btn-share, .btn-print {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-share {
  background-color: var(--color-accent);
  color: var(--color-text-white);
}

.btn-share:hover {
  background-color: var(--color-accent-dark);
}

.btn-print {
  background-color: var(--color-primary);
  color: var(--color-text-white);
}

.btn-print:hover {
  background-color: var(--color-primary-dark);
}

/* Overview Text */
.overview-text {
  font-size: 16px;
  line-height: 1.8;
  color: var(--color-text);
  margin-bottom: 30px;
  text-align: justify;
}

.overview-text strong {
  color: var(--color-primary);
  font-weight: 600;
}

/* Collapsible Sections */
.collapsible-section {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  margin-bottom: 20px;
  overflow: hidden;
  background-color: var(--color-bg-white);
}

.collapsible-header {
  background-color: var(--color-bg-light);
  padding: 15px 20px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.3s ease;
  border-bottom: 1px solid var(--color-border);
}

.collapsible-header:hover {
  background-color: rgba(64, 224, 208, 0.1);
}

.collapsible-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-primary);
  margin: 0;
}

.collapsible-toggle {
  color: var(--color-accent);
  font-size: 18px;
  transition: transform 0.3s ease;
}

.collapsible-section.expanded .collapsible-toggle {
  transform: rotate(180deg);
}

.collapsible-content {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.collapsible-section.expanded .collapsible-content {
  padding: 20px;
  max-height: 1000px;
}

.collapsible-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text);
}

/* Map Placeholder */
.map-placeholder {
  background-color: var(--color-bg-light);
  border: 2px dashed var(--color-border);
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  color: var(--color-text-light);
  height: 600px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.map-placeholder-icon {
  font-size: 48px;
  margin-bottom: 20px;
  color: var(--color-accent);
}

.map-placeholder-text {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}

.map-placeholder-description {
  font-size: 14px;
  opacity: 0.7;
}

/* Agencies/Chapters List */
.agencies-list {
  background-color: var(--color-bg-white);
  border-radius: 8px;
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.agencies-title {
  background-color: var(--color-accent);
  color: var(--color-text-white);
  padding: 15px 20px;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
}

.agency-item {
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-light);
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.agency-item:hover {
  background-color: var(--color-bg-light);
  color: var(--color-primary);
}

.agency-item:last-child {
  border-bottom: none;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .content-layout {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
    max-width: 100vw;
    width: 100%;
  }
  
  .content-sidebar {
    order: -1;
    width: 100%;
  }
  
  .content-main {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .navajo-profile-tab {
    padding: 12px 10px;
    font-size: 12px;
  }
  
  .hero-section {
    height: 300px;
    padding: 20px;
  }
  
  .hero-title {
    font-size: 36px;
  }
  
  .hero-description {
    font-size: 16px;
  }
  
  .stats-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  
  .stat-number {
    font-size: 28px;
  }
  
  .content-layout {
    padding: 15px;
    max-width: 100vw;
    width: 100%;
  }
  
  .population-table {
    font-size: 10px;
  }
  
  .population-table th,
  .population-table td {
    padding: 8px 4px;
    font-size: 9px;
  }
}

/* Population By State Section Styles */
.population-section-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px;
  background-color: var(--color-bg-light);
  border-radius: 6px;
}

.year-selector-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

.year-selector {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background-color: var(--color-bg-white);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
}

.year-description {
  font-size: 14px;
  color: var(--color-text-light);
  font-style: italic;
}

.population-print-btn {
  padding: 8px 16px;
  background-color: var(--color-primary);
  color: var(--color-text-white);
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.population-print-btn:hover {
  background-color: var(--color-primary-dark);
}

/* View Toggle Styles */
.view-toggle-container {
  display: flex;
  margin-bottom: 20px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  width: fit-content;
}

.view-toggle-btn {
  padding: 10px 20px;
  background-color: var(--color-bg-white);
  border: none;
  color: var(--color-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  border-right: 1px solid var(--color-border);
}

.view-toggle-btn:last-child {
  border-right: none;
}

.view-toggle-btn.active {
  background-color: var(--color-accent);
  color: var(--color-text-white);
}

.view-toggle-btn:hover:not(.active) {
  background-color: var(--color-bg-light);
}

/* Population Views */
.population-view {
  display: none;
}

.population-view.active {
  display: block;
}

/* Population Table Styles */
.population-table-container {
  border: 2px solid var(--color-border);
  border-radius: 8px;
  background-color: var(--color-bg-white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: visible; /* Remove horizontal scroll since table now fits */
}

.population-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed; /* Use fixed layout for consistent column widths */
}

.population-table th {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 10px 6px;
  text-align: center;
  font-weight: 700;
  color: var(--color-text);
  border-bottom: 3px solid var(--color-primary);
  border-right: 1px solid var(--color-border);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: normal; /* Allow text wrapping */
  word-wrap: break-word;
  position: sticky;
  top: 0;
  z-index: 10;
  line-height: 1.2;
}

/* Specific column widths */
.population-table th:nth-child(1) { width: 12%; } /* State */
.population-table th:nth-child(2) { width: 12%; } /* Navajo Alone */
.population-table th:nth-child(3) { width: 14%; } /* Navajo Alone On Reservation */
.population-table th:nth-child(4) { width: 14%; } /* Navajo Alone Off Reservation */
.population-table th:nth-child(5) { width: 16%; } /* Navajo Alone Or In Combination */
.population-table th:nth-child(6) { width: 16%; } /* Navajo Alone Or In Combination On Reservation */
.population-table th:nth-child(7) { width: 16%; } /* Navajo Alone Or In Combination Off Reservation */

.population-table th:first-child {
  text-align: left;
  border-left: none;
}

.population-table th:last-child {
  border-right: none;
}

.population-table td {
  padding: 10px 6px;
  border-bottom: 1px solid #e9ecef;
  border-right: 1px solid #f1f3f5;
  color: var(--color-text);
  text-align: center;
  font-weight: 500;
  transition: background-color 0.2s ease;
  font-size: 11px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.population-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--color-primary);
  background-color: #f8f9fa;
  border-left: 3px solid var(--color-accent);
  border-right: 2px solid var(--color-border);
}

.population-table td:last-child {
  border-right: none;
}

.population-table tr:nth-child(even) {
  background-color: #fafbfc;
}

.population-table tr:nth-child(odd) {
  background-color: #ffffff;
}

.population-table tr:hover {
  background-color: rgba(64, 224, 208, 0.1);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.population-table tr:hover td:first-child {
  background-color: rgba(64, 224, 208, 0.15);
}

.population-table .highlight-cell {
  background-color: var(--color-accent) !important;
  color: var(--color-text-white) !important;
  font-weight: 700 !important;
  position: relative;
}

.population-table .highlight-cell::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
  pointer-events: none;
}

/* Graph View Styles */
.graph-container {
  background-color: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 20px;
}

.graph-header {
  text-align: center;
  margin-bottom: 20px;
}

.graph-header h4 {
  margin: 0 0 5px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
}

.graph-subtitle {
  font-size: 14px;
  color: var(--color-text-light);
}

.graph-legend {
  margin-bottom: 25px;
  padding: 20px;
  background-color: #fffbf0;
  border-radius: 8px;
  border: 1px solid #f0e68c;
}

.legend-note {
  font-size: 14px;
  color: var(--color-text);
  margin-bottom: 15px;
  font-weight: 500;
  text-align: center;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text);
  margin-right: 20px;
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.3s ease;
  user-select: none;
}

.legend-item.clickable {
  cursor: pointer;
  border: 2px solid transparent;
}

.legend-item.clickable:hover {
  background-color: rgba(255, 255, 255, 0.8);
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.legend-item.clickable.active {
  background-color: rgba(64, 224, 208, 0.1);
  border-color: var(--color-accent);
  font-weight: 600;
}

.legend-item.clickable.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background-color: #f5f5f5;
}

.legend-item.clickable.disabled:hover {
  transform: none;
  box-shadow: none;
  border-color: transparent;
}

.legend-color {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

/* Chart Styles */
.graph-chart-container {
  position: relative;
  width: 100%;
  height: 500px;
  background-color: var(--color-bg-white);
  border-radius: 6px;
  padding: 20px;
  border: 1px solid var(--color-border);
}

#population-chart {
  width: 100% !important;
  height: 100% !important;
}

.chart-bar-container {
  margin-bottom: 15px;
}

.chart-state-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 5px;
  text-align: right;
  padding-right: 10px;
  width: 100px;
  display: inline-block;
}

.chart-bars-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-bars {
  flex: 1;
  position: relative;
  height: 20px;
  background-color: var(--color-bg-light);
  border-radius: 3px;
  overflow: hidden;
}

.chart-bar {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 2px;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.chart-bar:hover {
  opacity: 1;
}

.chart-values {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--color-text);
  white-space: nowrap;
}

@media (max-width: 1024px) {
  .population-section-controls {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }
  
  .year-selector-container {
    justify-content: center;
  }
  
  .graph-legend {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .population-table {
    font-size: 10px;
  }
  
  .population-table th,
  .population-table td {
    padding: 8px 3px;
    font-size: 9px;
  }
  
  .population-table th {
    font-size: 8px;
    line-height: 1.1;
  }
  
  .graph-legend {
    gap: 10px;
  }
  
  .legend-item {
    font-size: 11px;
  }
  
  .chart-state-label {
    font-size: 12px;
    width: 80px;
  }
}

@media (max-width: 480px) {
  .stats-container {
    grid-template-columns: 1fr;
  }
  
  .hero-title {
    font-size: 28px;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .view-toggle-btn {
    padding: 8px 12px;
    font-size: 12px;
  }
}
