/* Basic page layout */
body {
  font-family: Arial, sans-serif;
  margin: 20px;
  background-color: #f5f5f5;
}

/* App title */
h1 {
  text-align: center;
  margin-bottom: 5px;
}

/* Tagline under the title */
#rail1-tagline {
  text-align: center;
  margin-top: 0px;
  margin-bottom: 20px;
  font-size: 32px;
  font-weight: bold;
  color: #333;
}

/* Table styling */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background: #fff;
}

th, td {
  padding: 10px;
  border: 1px solid #ccc;
  text-align: left;
}

/* Light header instead of black */
th {
  background-color: #e0e0e0;
  color: #333;
}

/* Clean, modern dropdowns and text inputs */
select,
input[type="text"] {
  width: 100%;
  max-width: 350px;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid #bbb;
  border-radius: 6px;
  background-color: #fff;
  color: #333;
  margin: 6px auto 10px auto;
  display: block;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

select:focus,
input[type="text"]:focus {
  outline: none;
  border-color: #888;
  box-shadow: 0 0 4px rgba(0,0,0,0.15);
}

#subdivisionSearch[hidden] {
  display: none;
}

#subdivisionSearch {
  margin-top: 0;
}

#subdivisionResults[hidden] {
  display: none;
}

#subdivisionResults {
  margin-top: 6px;
}

#subdivisionSelect[hidden] {
  display: none;
}

#loadAllSubdivisionsBtn[hidden] {
  display: none;
}

#loadAllSubdivisionsBtn {
  display: block;
  margin: 0 auto 10px auto;
}
/* Map icon link (Google Maps) - blue button */
.map-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 32px;
  height: 32px;

  border-radius: 8px;
  background-color: #1a73e8; /* Google blue */
  border: 1px solid #1558b0;

  color: #fff;              /* fallback */
  text-decoration: none;

  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.map-icon-link:hover {
  background-color: #1669d6;
  border-color: #124a92;
}

.map-icon-link:focus {
  outline: 2px solid rgba(26, 115, 232, 0.35);
  outline-offset: 2px;
}

.map-icon-link:active {
  transform: translateY(1px);
}

/* Pin is red on the blue button */
.map-icon-link svg path {
  fill: #ea4335; /* Google red */
}
/* Lookup instruction hint */
.lookup-hint {
  background-color: #e8f4fd;
  border-left: 4px solid #0078d4;
  border-radius: 4px;
  padding: 10px 14px;
  margin: 0 0 14px 0;
  font-size: 14px;
  line-height: 1.6;
  color: #333;
}

/* Label above subdivision suggestion list */
.subdivision-results-label {
  font-size: 13px;
  color: #555;
  margin: 0 0 6px 0;
  font-style: italic;
}

/* Subdivision suggestion buttons */
.subdivision-result-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  background-color: #fff;
  border: 1px solid #bbb;
  border-radius: 6px;
  font-size: 15px;
  color: #222;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  transition: background-color 0.15s, border-color 0.15s;
}

.subdivision-result-btn:hover {
  background-color: #e8f4fd;
  border-color: #0078d4;
}

.subdivision-result-btn:active {
  background-color: #cce4f7;
}

.subdivision-result-arrow {
  font-size: 20px;
  color: #0078d4;
  font-weight: bold;
  line-height: 1;
  margin-left: 8px;
}

/* =========================================================
   Paywall Modal
   ========================================================= */
.paywall-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.paywall-content {
  background: #fff;
  border-radius: 12px;
  padding: 28px 24px 24px;
  max-width: 400px;
  width: 100%;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  text-align: center;
}

.paywall-content h2 {
  margin: 0 0 10px;
  font-size: 22px;
  color: #222;
}

.paywall-description {
  font-size: 15px;
  color: #555;
  margin: 0 0 18px;
  line-height: 1.5;
}

.paywall-price {
  font-size: 28px;
  font-weight: bold;
  color: #0078d4;
  margin-bottom: 20px;
}

.paywall-email-label {
  display: block;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.paywall-email-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid #ccc;
  border-radius: 8px;
  margin-bottom: 14px;
}

.paywall-subscribe-btn {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 17px;
  font-weight: bold;
  background-color: #0078d4;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background-color 0.15s;
}

.paywall-subscribe-btn:hover {
  background-color: #005fa3;
}

.paywall-subscribe-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.paywall-manage-btn {
  display: block;
  width: 100%;
  padding: 11px;
  font-size: 15px;
  background: transparent;
  color: #0078d4;
  border: 1px solid #0078d4;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background-color 0.15s;
}

.paywall-manage-btn:hover {
  background-color: #e8f4fd;
}

.paywall-manage-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.paywall-restore-btn {
  display: block;
  width: 100%;
  padding: 11px;
  font-size: 15px;
  background: transparent;
  color: #0078d4;
  border: 1px solid #0078d4;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 0;
  transition: background-color 0.15s;
}

.paywall-restore-btn:hover {
  background-color: #e8f4fd;
}

.paywall-restore-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.paywall-close-btn {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: #888;
  cursor: pointer;
  padding: 0;
}

.paywall-close-btn:hover {
  color: #333;
}

.paywall-status {
  margin-top: 12px;
  font-size: 13px;
  color: #c0392b;
  min-height: 18px;
}

/* =========================================================
   Subscribe Banner (shown below table for free users)
   ========================================================= */
.subscribe-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background-color: #e8f4fd;
  border: 1px solid #0078d4;
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 14px;
  font-size: 15px;
  color: #333;
  flex-wrap: wrap;
}

.subscribe-banner-btn {
  padding: 9px 18px;
  font-size: 14px;
  font-weight: bold;
  background-color: #0078d4;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s;
}

.subscribe-banner-btn:hover {
  background-color: #005fa3;
}

/* Locked column headers and cells */
.locked-col {
  color: #888;
  font-style: italic;
}

.locked-cell {
  color: #bbb;
  text-align: center;
}

.mode-header {
  margin-bottom: 6px;
}

.mode-description {
  color: #444;
  text-align: center;
  max-width: 760px;
  margin: 0 auto 14px;
}

.mode-panel {
  background: #fff;
  border: 1px solid #d8d8d8;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  max-width: 960px;
  margin: 0 auto 18px;
}

.railroad-browser-panel {
  margin-bottom: 22px;
}

.railroad-filter-toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.railroad-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.railroad-filter-btn,
#clearRailroadFilterBtn,
#dotSearchBtn,
#loadAllSubdivisionsBtn {
  border: 1px solid #0b63c8;
  background: #fff;
  color: #0b63c8;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.railroad-filter-btn:hover,
#clearRailroadFilterBtn:hover,
#dotSearchBtn:hover,
#loadAllSubdivisionsBtn:hover {
  background: #e8f4fd;
}

.railroad-filter-btn.is-active {
  background: #0b63c8;
  color: #fff;
}

.other-railroads-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.other-railroads-controls select {
  margin: 0;
  flex: 1 1 260px;
}

#letterSelect {
  flex: 0 0 auto;
  width: 80px;
  min-width: 70px;
}

.filter-status {
  margin-top: 12px;
  min-height: 20px;
  color: #444;
  font-size: 14px;
}

.error-text {
  color: crimson;
}

#tableContainer {
  overflow-x: auto;
}

.empty-state-cell {
  text-align: center;
  color: #666;
  padding: 18px;
}

@media (max-width: 640px) {
  body {
    margin: 12px;
  }

  #rail1-tagline {
    font-size: 24px;
  }

  .mode-panel {
    padding: 14px;
  }

  .railroad-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .railroad-filter-btn,
  #clearRailroadFilterBtn,
  #dotSearchBtn {
    min-height: 44px;
    white-space: nowrap;
  }

  .other-railroads-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .other-railroads-controls select,
  #clearRailroadFilterBtn,
  #dotSearchBtn {
    width: 100%;
    max-width: none;
  }

  #otherRailroadsSelect,
  #subdivisionSelect {
    max-width: 350px;
    min-height: 44px;
    box-sizing: border-box;
  }
}

/* ---- Railroad Picker ---- */
#railroadPicker {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px;
}

.picker-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 28px 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  text-align: center;
}

.picker-card h2 {
  margin-top: 0;
  font-size: 1.4rem;
}

.picker-description {
  color: #555;
  margin-bottom: 20px;
}

.picker-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.picker-btn {
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 600;
  border: 2px solid #1a73e8;
  border-radius: 6px;
  background: #fff;
  color: #1a73e8;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.picker-btn:hover,
.picker-btn:focus {
  background: #1a73e8;
  color: #fff;
}

.picker-btn-all {
  border-color: #888;
  color: #555;
  font-weight: 400;
}

.picker-btn-all:hover,
.picker-btn-all:focus {
  background: #888;
  color: #fff;
}

.picker-hint {
  font-size: 0.85rem;
  color: #777;
  margin: 0;
}

/* ---- App toolbar ---- */
.app-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f0f4f8;
  border-bottom: 1px solid #ddd;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.install-section {
  max-width: 960px;
  margin: 0 auto 18px;
  padding: 16px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.install-heading {
  margin: 0 0 8px;
  font-size: 1.1rem;
  color: #9a3412;
}

.install-prompt-text,
.install-status,
.install-help-title,
.install-help-list {
  margin: 0;
}

.install-prompt-text {
  color: #7c2d12;
  line-height: 1.5;
}

.install-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.install-app-btn,
.install-dismiss-btn,
.install-help-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 15px;
  cursor: pointer;
}

.install-app-btn {
  background: #1a73e8;
  color: #fff;
}

.install-help-btn {
  background: #fff;
  color: #9a3412;
  border: 1px solid #fdba74;
}

.install-dismiss-btn {
  background: #fff;
  color: #7c2d12;
  border: 1px solid #fed7aa;
}

.install-fallback-text {
  min-height: 20px;
  margin: 12px 0 0;
  color: #9a3412;
  font-size: 14px;
}

.install-help-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #fed7aa;
}

.install-help-title {
  color: #7c2d12;
}

.install-help-list {
  margin-top: 8px;
  padding-left: 20px;
  color: #7c2d12;
  line-height: 1.6;
}

.install-status {
  min-height: 20px;
  margin-top: 12px;
  color: #9a3412;
  font-size: 14px;
}

.active-railroad-label {
  margin: 0;
  font-weight: 700;
  font-size: 2.4rem;
  line-height: 1.2;
  color: #1a73e8;
}

@media (max-width: 640px) {
  .active-railroad-label {
    font-size: 1.8rem;
  }

  .install-actions {
    flex-direction: column;
  }

  .install-app-btn,
  .install-dismiss-btn,
  .install-help-btn {
    width: 100%;
    min-height: 44px;
  }
}

.change-railroad-btn {
  padding: 6px 14px;
  font-size: 0.9rem;
  border: 1px solid #1a73e8;
  border-radius: 5px;
  background: #fff;
  color: #1a73e8;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.change-railroad-btn:hover,
.change-railroad-btn:focus {
  background: #1a73e8;
  color: #fff;
}

/* ── Map button in toolbar ─────────────────────────────────── */
.map-btn {
  padding: 6px 14px;
  font-size: 0.9rem;
  border: 1px solid #059669;
  border-radius: 5px;
  background: #fff;
  color: #059669;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-left: 8px;
}
.map-btn:hover,
.map-btn:focus {
  background: #059669;
  color: #fff;
}

/* ── Map modal overlay ─────────────────────────────────────── */
.map-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: stretch;
  justify-content: center;
}
body.map-modal-open {
  overflow: hidden;
}
.map-modal-inner {
  display: flex;
  flex-direction: column;
  background: #fff;
  width: 100%;
  max-width: 1200px;
  height: calc(100vh - 24px);
  margin: 12px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ── Map modal header ──────────────────────────────────────── */
.map-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #1a73e8;
  color: #fff;
}
.map-modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}
.map-close-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
  transition: background 0.15s;
}
.map-close-btn:hover,
.map-close-btn:focus {
  background: rgba(255, 255, 255, 0.25);
}

/* ── Map filter bar ────────────────────────────────────────── */
.map-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 10px 14px;
  background: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
}
.map-filter-section {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.map-filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
  white-space: nowrap;
}
.map-railroad-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.map-filter-btn {
  padding: 4px 11px;
  font-size: 0.8rem;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.map-filter-btn:hover {
  border-color: var(--rr-color, #1a73e8);
  color: var(--rr-color, #1a73e8);
}
.map-filter-btn.active {
  background: var(--rr-color, #1a73e8);
  border-color: var(--rr-color, #1a73e8);
  color: #fff;
  font-weight: 600;
}
.map-classii-select {
  width: auto;
  max-width: 240px;
  padding: 4px 8px;
  font-size: 0.85rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  margin: 0;
}
.map-reset-btn {
  padding: 4px 12px;
  font-size: 0.8rem;
  border: 1px solid #9ca3af;
  border-radius: 20px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s;
}
.map-reset-btn:hover,
.map-reset-btn:focus {
  background: #e5e7eb;
}

/* ── Map status bar / legend ───────────────────────────────── */
.map-status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 14px;
  font-size: 0.78rem;
  color: #6b7280;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  min-height: 28px;
}
.map-legend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: #374151;
}
.map-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6b7280;
  flex-shrink: 0;
}
.map-legend-text {
  font-weight: 600;
}
.map-legend-track-note {
  color: #9ca3af;
  font-style: italic;
}

/* ── Map container ─────────────────────────────────────────── */
.map-container {
  flex: 1 1 auto;
  height: 100%;
  min-height: 400px;
}

/* ── Responsive adjustments ────────────────────────────────── */
@media (max-width: 600px) {
  .map-modal-inner {
    margin: 0;
    border-radius: 0;
    height: 100vh;
  }
  .map-filter-bar {
    gap: 8px 10px;
  }
  .map-classii-select {
    max-width: 100%;
  }
}

/* Nearest crossings modal */
.nearest-map {
  flex: 1;
  min-height: 320px;
  margin: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  background: #e5e7eb;
}


/* ===== Railroad banner (AI-generated Class I locomotives) ===== */
.rr-banner {
  width: 100%;
  max-width: 960px;
  margin: 14px auto 18px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}
.rr-banner img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: cover;
  object-position: center;
}

/* Mobile: keep the locomotive banner short so it never dominates the screen */
@media (max-width: 600px) {
  .rr-banner {
    margin: 10px auto 12px;
    border-radius: 8px;
  }
  .rr-banner img {
    max-height: 140px;
  }
}


/* Crossing markers: full-size tap target (44px) around a small visual dot */
.leaflet-div-icon.crossing-tap-marker {
  background: transparent;
  border: none;
}
.crossing-tap-marker .crossing-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid #fff;
  opacity: 0.9;
}
