:root {
  /* Colors matches reference-ui-clear.jpg */
  --bg-dark: #0b0e14;
  /* --bg-card: #151a23; */
  --bg-card-hover: #1a202c;
  --border-color: #2d3748;

  --text-primary: #ffffff;
  --text-secondary: #94a3b8;

  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-blue-light: rgba(59, 130, 246, 0.15);

  --accent-green: #10b981;
  --accent-green-light: rgba(16, 185, 129, 0.15);

  --accent-purple: #8b5cf6;
  --accent-purple-light: rgba(139, 92, 246, 0.15);

  --map-fill: #1e293b;
  --map-stroke: #334155;

  /* Typography */
  --font-family: "Inter", sans-serif;

  /* Spacing & Radii */
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  overflow: hidden; /* App takes exactly 100vh */
}

/* Base Utility Classes */
.hidden {
  display: none !important;
}
.accent-blue {
  color: var(--accent-blue) !important;
}
.accent-green {
  color: var(--accent-green) !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* App Container */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Mobile Header (Hidden on Desktop) */
.mobile-header {
  display: none;
  padding: 1rem 1.5rem;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  align-items: center;
  justify-content: space-between;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--bg-dark);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 2rem 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 0 1rem;
  gap: 0.5rem;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.875rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.nav-item:hover {
  color: var(--text-primary);
  background-color: var(--bg-card);
}

.nav-item.active {
  color: var(--text-primary);
  background-color: var(--accent-blue-light);
  position: relative;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -1rem;
  top: 50%;
  transform: translateY(-50%);
  height: 70%;
  width: 4px;
  background-color: var(--accent-blue);
  border-radius: 0 4px 4px 0;
}

.sidebar-stats {
  margin: 2rem 1.5rem;
  padding: 1.5rem;
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.stat-block {
  margin-bottom: 1.5rem;
}

.stat-block:last-child {
  margin-bottom: 0;
}

.stat-number {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.sidebar-footer {
  padding: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.sidebar-footer a {
  color: #94a3b8;
  text-decoration: blink;
}

.social-icons {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.social-icons a {
  color: var(--text-secondary);
  transition: var(--transition);
}
.social-icons a:hover {
  color: var(--text-primary);
}

/* Main Content */
.main-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 2.5rem;
  background-color: var(--bg-dark);
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Cards */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

/* Dashboard Grid Layout */
.dashboard-grid {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
  height: 600px; /* Fixed height for consistent internal scrolling */
}

/* Map Card */
.map-card {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.map-header {
  /* display: flex; */
  display: none;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.map-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.map-header p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.theme-toggle {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-dark);
  padding: 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}
.theme-toggle svg {
  color: var(--text-secondary);
  cursor: pointer;
}

.map-container {
  flex-grow: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

svg.us-map {
  width: 100%;
  height: 100%;
  /* max-height: 1050px; */
  filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.5));
}

svg.us-map path {
  fill: var(--map-fill);
  stroke: var(--map-stroke);
  stroke-width: 2px; /* Increased slightly to make the rounding visible */
  stroke-linejoin: round; /* This rounds the corners of the states */
  stroke-linecap: round;
  cursor: pointer;
  transition: all 0.2s ease;
}

svg.us-map path:hover {
  fill: var(--accent-blue-hover);
  stroke: var(--text-primary);
}

/* State Abbreviations (AL, AK, CA, etc.) */
svg.us-map text {
  font-size: 15px; /* Change this number to make it bigger or smaller */
  font-weight: 600;
  fill: var(--text-secondary); /* Matches your cool gray theme */
  pointer-events: none; /* Prevents text from interfering with hover */
  user-select: none;
}

svg.us-map path.active {
  fill: var(--accent-blue);
  stroke: var(--text-primary);
  stroke-width: 1.5;
  filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.6));
}

/* Map Tooltip */
.map-tooltip {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 10;
  transform: translate(-50%, -100%);
  margin-top: -10px;
}

.tooltip-state {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.tooltip-cities {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* State Detail Card (Right Side) */
.state-detail-card {
  width: 450px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-family);
  transition: var(--transition);
}

.btn-back:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.btn-icon:hover,
.btn-icon.active {
  color: var(--text-primary);
}
.btn-icon.active svg {
  fill: var(--text-primary);
}

.state-title-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.state-title-row h2 {
  font-size: 1.75rem;
  font-weight: 700;
}

.badge {
  background: var(--accent-blue-light);
  color: var(--accent-blue);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.state-number {
  margin-left: auto;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.cities-count-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

/* Cities List */
.cities-list {
  flex-grow: 1;
  overflow-y: auto;
  margin-bottom: 1rem;
  padding-right: 0.5rem;
}

.city-row {
  display: flex;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
}
.city-row:last-child {
  border-bottom: none;
}

.city-serial {
  color: var(--text-secondary);
  width: 30px;
  font-size: 0.875rem;
}

.city-name {
  flex-grow: 1;
  font-weight: 500;
}

.btn-copy {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  color: var(--accent-blue);
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 0.875rem;
  opacity: 0.8;
  transition: var(--transition);
}
.btn-copy:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.page-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.page-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.page-btn.active {
  background: var(--accent-blue);
  color: var(--text-primary);
  font-weight: 600;
}
.page-btn.text-btn {
  width: auto;
  padding: 0 0.5rem;
}
.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.page-ellipsis {
  color: var(--text-secondary);
}

/* Bottom Info Cards */
.info-cards-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.info-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-wrap.blue {
  background: var(--accent-blue-light);
  color: var(--accent-blue);
}
.icon-wrap.green {
  background: var(--accent-green-light);
  color: var(--accent-green);
}
.icon-wrap.purple {
  background: var(--accent-purple-light);
  color: var(--accent-purple);
}

.info-text h4 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.info-text p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Standard List View (Favorites / Recent) */
.standard-list-container {
  max-width: 800px;
  margin-top: 1.5rem;
}

.state-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}
.state-row:last-child {
  border-bottom: none;
}
.state-row:hover {
  background: var(--bg-card-hover);
}
.state-row-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.state-row-name {
  font-weight: 600;
  font-size: 1.125rem;
}

/* About View */
.about-card {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem !important;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2rem;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: white;
}

.profile-title h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.profile-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.profile-skills .badge {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border-radius: var(--radius-full);
}

.profile-bio {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 1.125rem;
  margin-bottom: 3rem;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
}

.btn-primary {
  background: var(--accent-blue);
  color: white;
}
.btn-primary:hover {
  background: var(--accent-blue-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 1000;
}

.toast {
  background: var(--accent-green);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateY(100%);
  opacity: 0;
  animation: slideUp 0.3s forwards;
}

@keyframes slideUp {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@keyframes fadeOut {
  to {
    opacity: 0;
  }
}

/* Responsive Design */
@media (max-width: 1200px) {
  .dashboard-grid {
    height: auto;
    flex-direction: column;
  }
  .map-card {
    min-height: 500px;
  }
  .state-detail-card {
    width: 100%;
    height: 600px;
  }
}

@media (max-width: 992px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-header {
    display: flex;
  }
  .main-content {
    padding: 1.5rem;
  }
  .app-container {
    flex-direction: column;
  }
  .info-cards-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .map-card {
    min-height: 400px;
  }
  .profile-header {
    flex-direction: column;
    text-align: center;
  }
  .profile-skills {
    justify-content: center;
  }
  .profile-links {
    justify-content: center;
  }
  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }
}
