/* My Spots Page Block Style */
.my-spot-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(44, 62, 80, 0.04);
  transition: box-shadow 0.2s;
}
.my-spot-block:focus-within,
.my-spot-block:hover {
  box-shadow: 0 2px 8px rgba(44, 62, 80, 0.1);
  border-color: var(--focus);
}
.my-spot-details {
  background: none;
  font-size: 0.97rem;
  color: var(--muted);
  padding: 0.5rem 1rem 1rem 1rem;
}
/* Trail Tracker - Complete Responsive & Accessible Styles */

:root {
  --primary: #2e7d32;
  --primary-dark: #1b5e20;
  --accent: #c62828;
  --accent-light: #ef5350;
  --bg: #f5f5f5;
  --sidebar-bg: #fff;
  --text: #222;
  --muted: #666;
  --border: #ccc;
  --focus: #1976d2;
  --focus-outline: 3px solid var(--focus);
  --error: #d32f2f;
  --success: #388e3c;
  --info: #1976d2;
}

/* Dark mode colors */
[data-theme="dark"] {
  --primary: #4caf50;
  --primary-dark: #388e3c;
  --accent: #ef5350;
  --accent-light: #f44336;
  --bg: #1e1e1e;
  --sidebar-bg: #2d2d2d;
  --text: #e0e0e0;
  --muted: #a0a0a0;
  --border: #444;
  --focus: #64b5f6;
  --spot-list-hover: #1e3a4a;
  --spot-list-active: #163040;
  --spot-info-bg: #2a2a2a;
  --weather-box-bg: #1a2a3a;
  --elevation-box-bg: #2a1a2e;
  --latlng-box-bg: #2a2700;
  --latlng-box-color: #e0d080;
}

html {
  box-sizing: border-box;
  font-size: 16px;
  scroll-behavior: smooth;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* Header & Navigation */
header {
  background: var(--primary);
  color: #fff;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header h1 {
  font-size: 1.5rem;
  margin: 0;
  letter-spacing: 0.02em;
  font-weight: 600;
}

header h1 a {
  color: unset;
  text-decoration: unset;
}

nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}

nav a,
nav button {
  color: #fff;
  background: none;
  border: none;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  transition: background 0.2s ease;
}

nav a:focus,
nav button:focus {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

nav a:hover,
nav button:hover {
  background: rgba(255, 255, 255, 0.15);
}

nav button:active {
  background: rgba(255, 255, 255, 0.2);
}

/* Minimum touch target size (WCAG 2.1 Level AAA) */
button,
a[role="button"],
input[type="checkbox"],
input[type="radio"],
input[type="range"] {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Route builder checkboxes: keep them small */
input[type="checkbox"].spot-checkbox {
  min-width: 18px !important;
  min-height: 18px !important;
  width: 18px !important;
  height: 18px !important;
  display: inline !important;
}

/* Leaflet control checkboxes (map filters): override touch target rule */
.leaflet-control input[type="checkbox"],
.leaflet-control-layers input[type="checkbox"],
.leaflet-control input[type="radio"] {
  min-width: 0 !important;
  min-height: 0 !important;
  display: inline !important;
}

/* Main Layout */
/* Desktop (default): 2fr 1fr (66% map, 33% sidebar) */
main {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0;
  min-height: calc(100vh - 56px);
}

#map {
  min-height: 400px;
  height: 100%;
  background: #e0e0e0;
}

#sidebar {
  background: var(--sidebar-bg);
  border-left: 1px solid var(--border);
  padding: 1.25rem;
  overflow-y: auto;
  max-height: calc(100vh - 56px);
}

/* Tablet (768px - 1024px): 60% map, 40% sidebar */
@media (max-width: 1024px) {
  main {
    grid-template-columns: 1.5fr 1fr;
  }
}

/* Mobile (<768px): Vertical stack with fixed map at top */
@media (max-width: 768px) {
  html, body {
    height: 100%;
    width: 100%;
  }

  body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-top: max(0px, env(safe-area-inset-top));
  }

  header {
    flex-shrink: 0;
    height: 56px;
    position: relative;
    z-index: 10;
  }

  main {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding: 0;
    gap: 0;
    min-height: auto;
  }

  #map {
    flex-shrink: 0;
    height: 35vh;
    width: 100%;
    overflow: hidden;
  }

  #sidebar {
    flex: 1;
    position: relative;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 0;
    padding: 1.25rem;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    transition: none;
    z-index: auto;
  }

  /* Drag handle removed on mobile - not needed with new layout */
  #sidebar::before {
    display: none;
  }

  /* Remove special padding rules */
  #sidebar > * {
    padding: 0;
  }

  #sidebar > *:first-child {
    padding: 0;
  }

  /* Expanded state removed on mobile - not needed */
  #sidebar.expanded {
    height: auto;
  }
}

/* Extra small phones (<480px) */
@media (max-width: 480px) {
  #map {
    height: 30vh;
  }
}

/* ========================================
   ROUTE BUILDER RESPONSIVE LAYOUT
   ======================================== */

/* Route Builder page: equal width split on desktop, bottom sheet on mobile */
/* These styles override the main layout when #route-panel is present (routeBuilder.html) */
body:has(#route-panel) main {
  grid-template-columns: 1fr 1fr;
  gap: 0;
  min-height: calc(100vh - 56px);
}

body:has(#route-panel) #map {
  min-height: 400px;
  height: 100%;
}

/* Tablet: adjust to 60/40 split */
@media (max-width: 1024px) {
  body:has(#route-panel) main {
    grid-template-columns: 1.5fr 1fr;
  }
}

/* Route panel on routeBuilder.html */
#route-panel {
  border-left: 1px solid var(--border);
  max-height: calc(100vh - 56px);
}

/* Desktop: side-by-side */
@media (min-width: 1025px) {
  #route-panel {
    border-left: 1px solid var(--border);
    border-top: none;
  }
}

/* Tablet (768px - 1024px): adjust ratio */
@media (max-width: 1024px) {
  /* Grid layout already handled by main media query */
}

/* Mobile (<768px): Route panel below map */
@media (max-width: 768px) {
  #route-panel {
    flex: 1;
    position: relative;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 0;
    padding: 1.25rem;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    transition: none;
    z-index: auto;
    background: var(--sidebar-bg);
  }

  /* Drag handle removed on mobile */
  #route-panel::before {
    display: none;
  }

  /* Remove special padding rules */
  #route-panel > * {
    padding: 0;
  }

  #route-panel > *:first-child {
    padding: 0;
  }

  /* Expanded state removed on mobile */
  #route-panel.expanded {
    height: auto;
  }
}

/* Extra small phones (<480px) */
@media (max-width: 480px) {
  #map {
    height: 30vh;
  }
}

/* ========================================
   EMPTY STATES
   ======================================== */

.empty-state-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 1rem 0;
  min-height: 200px;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  line-height: 1;
}

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0.5rem 0;
}

.empty-state-subtitle {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0.5rem 0 1.5rem 0;
  line-height: 1.4;
}

.empty-state-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: 4px;
  width: 100%;
}

.empty-state-steps .step {
  font-size: 0.9rem;
  color: var(--text);
  padding: 0.5rem;
  border-left: 3px solid var(--primary);
  padding-left: 0.75rem;
}

.empty-state-btn {
  margin-top: 1rem;
  min-width: 120px;
}

/* Sidebar Content */
#sidebar h2 {
  font-size: 1.1rem;
  margin-top: 0;
  margin-bottom: 0.75rem;
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.5rem;
}

#sidebar section {
  margin-bottom: 1.5rem;
}

#sidebar section:last-child {
  margin-bottom: 0;
}

/* Spot List */
#spot-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem 0;
}

#spot-list li {
  margin-bottom: 0.5rem;
}

.spot-list-item {
  display: block;
  width: 100%;
  padding: 0.75rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  min-height: 44px; /* Touch target size */
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.spot-list-item:hover {
  background: var(--spot-list-hover, #e3f2fd);
  border-color: var(--focus);
}

.spot-list-item:focus {
  outline: var(--focus-outline);
  outline-offset: -2px;
  background: var(--spot-list-hover, #e3f2fd);
}

.spot-list-item:active {
  background: var(--spot-list-active, #bbdefb);
}

.spot-list-name {
  flex: 1;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spot-list-rating {
  color: var(--primary);
  font-size: 0.9rem;
  white-space: nowrap;
  margin-left: 0.5rem;
}

.spot-favorite-btn {
  color: var(--text);
  transition: color 0.2s ease;
}

[data-theme="dark"] .spot-favorite-btn {
  color: #fff;
}

/* Forms */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.3rem;
  display: block;
  font-size: 0.95rem;
}

input[type="text"],
input[type="hidden"],
select,
textarea {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  min-height: 44px; /* Touch target size */
}

input[type="text"]::placeholder,
textarea::placeholder {
  color: var(--muted);
}

input[type="text"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

button[type="submit"],
button[type="button"],
.form-actions button {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px; /* Touch target size */
}

button[type="submit"] {
  background: var(--primary);
  color: #fff;
}

button[type="submit"]:hover {
  background: var(--primary-dark);
}

button[type="submit"]:focus {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

button[type="submit"]:active {
  transform: translateY(1px);
}

button[type="submit"]:disabled {
  background: var(--muted);
  cursor: not-allowed;
  opacity: 0.6;
}

button[type="button"] {
  background: #999;
  color: #fff;
}

button[type="button"]:hover {
  background: #777;
}

button[type="button"]:focus {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

#delete-spot-btn {
  background: var(--accent) !important;
}

#delete-spot-btn:hover {
  background: var(--accent-light) !important;
}

/* Info Displays */
.spot-info,
.spot-latlng {
  padding: 0.75rem;
  background: var(--spot-info-bg, #f0f4f8);
  border-left: 3px solid var(--primary);
  border-radius: 2px;
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0.75rem 0;
  color: var(--text);
}

.spot-latlng {
  background: var(--latlng-box-bg, #fffde7);
  border-left-color: #f9a825;
  color: var(--latlng-box-color, #665c00);
}

.weather-box {
  background: var(--weather-box-bg, #e3f2fd);
  border-left-color: #1976d2;
}

.elevation-box {
  background: var(--elevation-box-bg, #f3e5f5);
  border-left-color: #7b1fa2;
}

/* Search Bar */
.search-container {
  position: relative;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-input {
  flex: 1;
  padding: 0.75rem 0.75rem 0.75rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.95rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23666'%3E%3Cpath d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E")
    no-repeat left 0.5rem center;
  background-size: 1.2rem;
  min-height: 44px;
}

.search-input:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.clear-search-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
  min-width: 44px;
  min-height: 44px;
}

.clear-search-btn:hover,
.clear-search-btn:focus {
  color: var(--text);
  outline: var(--focus-outline);
  outline-offset: 2px;
}

/* Spot List Content */
.spot-list-content {
  flex: 1;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.spot-list-date {
  font-size: 0.8rem;
  color: var(--muted);
}

.empty-state {
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  background: var(--bg);
  border-radius: 4px;
}

/* Spot Detail View */
.spot-detail {
  padding: 0;
}

.detail-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.goto-btn {
  flex: none;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  min-height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
}

.back-button {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.5rem 0;
  margin-bottom: 1rem;
  font-weight: 500;
  min-height: 44px;
}

.back-button:hover,
.back-button:focus {
  text-decoration: underline;
  outline: var(--focus-outline);
  outline-offset: 2px;
}

.spot-detail h2 {
  font-size: 1.5rem;
  margin: 0.5rem 0;
  color: var(--text);
}

.detail-rating {
  font-size: 1.25rem;
  color: #f9a825;
  margin: 0.5rem 0;
}

.detail-date {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.25rem 0 1rem 0;
}

.detail-section {
  margin: 1rem 0;
}

.detail-section strong {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.detail-section p {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

/* Tags */
.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.tag {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 0.4rem 0.75rem;
  border-radius: 16px;
  font-size: 0.85rem;
  font-weight: 500;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Form Groups */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-weight: 500;
  color: var(--text);
  font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  min-height: 44px;
}

.form-group input[type="text"]:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.form-group input[type="text"].field-error,
.form-group select.field-error,
.form-group textarea.field-error {
  border-color: var(--error);
  background: #ffebee;
}

.form-error {
  font-size: 0.85rem;
  color: var(--error);
  display: none;
  margin-top: 0.25rem;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Detail Buttons */
.detail-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn-primary,
.btn-secondary,
.btn-danger {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-primary:focus {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

.btn-secondary {
  background: #999;
  color: #fff;
}

.btn-secondary:hover {
  background: #777;
}

.btn-secondary:focus {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

.btn-danger {
  background: var(--accent);
  color: #fff;
}

.btn-danger:hover {
  background: var(--accent-light);
}

.btn-danger:focus {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

/* Empty State */
#spot-list li:only-child {
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  background: var(--bg);
}

/* Responsive Design */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  header h1 {
    font-size: 1.25rem;
  }

  nav {
    width: 100%;
    gap: 0.5rem;
  }

  nav a,
  nav button {
    flex: 1;
    text-align: center;
    font-size: 0.85rem;
    padding: 0.5rem;
  }

  main {
    grid-template-columns: 1fr;
    grid-template-rows: 350px 1fr;
  }

  #map {
    min-height: 300px;
  }

  #sidebar {
    border-left: none;
    border-top: 1px solid var(--border);
    padding: 1rem;
    max-height: none;
  }

  .form-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 15px;
  }

  header {
    padding: 0.5rem 0.75rem;
  }

  header h1 {
    font-size: 1.15rem;
  }

  nav {
    gap: 0.25rem;
  }

  nav a,
  nav button {
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
  }

  main {
    grid-template-rows: 220px 1fr;
  }

  #map {
    min-height: 180px;
  }

  #sidebar {
    padding: 0.75rem;
  }

  #sidebar h2 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  #sidebar section {
    margin-bottom: 1rem;
  }

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

  button[type="submit"],
  button[type="button"],
  .form-actions button {
    width: 100%;
  }

  label {
    font-size: 0.9rem;
  }

  input[type="text"],
  select,
  textarea {
    font-size: 16px; /* Prevents auto-zoom on iOS */
  }

  .spot-list-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .spot-list-rating {
    margin-left: 0;
    margin-top: 0.25rem;
  }
}

/* Print Styles */
@media print {
  nav,
  #sidebar {
    display: none;
  }

  #map {
    min-height: auto;
    page-break-inside: avoid;
  }
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Settings Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

.modal.active {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: var(--sidebar-bg);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 90%;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--primary);
  color: #fff;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.3rem;
  color: #fff;
}

.close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.close-btn:hover,
.close-btn:focus {
  background: rgba(255, 255, 255, 0.2);
  outline: none;
}

.modal-body {
  padding: 2rem;
}

.setting-item {
  margin-bottom: 1.5rem;
}

.setting-item:last-child {
  margin-bottom: 0;
}

.setting-item label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

.theme-buttons {
  display: flex;
  gap: 1rem;
}

.theme-btn {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.theme-btn:hover {
  border-color: var(--primary);
  background: var(--sidebar-bg);
}

.theme-btn:focus {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

.theme-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
}

/* -----------------------------------------------------------------------
   Map Markers
   We use Leaflet's divIcon instead of a PNG URL so we control the color
   with CSS and never depend on a third-party image file that could 404.
   The outer .leaflet-div-icon resets Leaflet's default white background;
   the inner .spot-marker-pin is the visible red dot.
----------------------------------------------------------------------- */
.leaflet-div-icon {
  background: transparent;
  border: none;
}

.spot-marker-pin {
  width: 16px;
  height: 16px;
  background: var(--accent); /* matches the app's red accent color */
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.user-location-pin {
  width: 18px;
  height: 18px;
  background: #2979ff;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow:
    0 0 0 3px rgba(41, 121, 255, 0.3),
    0 1px 4px rgba(0, 0, 0, 0.4);
}

/* -----------------------------------------------------------------------
   Map Layer Control
   Overrides Leaflet's default white panel to match the app's sidebar style.
----------------------------------------------------------------------- */
.leaflet-control-layers {
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-family: system-ui, Arial, sans-serif;
  font-size: 0.9rem;
  color: var(--text);
}

.leaflet-control-layers-toggle {
  background-color: var(--sidebar-bg);
  border-radius: 8px;
}

.leaflet-control-layers-expanded {
  padding: 10px 14px;
}

.leaflet-control-layers-separator {
  border-top: 1px solid var(--border);
  margin: 6px 0;
}

.leaflet-control-layers label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  cursor: pointer;
  color: var(--text);
}

.leaflet-control-layers input[type="radio"],
.leaflet-control-layers input[type="checkbox"] {
  accent-color: var(--primary);
  cursor: pointer;
}

/* -----------------------------------------------------------------------
   Export Format Modal
   Reuses the existing .modal / .modal-content / .modal-header / .modal-body
   rules. Only the inner button layout and hint text need new rules here.
----------------------------------------------------------------------- */

/* Stack the two export choice buttons vertically so the hint text
   under each label has room to breathe */
.export-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Small descriptive line shown below the button label —
   tells the user which tools each format is best for */
.export-hint {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  opacity: 0.85;
  margin-top: 0.25rem;
}

/* -----------------------------------------------------------------------
   Display Format Toggle Buttons
----------------------------------------------------------------------- */

.toggle-btn {
  padding: 0.5rem 1rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.toggle-btn:hover {
  border-color: var(--primary);
  background: var(--sidebar-bg);
}

.toggle-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.toggle-btn:focus {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

/* -----------------------------------------------------------------------
   Search Container (My Spots)
----------------------------------------------------------------------- */

.search-container {
  position: relative;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-input {
  flex: 1;
  padding: 0.75rem 0.75rem 0.75rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.95rem;
  background: var(--sidebar-bg)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23666'%3E%3Cpath d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E")
    no-repeat left 0.5rem center;
  background-size: 1.2rem;
  color: var(--text);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  min-height: 44px;
}

.search-input:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.search-input::placeholder {
  color: var(--muted);
}

.clear-search-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
  min-width: 44px;
  min-height: 44px;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clear-search-btn:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.05);
}

.clear-search-btn:focus {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

[data-theme="dark"] .clear-search-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* -----------------------------------------------------------------------
   My Spots Controls (Sort, View Toggle, Favorites)
----------------------------------------------------------------------- */

.my-spots-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.control-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.sort-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  margin: 0;
  display: inline;
}

.sort-select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  min-height: 36px;
}

.sort-select:hover {
  border-color: var(--primary);
  background: var(--sidebar-bg);
}

.sort-select:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.sort-order-btn {
  padding: 0.5rem 0.75rem !important;
  min-width: 44px !important;
  min-height: 36px !important;
  font-weight: 600 !important;
  flex: none;
}

@media (max-width: 768px) {
  .my-spots-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .control-group {
    width: 100%;
  }

  .sort-select {
    flex: 1;
  }
}

/* -----------------------------------------------------------------------
   Map Search Bar
----------------------------------------------------------------------- */

#map-search-container {
  position: relative;
}

#map-search-input {
  width: 300px;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.95rem;
  background: var(--sidebar-bg);
  color: var(--text);
}

#map-search-input:focus {
  outline: var(--focus-outline);
  outline-offset: 2px;
  border-color: var(--primary);
}

#map-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 250px;
  overflow-y: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 1001;
}

.search-result-item {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:hover {
  background: var(--bg);
}

.search-result-item:last-child {
  border-bottom: none;
}

/* -----------------------------------------------------------------------
   Page Buttons (Import/Export/Favorites on MySpots)
----------------------------------------------------------------------- */

#page-import-btn:hover,
#page-export-btn:hover,
#show-favorites-btn:hover {
  border-color: var(--primary);
  background: var(--bg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#page-import-btn:active,
#page-export-btn:active,
#show-favorites-btn:active {
  transform: scale(0.98);
}

#show-favorites-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

#show-favorites-btn {
  padding: 0.75rem;
}

/* ===============================================================================
   LANDING PAGE STYLES
   =============================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@900&display=swap");

/*
  The mid mountain ridge center sits at y=219 out of the 500-unit SVG viewBox.
  With xMidYMax slice and height dominating, this maps to ~56% from the bottom.
  bottom: 56vh places the title's bottom edge right at the ridge so it
  animates upward from behind the mountain.
*/
#landing-title-area {
  position: absolute;
  bottom: 56vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
}

/*
  Title is a flex row so each letter span can be individually offset.
  letter-spacing is removed in favour of the flex gap so each span's
  translateY doesn't drag spacing artifacts along with it.
*/
#landing-title {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.04em;
  font-family: "Montserrat", Arial, sans-serif;
  font-size: 3.2rem;
  font-weight: 900;
  color: #23704a;
  margin: 0;
  text-shadow:
    0 4px 24px #b2dfdb,
    0 2px 0 #fff;
  user-select: none;
  z-index: 2;
}

/*
  Each letter sits at translateY(--letter-y) along the SVG curve.
  Before the "animate" class is added, letters are hidden below their
  final position so they appear to pop up from behind the grass line.
*/
/*
  Letters start flat at the grass line (scaleY 0, origin at bottom)
  and spring up to full height. No translateY — the scale origin IS
  the grass line so they appear to grow straight up from it.
*/
.letter {
  display: inline-block;
  position: relative;
  transform: scaleY(0);
  transform-origin: bottom center;
  opacity: 0;
}

#landing-title.animate .letter {
  animation: letter-pop 0.5s cubic-bezier(0.22, 1.4, 0.36, 1) both;
  animation-delay: var(--letter-delay, 0s);
}

@keyframes letter-pop {
  from {
    transform: scaleY(0);
    opacity: 0;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

/*
  Pop order: T(1) → i(4) → l(5) → T(7) → k(11), then remaining letters.
  Priority letters are 0.12s apart; remaining fill in after at 0.1s apart.
*/
#landing-title .letter:nth-child(1) {
  --letter-delay: 0.3s;
  top: -1px;
} /* T */
#landing-title .letter:nth-child(4) {
  --letter-delay: 0.6s;
  top: -9px;
} /* i */
#landing-title .letter:nth-child(5) {
  --letter-delay: 0.9s;
  top: -7px;
} /* l */
#landing-title .letter:nth-child(7) {
  --letter-delay: 1.2s;
  top: -2px;
} /* T */
#landing-title .letter:nth-child(11) {
  --letter-delay: 1.5s;
  top: 13px;
} /* k */
#landing-title .letter:nth-child(2) {
  --letter-delay: 1.85s;
  top: -8px;
} /* r */
#landing-title .letter:nth-child(3) {
  --letter-delay: 2.05s;
  top: -10px;
} /* a */
#landing-title .letter:nth-child(6) {
  --letter-delay: 2.25s;
  top: -5px;
} /* space */
#landing-title .letter:nth-child(8) {
  --letter-delay: 2.45s;
  top: 1px;
} /* r */
#landing-title .letter:nth-child(9) {
  --letter-delay: 2.65s;
  top: 6px;
} /* a */
#landing-title .letter:nth-child(10) {
  --letter-delay: 2.85s;
  top: 11px;
} /* c */
#landing-title .letter:nth-child(12) {
  --letter-delay: 3.05s;
  top: 14px;
} /* e */
#landing-title .letter:nth-child(13) {
  --letter-delay: 3.25s;
  top: 12px;
} /* r */

#container {
  opacity: 0;
  transition: opacity 0.8s;
}
#container.visible {
  opacity: 1;
}

#prompt-text {
  opacity: 0;
  transition: opacity 0.7s;
}
#prompt-text.visible {
  opacity: 1;
}

/* ===============================================================================
   ROUTE BUILDER INLINE STYLES (CONVERTED FROM HTML)
   =============================================================================== */

.map-background {
  background: #e0e0e0;
}

.route-panel-main {
  background: var(--sidebar-bg);
  border-left: 1px solid var(--border);
  padding: 1.25rem;
  overflow-y: auto;
}

.panel-heading {
  font-size: 1.1rem;
  margin-top: 0;
  margin-bottom: 0.75rem;
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.5rem;
}

.panel-section {
  margin-bottom: 1.5rem;
}

.panel-subheading {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.flex-column-compact {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 250px;
  overflow-y: auto;
}

.flex-column-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.help-text {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.hidden {
  display: none;
}

.elevation-canvas {
  width: 100%;
  height: 150px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
}

.stats-box {
  background: var(--bg);
  padding: 1rem;
  border-radius: 4px;
  border-left: 3px solid var(--primary);
}

.stat-row {
  margin-bottom: 0.75rem;
}

.stat-row.no-margin {
  margin-bottom: 0;
}

.stat-time-row {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.stat-value {
  font-size: 1.1rem;
  color: var(--primary);
}

.stat-value-bold {
  font-size: 1.1rem;
  color: var(--primary);
  font-weight: 600;
}

.button-group {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.flex-button {
  flex: 1;
  min-width: 100px;
}

/* ===============================================================================
   MAP SEARCH STYLES (CONVERTED FROM INLINE)
   =============================================================================== */

.map-search-wrapper {
  position: absolute;
  top: 10px;
  left: 140px;
  z-index: 999;
  background: white;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.map-search-input-field {
  padding: 0.75rem;
  border: none;
  border-radius: 4px;
  width: 300px;
  font-size: 0.95rem;
}

.map-search-results-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ccc;
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 200px;
  overflow-y: auto;
}

.map-search-results-dropdown.visible {
  display: block;
}

.search-result-no-match {
  padding: 0.75rem;
  color: var(--muted);
}

.search-result-item {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:hover {
  background: var(--bg);
}

.search-result-item small {
  color: var(--muted);
}

/* ===============================================================================
   MYSPOTS INLINE STYLES (CONVERTED FROM HTML)
   =============================================================================== */

.import-file-hidden {
  display: none;
}

/* ===============================================================================
   MYSPOTS PAGE - CARD AND LIST VIEW STYLES
   =============================================================================== */

.spot-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: default;
  user-select: text;
}

.spot-card-meta-date {
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.spot-card-meta-coords {
  margin-bottom: 0.5rem;
}

.spot-card-meta-notes {
  margin-bottom: 0.25rem;
}

.spot-card-meta-tags {
  margin-bottom: 0.5rem;
}

.spot-edit-hidden {
  display: none;
}

/* When spot is in editing mode */
.my-spot-block.editing .spot-view {
  display: none;
}

.my-spot-block.editing .spot-edit {
  display: block;
}

.tag-label-note {
  font-weight: normal;
  font-size: 0.85rem;
}

.spot-list-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.spot-list-item-info {
  flex: 1;
}

.spot-list-item-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.spot-list-item-meta {
  font-size: 0.88rem;
  color: var(--muted);
}

.spot-list-item-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.spot-list-item-rating {
  font-size: 1.1rem;
}

.spot-list-item-buttons {
  display: flex;
  gap: 0.25rem;
}

.button-compact {
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
}

.display-toggle {
  display: flex;
  gap: 0.5rem;
}

.error-text {
  color: var(--error);
}

/* Landing page styles for Trail Tracker */

#landing-page body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #b8ddf0 0%, #ceebd4 55%, #c2e0c4 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: system-ui, Arial, sans-serif;
  overflow: hidden;
  position: relative;
}

#landing-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#landing-bg svg {
  width: 100%;
  height: 100%;
}

#container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  min-height: 300px;
}

#prompt-text {
  font-size: 2rem;
  color: #2e7d32;
  font-weight: bold;
  margin-top: 10px;
  text-align: center;
  text-shadow:
    1px 2px 8px #fff,
    0 1px 0 #c8e6c9;
  letter-spacing: 0.04em;
}
