/* ===== RailRoom Shared Styles ===== */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

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

:root {
  --rust: #B7410E;
  --rust-light: #D4622B;
  --rust-dark: #8A3009;
  --iron: #2C2C2C;
  --sleeper: #1A1A1A;
  --ballast: #4A4A4A;
  --pine: #2D5016;
  --pine-light: #3D6B1F;
  --sky: #E8DDD3;
  --cream: #F5F0EA;
  --gold: #C8A951;
  --gold-light: #DBBF6B;
  --danger: #DC3545;
  --warning: #E8A317;
  --success: #2D7D46;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  color: var(--iron);
  background: var(--cream);
  overflow-x: hidden;
  line-height: 1.6;
}

h1, h2, h3, h4, h5 {
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1.2;
}

a {
  color: var(--rust);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--rust-light);
}

/* ===== NAV ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--sleeper);
  border-bottom: 3px solid var(--rust);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--cream);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-brand .rail-icon {
  width: 24px;
  height: 3px;
  background: var(--rust);
  position: relative;
}

.nav-brand .rail-icon::before,
.nav-brand .rail-icon::after {
  content: '';
  position: absolute;
  width: 3px;
  height: 7px;
  background: var(--rust-light);
  top: -2px;
}
.nav-brand .rail-icon::before { left: 4px; }
.nav-brand .rail-icon::after { right: 4px; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links a {
  color: var(--sky);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--rust-light);
}

/* ===== EXPLORE PAGE ===== */
.explore-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  height: 100vh;
  padding-top: 56px;
}

.sidebar {
  background: var(--sleeper);
  color: var(--sky);
  overflow-y: auto;
  border-right: 3px solid var(--rust);
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(183, 65, 14, 0.2);
}

.sidebar-header h2 {
  font-size: 1.1rem;
  color: var(--cream);
  margin-bottom: 4px;
}

.sidebar-header .route-count {
  font-size: 0.8rem;
  color: var(--ballast);
}

/* ===== FILTERS ===== */
.filters {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(183, 65, 14, 0.15);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-row {
  display: flex;
  gap: 8px;
}

.filter-select,
.filter-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(183, 65, 14, 0.2);
  color: var(--cream);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.filter-select:focus,
.filter-input:focus {
  border-color: var(--rust);
}

.filter-select option {
  background: var(--sleeper);
  color: var(--cream);
}

.filter-input::placeholder {
  color: var(--ballast);
}

.filter-clear {
  background: transparent;
  border: 1px solid rgba(183, 65, 14, 0.3);
  color: var(--rust-light);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.filter-clear:hover {
  background: rgba(183, 65, 14, 0.1);
  border-color: var(--rust);
}

/* ===== ROUTE LIST ===== */
.route-list {
  padding: 8px 0;
}

.route-card {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  transition: background 0.15s ease;
}

.route-card:hover {
  background: rgba(183, 65, 14, 0.08);
}

.route-card.active {
  background: rgba(183, 65, 14, 0.15);
  border-left: 3px solid var(--rust);
}

.route-card-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cream);
  margin-bottom: 4px;
}

.route-card-desc {
  font-size: 0.78rem;
  color: var(--ballast);
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.route-card-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.route-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tag-length {
  background: rgba(200, 169, 81, 0.15);
  color: var(--gold-light);
}

.tag-condition-good {
  background: rgba(45, 125, 70, 0.2);
  color: #5ABD7E;
}

.tag-condition-fair {
  background: rgba(232, 163, 23, 0.2);
  color: var(--warning);
}

.tag-condition-poor {
  background: rgba(220, 53, 69, 0.2);
  color: #EF6B7B;
}

.tag-region {
  background: rgba(183, 65, 14, 0.15);
  color: var(--rust-light);
}

.tag-status {
  background: rgba(255,255,255,0.06);
  color: var(--ballast);
}

/* ===== MAP ===== */
.map-container {
  position: relative;
  background: var(--iron);
}

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

/* Leaflet popup styling */
.leaflet-popup-content-wrapper {
  background: var(--sleeper) !important;
  color: var(--cream) !important;
  border: 1px solid var(--rust) !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4) !important;
}

.leaflet-popup-tip {
  background: var(--sleeper) !important;
  border: 1px solid var(--rust) !important;
}

.leaflet-popup-close-button {
  color: var(--ballast) !important;
}

.popup-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.popup-desc {
  font-size: 0.78rem;
  color: var(--ballast);
  margin-bottom: 8px;
  line-height: 1.4;
}

.popup-link {
  display: inline-block;
  background: var(--rust);
  color: var(--cream) !important;
  padding: 5px 14px;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: background 0.2s ease;
}

.popup-link:hover {
  background: var(--rust-light);
}

/* ===== ROUTE DETAIL PAGE ===== */
.detail-page {
  padding-top: 56px;
  min-height: 100vh;
}

.detail-hero {
  background: var(--sleeper);
  padding: 48px 40px 40px;
  position: relative;
  overflow: hidden;
}

.detail-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 48%,
    rgba(183, 65, 14, 0.06) 48%,
    rgba(183, 65, 14, 0.06) 52%,
    transparent 52%
  );
  pointer-events: none;
}

.detail-hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--rust);
}

.detail-breadcrumb {
  font-size: 0.8rem;
  color: var(--ballast);
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.detail-breadcrumb a {
  color: var(--rust-light);
}

.detail-hero h1 {
  font-size: 2.2rem;
  color: var(--cream);
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.detail-hero-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.detail-hero-meta .route-tag {
  font-size: 0.78rem;
  padding: 4px 12px;
}

.detail-body {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 40px;
}

.detail-description {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--iron);
  margin-bottom: 32px;
}

.detail-section {
  margin-bottom: 32px;
}

.detail-section h3 {
  font-size: 1rem;
  color: var(--rust);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(183, 65, 14, 0.15);
}

.detail-section p,
.detail-section ul {
  font-size: 0.95rem;
  color: var(--iron);
  line-height: 1.7;
}

.detail-section ul {
  list-style: none;
  padding: 0;
}

.detail-section ul li {
  padding: 4px 0 4px 20px;
  position: relative;
}

.detail-section ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  width: 8px;
  height: 3px;
  background: var(--rust);
}

/* Sidebar info card */
.detail-info-card {
  background: var(--sleeper);
  border-radius: 12px;
  padding: 24px;
  border: 1px solid rgba(183, 65, 14, 0.2);
  position: sticky;
  top: 80px;
}

.info-card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  color: var(--rust-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 0.88rem;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--ballast);
}

.info-value {
  color: var(--cream);
  font-weight: 500;
  text-align: right;
}

.detail-map {
  margin-top: 20px;
  border-radius: 8px;
  overflow: hidden;
  height: 200px;
  border: 1px solid rgba(183, 65, 14, 0.2);
}

.back-to-explore {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--rust);
  color: var(--cream);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: background 0.2s ease;
  margin-top: 24px;
}

.back-to-explore:hover {
  background: var(--rust-light);
  color: var(--cream);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  padding: 40px 20px;
  text-align: center;
}

.empty-state p {
  color: var(--ballast);
  font-size: 0.88rem;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 900px) {
  .explore-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    max-height: 45vh;
    border-right: none;
    border-bottom: 3px solid var(--rust);
  }

  .map-container {
    min-height: 55vh;
  }

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

  .detail-info-card {
    position: static;
  }

  .detail-hero h1 {
    font-size: 1.6rem;
  }

  .detail-body {
    padding: 24px 16px;
  }

  .detail-hero {
    padding: 32px 16px 28px;
  }
}

@media (max-width: 600px) {
  .nav {
    padding: 0 12px;
  }

  .nav-links {
    gap: 12px;
  }

  .nav-links a {
    font-size: 0.75rem;
  }
}

/* ===== LOADING ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(183, 65, 14, 0.2);
  border-top-color: var(--rust);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== SIDEBAR WAITLIST ===== */
.sidebar-waitlist {
  padding: 20px;
  border-top: 1px solid rgba(183, 65, 14, 0.2);
  background: rgba(183, 65, 14, 0.05);
}

.sidebar-waitlist-header {
  margin-bottom: 14px;
}

.sidebar-waitlist-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--rust-light);
  display: block;
  margin-bottom: 4px;
}

.sidebar-waitlist h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cream);
  margin-bottom: 2px;
}

.sidebar-waitlist p {
  font-size: 0.78rem;
  color: var(--ballast);
  margin-bottom: 0;
}

.sidebar-wl-input,
.sidebar-wl-select {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(183, 65, 14, 0.2);
  color: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  padding: 8px 12px;
  border-radius: 6px;
  outline: none;
  margin-bottom: 8px;
  transition: border-color 0.2s;
  display: block;
}

.sidebar-wl-input::placeholder { color: var(--ballast); }

.sidebar-wl-input:focus,
.sidebar-wl-select:focus {
  border-color: var(--rust);
}

.sidebar-wl-select option {
  background: var(--sleeper);
  color: var(--cream);
}

.sidebar-wl-btn {
  width: 100%;
  background: var(--rust);
  color: var(--cream);
  border: none;
  border-radius: 6px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.sidebar-wl-btn:hover:not(:disabled) { background: var(--rust-light); }
.sidebar-wl-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.sidebar-wl-success {
  text-align: center;
  padding: 8px 0 4px;
}

.sidebar-wl-success strong {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  color: var(--gold);
  display: block;
  margin-bottom: 4px;
}

.sidebar-wl-success p {
  font-size: 0.78rem;
  color: var(--ballast);
}

.sidebar-suggest-link {
  display: block;
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--rust-light);
  text-align: center;
  text-decoration: none;
  transition: color 0.2s;
}

.sidebar-suggest-link:hover { color: var(--gold); }

/* ===== SUGGEST ROUTE PAGE ===== */
.suggest-page {
  padding-top: 56px;
  min-height: 100vh;
  background: var(--sleeper);
}

.suggest-hero {
  padding: 60px 40px 48px;
  position: relative;
  overflow: hidden;
  border-bottom: 3px solid var(--rust);
}

.suggest-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 48%,
    rgba(183, 65, 14, 0.06) 48%,
    rgba(183, 65, 14, 0.06) 52%,
    transparent 52%
  );
  pointer-events: none;
}

.suggest-hero-tag {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--rust-light);
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.suggest-hero h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  color: var(--cream);
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.suggest-hero p {
  font-size: 1rem;
  color: rgba(245,240,234,0.6);
  max-width: 600px;
  position: relative;
  z-index: 1;
}

.suggest-body {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 40px;
}

.suggest-form-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(183, 65, 14, 0.18);
  border-radius: 16px;
  padding: 40px;
}

.suggest-form-section {
  margin-bottom: 28px;
}

.suggest-section-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--rust-light);
  margin-bottom: 16px;
  display: block;
}

.suggest-field-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.suggest-field-group.single {
  grid-template-columns: 1fr;
}

.suggest-label {
  display: block;
  font-size: 0.82rem;
  color: rgba(245,240,234,0.6);
  margin-bottom: 6px;
  font-weight: 500;
}

.suggest-label span {
  color: var(--rust-light);
  margin-left: 2px;
}

.suggest-input,
.suggest-textarea {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(183, 65, 14, 0.2);
  color: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  padding: 10px 14px;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.suggest-input::placeholder,
.suggest-textarea::placeholder {
  color: rgba(245,240,234,0.25);
}

.suggest-input:focus,
.suggest-textarea:focus {
  border-color: var(--rust);
}

.suggest-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.suggest-divider {
  height: 1px;
  background: rgba(183, 65, 14, 0.15);
  margin: 28px 0;
}

.suggest-submit-row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.suggest-btn {
  background: var(--rust);
  color: var(--cream);
  border: none;
  border-radius: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 14px 36px;
  cursor: pointer;
  transition: background 0.2s;
}

.suggest-btn:hover:not(:disabled) { background: var(--rust-light); }
.suggest-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.suggest-error {
  color: #ff6b6b;
  font-size: 0.82rem;
  display: none;
}

.suggest-success-banner {
  background: rgba(45, 125, 70, 0.15);
  border: 1px solid rgba(45, 125, 70, 0.3);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  display: none;
}

.suggest-success-banner h3 {
  font-size: 1.4rem;
  color: #5ABD7E;
  margin-bottom: 8px;
}

.suggest-success-banner p {
  font-size: 0.9rem;
  color: rgba(245,240,234,0.6);
  margin-bottom: 16px;
}

.suggest-success-banner a {
  color: var(--rust-light);
  font-size: 0.85rem;
}

@media (max-width: 600px) {
  .suggest-body { padding: 32px 20px; }
  .suggest-hero { padding: 40px 20px 36px; }
  .suggest-form-card { padding: 24px; }
  .suggest-field-group { grid-template-columns: 1fr; }
}
