/**
 * Wien Radrouten-Planer - Lovable Integration CSS
 * Modern, responsive design inspired by Lovable
 * Version: 1.4.0-final
 */

/* Global overflow fix for Apple Magic Mouse */
html, body {
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

/* CSS Custom Properties for Theming */
:root {
  --primary-orange: #F6731D;
  --primary-pink: #FF2BAF;
  --secondary-orange: #e0661a;
  --secondary-pink: #e91e63;
  --accent-yellow: #f59e0b;
  --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;
  --gray-900: #111827;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --gradient-orange: linear-gradient(to right, var(--primary-orange), var(--secondary-orange));
  --gradient-pink: linear-gradient(to right, var(--primary-pink), var(--secondary-pink));
  --gradient-orange-pink: linear-gradient(to right, var(--primary-orange), var(--primary-pink));
  --border-radius: 0.5rem;
  --border-radius-lg: 0.75rem;
  --transition: all 0.2s ease-in-out;
}

/* Removed global scroll lock to avoid header disappearance and drag issues */

/* Hide plugin hamburger by default (desktop); will be shown explicitly on mobile sheet */
.wrp-hamburger-btn {
  display: none;
}

/* Base Container - Optimized for Twenty Twenty Four Theme */
body .wrp-lovable-container,
.wrp-lovable-container {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  width: 100%;
  max-width: 1200px;
  margin: 2rem auto;
  background-color: #ffffff !important;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Unified Headings */
body .wrp-lovable-container h1,
body .wrp-lovable-container h2,
body .wrp-lovable-container h3,
body .wrp-lovable-container label,
.wrp-lovable-container h1,
.wrp-lovable-container h2,
.wrp-lovable-container h3,
.wrp-lovable-container label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 600;
    color: #111827 !important;
}

/* Header Styles */
.wrp-lovable-container .wrp-header {
  background: linear-gradient(to right, #F6731D, #FF2BAF) !important;
  color: #ffffff !important;
  padding: 0.3rem 1.5rem !important;
  position: relative;
  overflow: hidden;
  text-align: left !important;
}

.wrp-lovable-container .wrp-header h1 {
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  text-align: left !important;
  padding: 4px 20px !important;
  margin: 0 !important;
}

/* Header Bike Icon Specific Styling */
.wrp-header h1 img {
  width: 40px !important;
  height: 40px !important;
  object-fit: contain !important;
  filter: brightness(0) invert(1) !important;
  display: inline-block !important;
  vertical-align: middle !important;
}

.wrp-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" fill="white" opacity="0.1"><path d="M0,0v46.29c47.79,22.2,103.59,32.17,158,28,70.36-5.37,136.33-33.31,206.8-37.5C438.64,32.43,512.34,53.67,583,72.05c69.27,18,138.3,24.88,209.4,13.08,36.15-6,69.85-17.84,104.45-29.34C989.49,25,1047.93,2.61,1100,0v100H0V0z"/></svg>') repeat-x;
  background-size: 100% 100%;
  flex-direction: column;
}

.wrp-header .flex {
  position: relative;
  z-index: 1;
}

/* Main Content */
body .wrp-main-content,
.wrp-main-content {
  background-color: #ffffff !important;
  min-height: 700px;
  display: flex;
  flex-direction: column;
}

@media (min-width: 1024px) {
    .wrp-main-content {
        flex-direction: row;
        flex-grow: 1;
    }
}

/* Grid Layout */
.grid {
  display: grid;
  flex-grow: 1; /* Allow grid to fill space */
}

.grid-cols-1 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 1024px) {
  .lg\:grid-cols-4 {
    grid-template-columns: 340px 1fr;
  }
  .lg\:col-span-1 {
    grid-column: 1 / 2;
  }
  .lg\:col-span-3 {
    grid-column: 2 / 3;
    position: relative;
    height: 100%;
  }
}

/* Sidebar Styles */
body .wrp-main-content .lg\:col-span-1,
.wrp-main-content .lg\:col-span-1 {
  background-color: #ffffff !important;
  padding: 1.5rem 2.5rem;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Cards */
body .wrp-main-content .bg-white,
.wrp-main-content .bg-white {
  background-color: #ffffff !important;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid #e5e7eb;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  width: 100%;
  max-width: 380px;
}

/* Form Elements */
.wrp-input-group {
  margin-bottom: 1rem;
}

.wrp-input-group label {
  display: block;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.wrp-input-group input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);
  background-color: #ffffff !important;
  color: #111827 !important;
  box-sizing: border-box;
  text-align: left;
}

.wrp-input-group input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-orange);
  box-shadow: 0 0 0 3px rgba(246, 115, 29, 0.1);
}

/* Radio Buttons */
.wrp-route-type label {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: var(--transition);
}

.wrp-route-type label:hover {
  background: #f3f4f6;
  border-color: var(--gray-400);
}

.wrp-route-type input[type="radio"] {
  margin-right: 0.75rem;
  accent-color: #111827;
}

/* Checkboxes */
.wrp-checkbox-group label {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
}

.wrp-checkbox-group label:hover {
  background: #f3f4f6;
}

.wrp-checkbox-group input[type="checkbox"] {
  margin-right: 0.75rem;
  accent-color: var(--primary-orange);
}

/* Buttons */
.wrp-button-group {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
  width: 100%;
}

.wrp-button-group button {
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--border-radius);
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.wrp-button-group button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary Button - Route berechnen */
.wrp-button-group button:first-child {
  flex: 1;
  background: #F6731D !important;
  color: var(--white);
}

.wrp-button-group button:first-child:hover:not(:disabled) {
  background: var(--secondary-orange);
  transform: translateY(-1px);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

/* Reset Button - Quadratisch */
.wrp-button-group button:nth-child(2) {
  width: 50px;
  height: 50px;
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #d1d5db;
  padding: 0;
}

.wrp-button-group button:nth-child(2):hover {
  background: #e5e7eb;
  border-color: #9ca3af;
}

/* Export Buttons */
.wrp-export-btn {
  background: var(--gray-100);
  color: var(--gray-700);
  padding: 0.5rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.wrp-export-btn:hover {
  background: var(--gray-200);
  border-color: var(--gray-400);
}

/* Map Container - Better sizing for Twenty Twenty Four */
.wrp-main-content .lg\:col-span-3 {
  position: relative;
  min-height: 700px;
  height: 100%;
  padding: 0;
}

#wrp-map-container {
  width: 100%;
  height: 100%;
  min-height: 700px;
  position: relative;
}

.leaflet-container {
  height: 100% !important;
  width: 100% !important;
  border-radius: 0;
  position: relative !important;
}

/* Custom Marker Styles */
.wrp-start-marker .wrp-start-marker-inner {
    width: 16px;
    height: 16px;
    background-color: #4285f4; /* Google Maps Blue */
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.wrp-end-marker .wrp-end-marker-inner {
    width: 16px;
    height: 16px;
    background-color: #EA4335; /* Google Maps Red */
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* POI Marker Styles */
.custom-poi-marker {
    z-index: 1000 !important;
    position: relative !important;
}

.wien-wc-icon {
    z-index: 1000 !important;
    position: relative !important;
}

.wien-parking-icon {
    z-index: 900 !important;
    position: relative !important;
}

.wien-trinkbrunnen-icon {
    z-index: 900 !important;
    position: relative !important;
}

/* Loading Overlay */
.wrp-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 1000;
}

.wrp-loading-spinner {
  width: 3rem;
  height: 3rem;
  border: 2px solid var(--gray-200);
  border-top: 2px solid var(--primary-orange);
  border-radius: 50%;
  animation: wrp-spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes wrp-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Weather Widget - REMOVED */

/* Route Information */
.wrp-route-info {
  background: #ffffff; /* Use static white to avoid dark mode override */
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  padding: 1.5rem;
}

.wrp-route-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* Smaller headings for sections inside the sidebar and info panel - UNIFIED */
.wrp-options h3,
.wrp-route-type h3,
.wrp-route-info > h3,
#wrp-instructions h4 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 0.5rem;
}

.wrp-route-stat {
  text-align: center;
  padding: 1rem;
  background: #f9fafb;
  border-radius: var(--border-radius);
  flex-basis: 0; /* Distribute space evenly */
  flex-grow: 1; /* Distribute space evenly */
}

.wrp-route-stat + .wrp-route-stat {
    margin-left: 0.75rem;
}

.wrp-route-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-orange);
}

.wrp-route-stat-label {
  font-size: 0.875rem;
  color: var(--gray-600);
  margin-top: 0.25rem;
}

.wrp-instructions-scroll-container {
    max-height: 250px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Icons */
.fas, .fa {
  margin-right: 0.5rem;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.space-x-3 > * + * {
  margin-left: 0.75rem;
}

.space-y-2 > * + * {
  margin-top: 0.5rem;
}

.space-y-4 > * + * {
  margin-top: 1rem;
}

.space-y-6 > * + * {
  margin-top: 1.5rem;
}

/* Responsive Design */
@media (max-width: 1023px) {
  :root { --wrp-sheet-peek: 300px; --wrp-sheet-mid: 50vh; }
  .wrp-lovable-container {
    margin: 0;
    border-radius: 0;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  
  .wrp-header {
    padding: 1rem;
  }

  /* Full-width map and bottom sheet sidebar for tablets and phones */
  .grid.lg\:grid-cols-4 {
    display: block !important;
  }

  .wrp-main-content .lg\:col-span-3 {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    min-height: 60vh !important;
    padding: 0 !important;
  }

  .wrp-page-active [id^="wrp-map-"] { position: relative !important; top: 0; left: auto; right: auto; bottom: auto; z-index: auto !important; }

  /* Account for WP admin bar on mobile (approx 46px) */
  body.admin-bar .wrp-page-active [id^="wrp-map-"] { top: 46px; }

  .lg\:col-span-1 { position: relative !important; left: auto; right: auto; bottom: auto; width: 100% !important; max-height: none !important; background: #ffffff !important; border-top-left-radius: 0 !important; border-top-right-radius: 0 !important; box-shadow: none !important; transform: none !important; transition: none !important; padding: 1rem !important; z-index: 1 !important; border-right: none !important; border-bottom: none !important; box-sizing: border-box !important; overflow: visible !important; display: block !important; align-items: stretch !important; }
  .lg\:col-span-1 > .bg-white {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }
  .lg\:col-span-1 .wrp-input-group input[type="text"] {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .lg\:col-span-1.expanded, .lg\:col-span-1.collapsed { transform: none !important; }
  .lg\:col-span-1::before { display: none !important; }
  /* Wider visible scrollbar on iOS/Android near right edge */
  * {
    scrollbar-width: auto;
    scrollbar-color: #c7c7c7 #f1f1f1;
  }
  ::-webkit-scrollbar {
    width: 14px;
    height: 14px;
  }
  ::-webkit-scrollbar-thumb {
    background: #c7c7c7;
    border-radius: 8px;
  }
  ::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 8px;
  }
}

/* Hide global site header/footer on planner page (mobile only) and render compact version inside sheet */
/* Version 1: Fixiere Theme-Header (Logo/Hamburger) und lasse nur die Karte scrollen */
@media (max-width: 1023px) {
  /* Allow normal page scroll; theme header stays as the top boundary */
  body { overflow: auto !important; }
  .site-header, header { position: sticky !important; top: 0; z-index: 3000; }
  .wrp-fixed-title { display: none !important; }
  /* Map in normal flow for responsive page */
  [id^="wrp-map-"] { position: relative !important; top: 0 !important; height: auto !important; min-height: 0 !important; }
}

/* Version 1 header removed: we use theme's original header */

/* Bottom sheet site info compact styles (only mobile) */
@media (max-width: 1023px) {
  .wrp-site-info-mobile { margin-top: 0.5rem; width: 100%; }
  .wrp-site-top-row {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center;
    gap: 0.5rem; border-top: 1px solid #e5e7eb; padding-top: 0.75rem;
  }
  .wrp-site-logo img { max-height: 22px; width: auto; height: auto; display: block; margin-left: 0; }
  .wrp-site-title { font-size: 0.95rem; font-weight: 700; color: #111827; text-align: left; }
  .wrp-site-legal { font-size: 0.8rem; color: #6b7280; text-align: center; }
  .wrp-site-legal a { color: #6b7280; text-decoration: none; }
  .wrp-site-legal .sep { margin: 0 0.4rem; }
  .wrp-site-hamburger { background: none; border: 1px solid #e5e7eb; border-radius: 6px; padding: 6px; cursor: pointer; }
  .wrp-site-hamburger span { display: block; width: 18px; height: 2px; background:#111; margin:3px 0; }
  .wrp-site-bottom-row { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 0.5rem; }
  .wrp-site-subtitle { font-size: 0.85rem; color: #6b7280; }
  .wrp-site-copy { font-size: 0.8rem; color: #6b7280; }

  .wrp-mobile-menu { margin-top: 0.5rem; }
  .wrp-mobile-menu nav ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 1rem; justify-content: center; }
  .wrp-mobile-menu nav a { color: #374151; text-decoration: none; font-size: 0.9rem; }
  .hidden { display: none !important; }
}

/* Hide mobile site info on desktop */
@media (min-width: 1024px) {
  .wrp-site-info-mobile { display: none !important; }
}

@media (max-width: 767px) {
  .wrp-lovable-container {
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    overflow-x: hidden !important; /* Prevent horizontal scroll */
  }
  
  /* Mobile Header - Show only left text */
  .wrp-header h1 > div > div:nth-child(2),
  .wrp-header h1 > div > div:nth-child(3) {
    display: none !important;
  }
  
  .wrp-header h1 > div > div:nth-child(1) {
    text-align: center !important;
    max-width: 100% !important;
    font-size: 1.2rem !important;
  }
  
  /* Mobile Header positioning - keep within flow to avoid covering site header */
  .wrp-header {
    position: relative !important;
    z-index: 1 !important;
    padding: 0.5rem 1rem !important; /* revert to balanced padding */
  }
  
  /* Plugin hamburger hidden on mobile as well (use site header hamburger) */
  .wrp-hamburger-btn {
    display: none !important;
  }
  
  .wrp-hamburger-btn span {
    display: block !important;
    width: 25px !important;
    height: 3px !important;
    background-color: white !important;
    margin: 5px 0 !important;
    transition: 0.3s !important;
  }
  
  .wrp-hamburger-btn.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px) !important;
  }
  
  .wrp-hamburger-btn.active span:nth-child(2) {
    opacity: 0 !important;
  }
  
  .wrp-hamburger-btn.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px) !important;
  }
  
  /* Full-width map and bottom sheet sidebar */
  .wrp-main-content .lg\\:col-span-3 {
    position: relative !important;
    width: 100% !important;
    min-height: 100vh !important;
    height: 100vh !important;
    padding: 0 !important;
  }
  [id^="wrp-map-"] { position: relative !important; inset: auto !important; width: 100% !important; height: auto !important; min-height: 0 !important; }

  .grid.lg\\:grid-cols-4 { display: block !important; }

  .lg\\:col-span-1 {
    position: relative !important;
    left: auto; right: auto; bottom: auto;
    width: 100% !important;
    max-height: none !important;
    background: transparent !important;
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    transition: none !important;
    padding-bottom: 0 !important;
    z-index: auto !important;
  }
  .lg\\:col-span-1.expanded, .lg\\:col-span-1.collapsed { transform: none !important; }
  .lg\\:col-span-1::before { display: none !important; }
  
  .wrp-header h1 {
    font-size: 1.2rem;
  }

  /* --- FINAL, BALANCED & CORRECTED MOBILE LAYOUT --- */
  
  /* The main info container gets reduced padding */
  .wrp-route-info-container {
    padding: 0.5rem !important;
  }
  
  /* The inner wrapper gets a white background and rounded corners */
  .wrp-route-info {
    background-color: #ffffff !important;
    border-radius: var(--border-radius) !important;
    padding: 1rem !important; /* Reduced inner padding for content */
    box-shadow: var(--shadow) !important;
  }
  
  /* The JS-driven class handles the grid now, so this rule is removed from the media query */
  
  .wrp-route-stat {
    padding: 0.75rem !important;
    margin-left: 0 !important;
  }

  .wrp-route-stat-value {
    font-size: 1.25rem;
  }
  
  /* Ensure all headings in the info section are identical and styled correctly */
  /* Using the container ID for ultimate specificity */
  [id^="wrp-container-"] .wrp-route-info h3, 
  [id^="wrp-container-"] [id^="wrp-elevation-chart-container-"] h4,
  [id^="wrp-container-"] [id^="wrp-instructions-"] h4 {
      font-family: 'Cardo', serif !important;
      font-size: 1.25rem !important;
      font-weight: 700 !important;
      color: var(--gray-800) !important;
      border-bottom: 1px solid var(--gray-200) !important;
      padding-bottom: 0.5rem !important;
      margin-bottom: 1rem !important;
  }
}

/* Allow page to scroll vertically under bottom sheet on mobile/tablet */
@media (max-width: 1023px) {
  .leaflet-container {
    touch-action: pan-y !important; /* nur vertikal scrollen, keine seitliche Bewegung */
  }
}

/* Mobile gutters: ensure map and sidebar fill width but keep equal side padding */
@media (max-width: 1023px) {
  .wrp-main-content { padding: 0 !important; box-sizing: border-box !important; }
  .wrp-main-content .lg\:grid-cols-4 { margin: 0 !important; }
  .wrp-main-content .lg\:col-span-3 { margin: 0 !important; }
  /* Prevent overlap: ensure a tiny spacer if rounding errors occur */
  [id^="wrp-container-"] .lg\:col-span-1 { margin-bottom: 0 !important; }
  [id^="wrp-container-"] .lg\:col-span-3 { margin-top: 0 !important; }
  /* Map and sidebar should flush to screen edges */
  [id^="wrp-container-"] .lg\:col-span-3 { padding-left: 0 !important; padding-right: 0 !important; background: transparent !important; position: relative !important; z-index: 0 !important; }
  [id^="wrp-map-"] { width: 100% !important; height: 75vh !important; min-height: 520px !important; }
  .wrp-main-content .lg\:col-span-1 { padding-left: 0 !important; padding-right: 0 !important; padding-bottom: 0 !important; padding-top: 0 !important; }
  [id^="wrp-container-"] .wrp-main-content .bg-white { width: 100% !important; max-width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; border-radius: 0 !important; }
  /* remove bottom gap between sidebar and map */
  [id^="wrp-container-"] .lg\:col-span-1 > .bg-white:last-child { margin-bottom: 0 !important; border-bottom-left-radius: 0 !important; border-bottom-right-radius: 0 !important; }
  [id^="wrp-container-"] .lg\:col-span-1 > .bg-white:first-child { border-top-left-radius: 0 !important; border-top-right-radius: 0 !important; }
  /* remove gap between header and sidebar */
  .wrp-header { margin-bottom: 0 !important; }
  [id^="wrp-container-"] .lg\:col-span-1 > .bg-white:first-child { margin-top: 0 !important; }
  .wrp-main-content .lg\:col-span-3 { margin-top: 0 !important; }
}

/* Remove full-bleed container margins to avoid header/viewport shift */

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --gray-50: #1f2937;
    --gray-100: #374151;
    --gray-200: #4b5563;
    --gray-300: #6b7280;
    --white: #111827;
    --gray-900: #f9fafb;
  }
}

/* Print Styles */
@media print {
  .wrp-lovable-container {
    box-shadow: none;
    border: 1px solid var(--gray-300);
  }
  
  .wrp-header {
    background: var(--gray-100) !important;
    color: var(--gray-900) !important;
  }
  
  .wrp-button-group,
  .wrp-export-btn {
    display: none;
  }
}

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

/* Focus Styles for Accessibility */
button:focus,
select:focus,
input[type="text"]:focus {
  outline: 2px solid var(--primary-orange);
  outline-offset: 2px;
}

/* Custom focus for radios and checkboxes for better UX */
/* 
.wrp-route-type label:focus-within,
.wrp-checkbox-group label:focus-within {
  outline: 2px solid var(--primary-orange);
  outline-offset: 2px;
  border-radius: var(--border-radius);
}
*/

.wrp-route-type input[type="radio"]:focus,
.wrp-checkbox-group input[type="checkbox"]:focus {
  outline: none; /* Hide the default square outline */
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .wrp-lovable-container {
    border: 2px solid var(--gray-900);
  }
  
  .wrp-input-group input[type="text"] {
    border: 2px solid var(--gray-900);
  }
  
  .wrp-button-group button {
    border: 2px solid var(--gray-900);
  }
}

/* Loading Animation */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Route Information - now full width */
.wrp-route-info-container {
    padding: 1.5rem 2.5rem; /* Default padding for large screens */
    border-top: 1px solid #e5e7eb;
    background-color: #f9fafb !important;
    position: relative !important;
    z-index: 1 !important;
}

button[id^="wrp-swap-"]:focus,
button[id^="wrp-reset-"]:focus {
    outline: none !important;
}

button[id^="wrp-swap-"] i,
button[id^="wrp-reset-"] i {
    margin: 0 !important; /* Force no margin on icons */
}

/* Make sure elevation container also has a white background */
.wrp-elevation-chart-container {
    background-color: #ffffff;
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    position: relative;
    height: 250px;
}

/* Remove canvas margin as container now handles centering */
.wrp-elevation-chart-container canvas {
    margin: 0 !important;
}

/* --- UNIFIED HEADING STYLES FOR INFO SECTIONS (GLOBAL) --- */
/* Using the container ID for ultimate specificity */
[id^="wrp-container-"] .wrp-route-info h3, 
[id^="wrp-container-"] [id^="wrp-elevation-chart-container-"] h4,
[id^="wrp-container-"] [id^="wrp-instructions-"] h4 {
    font-family: 'Cardo', serif !important;
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    color: var(--gray-800) !important;
    border-bottom: 1px solid var(--gray-200) !important;
    padding-bottom: 0.5rem !important;
    margin-bottom: 1rem !important;
}

/* Add margin-top to the calculate button group */
.wrp-calculate-group {
    margin-top: 1.5rem;
}

/* This class is now added by JS on mobile for a robust 2x2 grid */
.wrp-mobile-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
}

/* Default flex display for desktop */
[id^="wrp-route-details-"] {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

#wrp-elevation-container {
    height: 250px !important; /* Final Fix: Force height to prevent theme override */
    position: relative; /* Required by Chart.js for responsiveness */
    background-color: #ffffff; /* Ensure background is white */
    padding: 1rem;
}

/* POI Options Styling */
.wrp-route-options {
    margin-bottom: 20px;
}

.wrp-route-type {
    margin-bottom: 15px;
    width: 100%;
}

.wrp-route-type label {
    display: block;
    width: 100%;
    cursor: pointer;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    background: #fafafa !important;
    transition: var(--transition);
    box-sizing: border-box;
}

.wrp-route-type label:hover {
    background: #f0f0f0 !important;
    border-color: var(--gray-400);
}

.wrp-route-type input[type="radio"] {
    margin-right: 8px;
}

.wrp-route-type input[type="radio"]:checked + .wrp-route-type-label {
    /* Remove blue highlighting - keep natural radio button appearance */
}

.wrp-poi-options {
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.wrp-poi-options h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.wrp-poi-checkboxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.wrp-poi-checkboxes label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    font-size: 13px;
}

.wrp-poi-checkboxes label:hover {
    background: #f5f5f5;
}

.wrp-poi-checkboxes input[type="checkbox"] {
    margin-right: 8px;
    accent-color: #4a90e2;
}

.wrp-poi-label {
    color: #666;
    font-size: 12px;
}

/* POI Marker Styles */
.poi-marker {
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    font-weight: bold;
}

.poi-marker-bike-parking {
    background-color: #4a90e2;
}

.poi-marker-drinking-fountain {
    background-color: #3498db;
}

.poi-marker-toilet {
    background-color: #2ecc71;
}

.poi-marker-bike-shop {
    background-color: #e67e22;
}

.poi-marker-attraction {
    background-color: #9b59b6;
}

/* POI Popup Styles */
.wrp-poi-popup {
    transition: opacity 0.3s ease-in-out;
}

.wrp-poi-popup.hidden {
    display: none;
    opacity: 0;
}

.wrp-poi-popup .wrp-poi-checkbox {
    @apply form-checkbox h-5 w-5 text-blue-600 transition duration-150 ease-in-out;
}

.wrp-poi-popup .poi-category {
    @apply border-b border-gray-200 pb-4;
}

.wrp-poi-popup .poi-category:last-child {
    @apply border-b-0 pb-0;
}

/* POI Marker Styles */
.wrp-poi-marker {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

.wrp-poi-marker:hover {
    transform: scale(1.1);
}

.wrp-poi-marker.bike_parking { background-color: #4a90e2; }
.wrp-poi-marker.drinking_fountains { background-color: #2ecc71; }
.wrp-poi-marker.toilets { background-color: #e74c3c; }
.wrp-poi-marker.bike_shops { background-color: #f39c12; }
.wrp-poi-marker.attractions { background-color: #9b59b6; }

/* POI Popup Content Styles */
.leaflet-popup-content {
    margin: 0;
    padding: 0;
}

.wrp-poi-popup-content {
    padding: 15px;
    min-width: 200px;
    max-width: 300px;
}

.wrp-poi-popup-content h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #2c3e50;
}

.wrp-poi-popup-content p {
    margin: 5px 0;
    font-size: 14px;
    color: #34495e;
    display: flex;
    align-items: center;
}

.wrp-poi-popup-content p i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
    color: #7f8c8d;
}

.wrp-poi-popup-content .poi-meta {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    font-size: 12px;
}

.wrp-poi-popup-content .poi-meta a {
    display: inline-flex;
    align-items: center;
    color: #3498db;
    text-decoration: none;
    transition: color 0.2s ease;
}

.wrp-poi-popup-content .poi-meta a:hover {
    color: #2980b9;
}

/* POI Selection Popup Styles */
.wrp-poi-popup {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.wrp-poi-popup.hidden {
    opacity: 0;
    pointer-events: none;
}

.wrp-poi-popup > div {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.wrp-poi-popup .wrp-poi-checkbox {
    width: 1.2em;
    height: 1.2em;
    margin-right: 0.5em;
}

.wrp-poi-popup button {
    transition: all 0.2s ease;
}

.wrp-poi-popup button:hover {
    transform: translateY(-1px);
}

/* POI Layer Control Styles */
.wrp-layer-control {
    background: white;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.2);
}

.wrp-layer-control label {
    display: block;
    margin: 5px 0;
    cursor: pointer;
}

.wrp-layer-control input[type="checkbox"] {
    margin-right: 5px;
} 

/* POI Filter Popup */
.wrpl-poi-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
.wrpl-poi-popup {
  background: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.wrpl-poi-popup h3 {
  margin-top: 0;
}
.wrpl-poi-popup ul {
  max-height: 300px;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}
.wrpl-poi-popup li {
  margin-bottom: 0.5rem;
}
.wrpl-poi-popup button {
  margin-top: 1rem;
}

/* Route Information Styles */
.wrp-route-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.wrp-route-stat {
  text-align: center;
  padding: 1rem;
  background: #f9fafb;
  border-radius: 0.5rem;
  flex-basis: 0;
  flex-grow: 1;
}

.wrp-route-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #F6731D;
}

.wrp-route-stat-label {
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

.wrp-instructions-scroll-container {
  max-height: 250px;
  overflow-y: auto;
  padding-right: 5px;
}

/* Mobile grid for route stats */
.wrp-mobile-grid {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
}

.wrp-route-info-container {
  padding: 0.75rem 1rem;
  border-top: 1px solid #e5e7eb;
  background-color: #f9fafb !important;
}

/* Mobile route results overlay styles */
.wrp-route-results-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 3000;
  display: flex;
  flex-direction: column;
}
.wrp-route-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}
.wrp-route-results-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
}
.wrp-route-results-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}
.wrp-route-results-content {
  margin: 1rem;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.15);
  padding: 1rem;
  overflow: auto;
  max-height: calc(100vh - 64px);
}

/* Match Wegbeschreibung heading font to Routeninfo */
.wrp-route-results-content h3 {
  font-family: 'Cardo', serif !important;
  font-weight: 700 !important;
}

/* Make route stats values orange like desktop */
.wrp-route-results-content .wrp-route-stat-value {
  color: #F6731D !important;
  font-size: 1.25rem !important;
}

/* Instructions container specific padding reduction */
[id^="wrp-instructions-"] {
  padding: 0.5rem 0 !important;
  margin-top: 0.5rem !important;
}

/* Fix sidebar dragging issue */
.lg\\:col-span-1 {
  user-select: none !important;
  -webkit-user-drag: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  pointer-events: auto !important;
  position: relative !important;
  cursor: default !important;
  /* Allow normal touch behavior to enable input focus/editing */
  touch-action: auto !important;
}

/* Specifically target the sidebar container */
.wrp-lovable-container .lg\\:col-span-1 {
  cursor: default !important;
}

.wrp-lovable-container .lg\\:col-span-1:hover {
  cursor: default !important;
}

/* Prevent dragging of the entire grid container */
.grid.lg\\:grid-cols-4 {
  user-select: none !important;
  -webkit-user-drag: none !important;
}

/* Additional drag prevention for all interactive elements in sidebar */
.wrp-lovable-container * {
  -webkit-user-drag: none !important;
  -khtml-user-drag: none !important;
  -moz-user-drag: none !important;
  -o-user-drag: none !important;
  user-drag: none !important;
  cursor: inherit !important;
}

/* Force cursor styles for sidebar elements */
.wrp-lovable-container .lg\\:col-span-1 * {
  cursor: default !important;
}

/* Exception for buttons and clickable elements */
.wrp-lovable-container button,
.wrp-lovable-container input[type="button"],
.wrp-lovable-container input[type="submit"],
.wrp-lovable-container label,
.wrp-lovable-container a {
  cursor: pointer !important;
}

.wrp-lovable-container input[type="text"],
.wrp-lovable-container textarea {
  cursor: text !important;
}

/* Allow text selection in input fields */
.wrp-lovable-container input[type="text"],
.wrp-lovable-container textarea {
  user-select: text !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
} 

/* Strong override: ensure inputs in sidebar are fully interactive on all devices */
[id^="wrp-container-"] .lg\\:col-span-1,
[id^="wrp-container-"] .lg\\:col-span-1 * {
  -webkit-user-select: auto !important;
  -moz-user-select: auto !important;
  -ms-user-select: auto !important;
  user-select: auto !important;
}

[id^="wrp-container-"] .lg\\:col-span-1 input,
[id^="wrp-container-"] .lg\\:col-span-1 textarea {
  pointer-events: auto !important;
  touch-action: manipulation !important;
}

/* Prevent content from overflowing horizontally in bottom sheet */
@media (max-width: 1023px) {
  [id^="wrp-container-"] .lg\\:col-span-1 * {
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-wrap: anywhere !important;
    -webkit-overflow-scrolling: touch !important;
  }
}

/* Final mobile + tablet overrides with high specificity to ensure bottom sheet */
@media (max-width: 1023px) {
  [id^="wrp-container-"] .grid.lg\\:grid-cols-4 { display: block !important; }

  [id^="wrp-container-"] .wrp-main-content .lg\\:col-span-3 {
    position: relative !important;
    width: 100% !important;
    min-height: 60vh !important;
    height: auto !important;
    padding: 0 !important;
  }

  [id^="wrp-container-"] [id^="wrp-map-"] { position: relative !important; inset: auto !important; width: 100% !important; height: 60vh !important; min-height: 400px !important; }

  .wrp-sheet-portal,
  [id^="wrp-container-"] .lg\\:col-span-1 {
    position: relative !important;
    left: auto; right: auto; bottom: auto;
    width: 100% !important;
    max-height: none !important;
    background: transparent !important;
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    transition: none !important;
    padding-bottom: 0 !important;
    z-index: auto !important;
    border-right: none !important;
    border-bottom: none !important;
  }
  /* Place original hamburger at bottom-right inside sheet */
  .wrp-sheet-portal .wrp-hamburger-btn,
  [id^="wrp-container-"] .wrp-hamburger-btn { display: none !important; }
  .wrp-sheet-portal.expanded,
  [id^="wrp-container-"] .lg\\:col-span-1.expanded { transform: none !important; }
  .wrp-sheet-portal.collapsed,
  [id^="wrp-container-"] .lg\\:col-span-1.collapsed { transform: none !important; }
  [id^="wrp-container-"] .lg\\:col-span-1::before { display: none !important; }
}