/* Pittsburgh Neighborhood Collector — Main Styles */
@import url('https://fonts.googleapis.com/css2?family=Righteous&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --gold: #FFB81C;
  --gold-dark: #E5A200;
  --gold-light: #FFD166;
  --black: #1a1a1a;
  --black-soft: #2d2d2d;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --visited: #FFB81C;
  --unvisited: #9ca3af;
  --current: #22c55e;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--gray-50);
  color: var(--black);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
}

h1, h2, h3 {
  font-family: 'Righteous', cursive;
  line-height: 1.2;
}

a { color: var(--gold-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.page-wrapper {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  padding: 1rem;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.main-content.wide {
  max-width: 900px;
}

.main-content.full {
  max-width: 100%;
  padding: 0;
}

/* ===== Nav Bar ===== */
.navbar {
  background: var(--black);
  color: var(--white);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow);
}

.navbar-brand {
  font-family: 'Righteous', cursive;
  font-size: 1.25rem;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-brand:hover { text-decoration: none; color: var(--gold-light); }

.navbar-nav {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}

.navbar-nav a {
  color: var(--gray-300);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--gold);
  background: rgba(255,184,28,0.1);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
}

/* ===== Cards ===== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--black);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  line-height: 1.4;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--gold);
  color: var(--black);
}
.btn-primary:hover { background: var(--gold-dark); }

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.25rem;
  border-radius: var(--radius);
  width: 100%;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--gold);
  color: var(--gold-dark);
}
.btn-outline:hover {
  background: var(--gold);
  color: var(--black);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-danger:hover { background: #dc2626; }

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.375rem;
  color: var(--gray-700);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
  background: var(--white);
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255,184,28,0.2);
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

/* ===== Alerts ===== */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.9375rem;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert-info {
  background: #fefce8;
  color: #854d0e;
  border: 1px solid #fef08a;
}

/* ===== Auth Pages (Login/Register) ===== */
.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
  padding: 1rem;
}

.auth-container {
  width: 100%;
  max-width: 420px;
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header h1 {
  font-family: 'Righteous', cursive;
  font-size: 2rem;
  color: var(--gold);
  margin-bottom: 0.5rem;
}

.auth-header p {
  color: var(--gray-400);
  font-size: 0.9375rem;
}

.auth-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--gray-400);
  font-size: 0.875rem;
}

.auth-footer a { color: var(--gold); }

.admin-link {
  display: block;
  text-align: center;
  margin-top: 2rem;
  font-size: 0.75rem;
  color: var(--gray-600);
  opacity: 0.5;
  transition: opacity 0.2s;
}
.admin-link:hover { opacity: 1; }

/* ===== Check-in Page ===== */
.checkin-section {
  text-align: center;
  padding: 2rem 0;
}

.neighborhood-photo-wrapper {
  position: relative;
  max-width: 400px;
  margin: 0 auto 1rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.neighborhood-photo {
  width: 100%;
  height: auto;
  display: block;
  transition: filter 0.8s ease, opacity 0.8s ease;
}

.neighborhood-photo.locked {
  filter: grayscale(100%) brightness(0.7);
  opacity: 0.6;
}

.neighborhood-photo.unlocked {
  filter: grayscale(0%) brightness(1);
  opacity: 1;
}

.photo-lock-badge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: var(--gold);
  text-align: center;
  padding: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: opacity 0.5s ease;
}

.photo-lock-badge.hidden {
  opacity: 0;
  pointer-events: none;
}

.location-status {
  font-size: 0.9375rem;
  color: var(--gray-500);
  margin-bottom: 1rem;
}

.location-status .accuracy {
  font-size: 0.8125rem;
  color: var(--gray-400);
}

.neighborhood-display {
  margin: 1.5rem 0;
}

.neighborhood-display h2 {
  font-size: 1.75rem;
  color: var(--gold-dark);
  margin-bottom: 0.25rem;
}

.neighborhood-display .subtitle {
  color: var(--gray-500);
}

.checkin-btn-wrapper {
  margin: 2rem 0;
}

.outside-message {
  background: var(--black);
  color: var(--gold);
  padding: 2rem;
  border-radius: var(--radius);
  font-family: 'Righteous', cursive;
  font-size: 1.125rem;
  line-height: 1.5;
}

/* ===== Celebration Modal ===== */
.celebration-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
  animation: fadeIn 0.3s;
}

.celebration-card {
  background: var(--white);
  border-radius: var(--radius);
  max-width: 400px;
  width: 100%;
  text-align: center;
  overflow: hidden;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.celebration-photo {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--gray-200);
}

.celebration-body {
  padding: 1.5rem;
}

.celebration-body h2 {
  font-size: 1.5rem;
  color: var(--gold-dark);
  margin-bottom: 0.5rem;
}

.celebration-message {
  font-family: 'Righteous', cursive;
  font-size: 1.125rem;
  color: var(--black);
  margin: 1rem 0;
  line-height: 1.5;
}

.celebration-fact {
  background: var(--gray-50);
  padding: 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  color: var(--gray-700);
  margin: 1rem 0;
  text-align: left;
}

.celebration-count {
  font-weight: 700;
  color: var(--gold-dark);
  font-size: 1.125rem;
  margin-bottom: 1rem;
}

.celebration-attribution {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 0.5rem;
}

.celebration-close {
  margin-top: 0.5rem;
}

/* ===== Already Visited ===== */
.already-visited {
  background: var(--gray-50);
  padding: 1.5rem;
  border-radius: var(--radius);
  text-align: center;
}

.already-visited p {
  font-family: 'Righteous', cursive;
  color: var(--gray-600);
  font-size: 1.125rem;
}

/* ===== Map ===== */
.map-container {
  position: relative;
  height: calc(100vh - 56px);
  height: calc(100dvh - 56px);
  width: 100%;
}

#map {
  width: 100%;
  height: 100%;
}

.map-progress-overlay {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 999;
  background: var(--black);
  color: var(--gold);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-family: 'Righteous', cursive;
  font-size: 1.25rem;
  box-shadow: var(--shadow-lg);
}

/* ===== Leaderboard ===== */
.leaderboard-list {
  list-style: none;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background 0.2s;
}

.leaderboard-item:hover {
  background: var(--gray-50);
}

.leaderboard-rank {
  font-family: 'Righteous', cursive;
  font-size: 1.25rem;
  width: 2.5rem;
  text-align: center;
  color: var(--gray-400);
}

.leaderboard-rank.top-3 {
  color: var(--gold);
}

.leaderboard-info {
  flex: 1;
  margin-left: 0.75rem;
}

.leaderboard-name {
  font-weight: 600;
  font-size: 1rem;
}

.leaderboard-date {
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.leaderboard-count {
  font-family: 'Righteous', cursive;
  font-size: 1.125rem;
  color: var(--gold-dark);
}

/* ===== Profile ===== */
.profile-header {
  text-align: center;
  padding: 1.5rem 0;
}

.profile-header h1 {
  font-size: 1.75rem;
  color: var(--gold-dark);
}

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin: 1rem 0;
}

.profile-stat {
  text-align: center;
}

.profile-stat .value {
  font-family: 'Righteous', cursive;
  font-size: 2rem;
  color: var(--gold-dark);
}

.profile-stat .label {
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.visit-list {
  list-style: none;
}

.visit-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--gray-100);
}

.visit-item .name {
  font-weight: 600;
}

.visit-item .date {
  font-size: 0.8125rem;
  color: var(--gray-500);
}

/* ===== Loading ===== */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--gray-500);
}

.loading::after {
  content: '';
  display: block;
  width: 2rem;
  height: 2rem;
  margin: 1rem auto 0;
  border: 3px solid var(--gray-200);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-inline {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--gray-200);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}

/* ===== Confetti ===== */
.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  z-index: 3000;
  pointer-events: none;
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

/* ===== Mobile Responsive ===== */
@media (max-width: 640px) {
  .nav-toggle { display: block; }

  .navbar-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--black);
    flex-direction: column;
    padding: 0.5rem;
    border-top: 1px solid var(--gray-700);
  }

  .navbar-nav.open { display: flex; }

  .navbar-nav a {
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }

  .auth-header h1 { font-size: 1.5rem; }
  .auth-card { padding: 1.5rem; }
  .celebration-photo { height: 150px; }
}

/* ===== Leaflet Popup Override ===== */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-sm) !important;
}

.leaflet-popup-content {
  margin: 0.75rem 1rem !important;
  font-family: 'Inter', sans-serif !important;
  line-height: 1.5 !important;
}

.popup-neighborhood-name {
  font-family: 'Righteous', cursive;
  font-size: 1.125rem;
  color: var(--gold-dark);
  margin-bottom: 0.25rem;
}

.popup-visited {
  color: var(--success);
  font-weight: 600;
  font-size: 0.875rem;
}

.popup-unvisited {
  color: var(--gray-400);
  font-size: 0.875rem;
}

.popup-fact {
  font-size: 0.8125rem;
  color: var(--gray-600);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--gray-100);
}

.popup-facts-carousel {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--gray-100);
}

.popup-facts-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.375rem;
}

.popup-nav-btn {
  background: var(--gray-100);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
}

.popup-nav-btn:hover {
  background: var(--gold);
  color: var(--black);
}

.popup-facts-counter {
  font-size: 0.6875rem;
  color: var(--gray-400);
}

.popup-photo {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 4px;
  margin-top: 0.5rem;
}

.popup-photo-locked {
  filter: grayscale(100%) brightness(0.7);
  opacity: 0.5;
}

/* ===== Utility ===== */
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-gold { color: var(--gold-dark); }
.text-sm { font-size: 0.875rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }
