* {
  box-sizing: border-box;
}

/* Improve touch targets on mobile */
@media (max-width: 768px) {

  button,
  .control-btn,
  .nav-link {
    color: red;
    touch-action: manipulation;
  }

  /* Prevent zoom on input focus */
  input,
  select,
  textarea {
    font-size: 16px;
  }
}

body {
  font-family: 'Arial', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  background-image: url('./attached_assets/background_grass.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 100vh;
  color: #333;
  direction: rtl;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.2);
  z-index: -1;
}

.header {
  background: #F8F8F8;
  background-image: url('./attached_assets/background.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 15px 40px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000000;
}

@media (max-width: 768px) {
  .header {
    padding: 5px 10px;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    position: relative;
    direction: ltr;
    /* Override RTL for proper button positioning */
  }
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(248, 248, 248, 0.2);
  z-index: 1;
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: #333;
  font-size: 24px;
  cursor: pointer;
  padding: 5px;
  border-radius: 4px;
  transition: background-color 0.2s;
  z-index: 10000;
  order: 1;
}

.mobile-menu-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 15px;
  position: relative;
  z-index: 2;
}

@media (max-width: 768px) {
  .logo-section {
    order: 2;
    flex: 1;
    justify-content: center;
    direction: rtl;
    /* Restore RTL for Hebrew text */
  }
}

.site-title {
  font-size: 24px;
  font-weight: bold;
  color: #333;
  margin: 0;
  cursor: pointer;
  transition: color 0.2s;
}

.site-title:hover {
  color: #748873;
}

@media (max-width: 768px) {
  .site-title {
    font-size: 18px;
    text-align: center;
    flex: 1;
  }
}

.nav-links {
  display: flex;
  gap: 30px;
  position: relative;
  z-index: 2;
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #F8F8F8;
    background-image: url('./attached_assets/background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    flex-direction: column;
    gap: 0;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
    z-index: 9999;
    direction: rtl;
  }

  .nav-links::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(248, 248, 248, 0.95);
    z-index: 1;
  }

  .nav-links.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-links .nav-link {
    position: relative;
    z-index: 2;
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    text-align: center;
    font-size: 16px;
  }

  .nav-links .nav-link:last-child {
    border-bottom: none;
  }
}

.nav-link {
  color: #333;
  text-decoration: none;
  font-size: 16px;
  font-weight: bold;
  transition: color 0.2s;
  cursor: pointer;
}

.nav-link:hover {
  color: #748873;
}

.help-tutorial-btn {
  background: transparent;
  color: black;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  margin: 0 8px;
}

.help-tutorial-btn:hover {
  background: #4682B4;
  color: white;
  transform: scale(1.1);
}

.help-tutorial-btn ion-icon {
  font-size: 24px;
}

@media (max-width: 768px) {
  .nav-link {
    font-size: 14px;
    color: #333;
    padding: 4px 8px;
  }

  .help-tutorial-btn {
    font-size: 14px;
    color: #333;
    /* border: 2px solid white; */
    padding: 4px 8px;
  }

  .help-tutorial-btn:hover {
    color: #748873;
  }
}

.main-container {
  padding: 10px;
  margin-top: 55px;
  /* Account for fixed header height */
}

@media (max-width: 768px) {
  .main-container {
    padding: 2px;
    margin-top: 0px;
  }
}

html {
  scroll-behavior: smooth;
}

.content-section {
  background: #F8F8F8;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  padding: 30px;
  margin: 20px auto;
  max-width: 1400px;
}

@media (max-width: 768px) {
  .content-section {
    padding: 20px 15px;
    margin: 15px 10px;
    border-radius: 8px;
  }
}

.section-title {
  font-size: 28px;
  font-weight: bold;
  color: #333;
  margin-bottom: 20px;
  text-align: center;
}

.section-content {
  line-height: 1.8;
  font-size: 16px;
  color: #555;
}

.container {
  display: flex;
  gap: 20px;
  align-items: stretch;
  max-width: 1400px;
  margin: 0 auto;
  height: calc(100vh - 100px) !important;
  flex-direction: row-reverse;
}

@media (max-width: 768px) {
  .container {
    flex-direction: column;
    height: calc(100vh - 140px) !important;
    gap: 5px;
  }
}

.map-container {
  flex: 2;
  background: #F8F8F8;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  padding: 15px;
  position: relative;
  /* height: 600px; */
  width: 100%;
  /* Adjusted to take full width */
}

@media (max-width: 768px) {
  .map-container {
    padding: 8px;
    border-radius: 8px;
    height: 70vh;
    min-height: 400px;
  }
}

.sidebar {
  flex: 1;
  min-width: 320px;
  background: #F8F8F8;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  padding: 12px;
  overflow-y: auto;
  height: 600px;
}

#map {
  height: 100%;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.segment-name-display {
  position: absolute;
  top: 25px;
  left: 135px;
  background: rgba(70, 130, 180, 0.9);
  color: white;
  padding: 10px 15px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  max-width: 250px;
  min-height: 50px;
  word-wrap: break-word;
  display: none;
  margin-bottom: 8px;
}

.segment-name-display.bounce-intro {
  animation: pulseGlow 1.2s ease-in-out;
}

@keyframes pulseGlow {
  0% {
    transform: scale(0.8);
    opacity: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(70, 130, 180, 0.7);
  }
  25% {
    transform: scale(1.05);
    opacity: 0.8;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 20px 5px rgba(70, 130, 180, 0.6);
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 30px 10px rgba(70, 130, 180, 0.8);
  }
  75% {
    transform: scale(1.05);
    opacity: 1;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 20px 5px rgba(70, 130, 180, 0.6);
  }
  100% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.6), 0 0 0 0 rgba(255, 68, 68, 0.4);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.8), 0 0 0 6px rgba(255, 68, 68, 0.1);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.6), 0 0 0 0 rgba(255, 68, 68, 0.4);
  }
}

@keyframes tooltipBounce {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-3px);
  }
}

@media (max-width: 768px) {
  .segment-name-display {
    position: absolute;
    top: 60px;
    right: 75px;
    left: auto;
    max-width: 150px;
    font-size: 12px;
    padding: 8px 12px;
    text-align: right;
    margin-bottom: 6px;
  }
}

.legend-container {
  position: absolute;
  top: 25px;
  left: 25px;
  z-index: 1000;
  direction: rtl;
  min-width: 100px;
}

@media (max-width: 768px) {
  .legend-container {
    top: 15px;
    left: 15px;
    right: auto;
    width: auto;
  }
}

.issue-warning {
  margin-bottom: 5px;
}

.legend-box {
  background: #F8F8F8;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  padding: 6px;
  min-width: 0;
  width: auto;
  overflow: hidden;
  transition: all 0.3s ease-in-out;
  transform-origin: top;
}

.legend-box.open {
  width: 100px;
  opacity: 1;
  transform: scaleY(1);
}

.legend-title {
  font-weight: bold;
  font-size: 11px;
  color: #333;
  margin-bottom: 4px;
  text-align: center;
}

.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 3px;
  gap: 4px;
}

.legend-color {
  width: 12px;
  height: 3px;
  border-radius: 1px;
  flex-shrink: 0;
}

.legend-label {
  font-size: 10px;
  color: #333;
  font-weight: 500;
  white-space: nowrap;
}

.route-warning {
  background: #ff9800;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  margin-top: 8px;
  box-shadow: 0 2px 6px rgba(255, 152, 0, 0.3);
  text-align: center;
  animation: pulse 2s infinite;
  cursor: pointer;
  transition: all 0.2s;
}

.route-warning:hover {
  background: #f57c00;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

@keyframes pulse {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }

  100% {
    opacity: 1;
  }
}

.winter-warning {
  background: #ff9800;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  margin-top: 8px;
  box-shadow: 0 2px 6px rgba(255, 152, 0, 0.3);
  text-align: center;
  animation: pulse 2s infinite;
  cursor: pointer;
  transition: all 0.2s;
}

.winter-warning:hover {
  background: #f57c00;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

.segment-warning {
  background: #f44336;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  margin-top: 8px;
  box-shadow: 0 2px 6px rgba(244, 67, 54, 0.3);
  text-align: center;
  animation: pulse 2s infinite;
  cursor: pointer;
  transition: all 0.2s;
}

.segment-warning:hover {
  background: #d32f2f;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

.route-loading {
  background: #2196F3;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  margin-top: 8px;
  box-shadow: 0 2px 6px rgba(33, 150, 243, 0.3);
  text-align: center;
  animation: pulse 1.5s infinite;
}

.paved-trail {
  /* background-color: rgb(2, 136, 209); */
  background-color: rgb(101, 170, 162);
}

.dirt-trail {
  /* background-color: rgb(85, 139, 47); */
  background-color: rgb(174, 144, 103);
}

.road {
  /* background-color: rgb(230, 238, 156); */
  /* background-color: rgb(186, 194, 200); */
  background-color: rgb(138, 147, 158);
}

#error-message {
  color: #e74c3c;
  margin: 10px 0;
  display: none;
  padding: 10px;
  background: #fdf2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
}

.route-segment {
  cursor: pointer;
}

.segment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #ddd;
  transition: background-color 0.2s;
}

.segment-item:hover {
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 4px;
  padding-left: 4px;
}

.remove-btn {
  background: #8FBC8F;
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 15px;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(143, 188, 143, 0.3);
}

.remove-btn:hover {
  background: #6B8E23;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(107, 142, 35, 0.4);
}

.undo-btn {
  background: #8FBC8F;
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(143, 188, 143, 0.3);
  min-width: 60px;
}

.undo-btn:disabled {
  background: #cccccc;
  cursor: not-allowed;
  box-shadow: none;
}

.undo-btn:hover:not(:disabled) {
  background: #6B8E23;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(107, 142, 35, 0.4);
}

.reset-btn-subtle {
  background: #f5f5f5;
  color: #666;
  border: 1px solid #e0e0e0;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  box-shadow: none;
  min-width: 36px;
}

.reset-btn-subtle:hover:not(:disabled) {
  background: #e8e8e8;
  color: #333;
  border-color: #ccc;
  transform: none;
}

.reset-btn-subtle:disabled {
  background: #f9f9f9;
  color: #ccc;
  border-color: #f0f0f0;
  cursor: not-allowed;
}

.share-btn {
  background: #4682B4;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(70, 130, 180, 0.3);
  flex: 0 0 auto;
}

.share-btn:disabled {
  background: #cccccc;
  cursor: not-allowed;
  box-shadow: none;
}

.share-btn:hover:not(:disabled) {
  background: #5F9EA0;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(70, 130, 180, 0.4);
}

.share-modal,
.reset-modal,
.download-modal,
.segment-action-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  direction: rtl;
}

.share-modal-content,
.reset-modal-content,
.download-modal-content,
.segment-action-modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow: auto;
}

@media (max-width: 768px) {

  .share-modal-content,
  .reset-modal-content,
  .download-modal-content,
  .segment-action-modal-content {
    width: 95%;
    max-width: none;
    border-radius: 8px;
    max-height: 85vh;
  }
}

.download-modal-content {
  max-width: 600px;
}

.share-modal-header,
.reset-modal-header,
.download-modal-header,
.segment-action-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px 10px;
  border-bottom: 1px solid #eee;
}

.reset-modal-header {
  justify-content: center;
  padding-bottom: 15px;
}

.share-modal-header h3,
.segment-action-modal-header h3 {
  margin: 0;
  color: #333;
  font-size: 20px;
}

.share-modal-close,
.download-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.share-modal-close:hover,
.download-modal-close:hover {
  background: #f5f5f5;
  color: #333;
}

.share-modal-body,
.reset-modal-body,
.download-modal-body,
.segment-action-modal-body {
  padding: 20px 25px;
}

.route-summary {
  margin-bottom: 20px;
}

.route-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.stat-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.stat-label {
  font-weight: 600;
  color: #495057;
  font-size: 14px;
}

.stat-value {
  font-weight: 700;
  color: #2c3e50;
  margin-right: auto;
}

.segments-section {
  margin: 20px 0;
}

.segments-section h4 {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.segments-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  background: #f8f9fa;
}

.segment-list-item {
  padding: 10px 15px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.segment-list-item:last-child {
  border-bottom: none;
}

.warnings-section {
  margin: 20px 0;
}

.warnings-section h4 {
  margin: 0 0 15px 0;
  color: #dc3545;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.warnings-list {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 8px;
  padding: 15px;
}

.route-warning-item {
  margin-bottom: 10px;
  color: #856404;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.download-modal-actions {
  display: flex;
  gap: 15px;
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.download-final-btn,
.share-final-btn,
.download-confirm-btn {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(70, 130, 180, 0.3);
}

.download-final-btn,
.download-confirm-btn {
  background: #4682B4;
  color: white;
}

.download-final-btn:hover,
.download-confirm-btn:hover {
  background: #5F9EA0;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(70, 130, 180, 0.4);
}

.share-final-btn {
  background: #4682B4;
  color: white;
}

.share-final-btn:hover:not(:disabled) {
  background: #5F9EA0;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(70, 130, 180, 0.4);
}

.share-final-btn:disabled {
  background: #cccccc;
  cursor: not-allowed;
  box-shadow: none;
}

.reset-modal-body p {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 16px;
  text-align: center;
  line-height: 1.5;
}

.reset-warning {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  padding: 12px;
  border-radius: 6px;
  color: #856404;
  font-weight: 600;
  margin-bottom: 20px !important;
}

.reset-modal-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 25px;
}

.reset-confirm-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(220, 53, 69, 0.3);
}

.reset-confirm-btn:hover {
  background: #c82333;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.reset-cancel-btn {
  background: #6c757d;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(108, 117, 125, 0.3);
}

.reset-cancel-btn:hover {
  background: #5a6268;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

.segment-action-modal-body p {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 16px;
  text-align: center;
  line-height: 1.5;
}

.segment-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 25px;
}

.segment-action-btn {
  padding: 14px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.segment-action-btn.add-again-btn {
  background: #4682B4;
  color: white;
  box-shadow: 0 2px 6px rgba(70, 130, 180, 0.3);
}

.segment-action-btn.add-again-btn:hover {
  background: #5F9EA0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(70, 130, 180, 0.4);
}

.segment-action-btn.remove-btn {
  background: #dc3545;
  color: white;
  box-shadow: 0 2px 6px rgba(220, 53, 69, 0.3);
}

.segment-action-btn.remove-btn:hover {
  background: #c82333;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.segment-action-btn.cancel-btn {
  background: #6c757d;
  color: white;
  box-shadow: 0 2px 6px rgba(108, 117, 125, 0.3);
}

.segment-action-btn.cancel-btn:hover {
  background: #5a6268;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

.share-url-container {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  align-items: stretch;
}

.share-url-input {
  flex: 1;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  background: #f9f9f9;
  direction: ltr;
  text-align: left;
}

.copy-url-btn {
  background: #4682B4;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}

.copy-url-btn:hover {
  background: #5F9EA0;
}

.share-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.share-btn-social {
  flex: 1;
  min-width: 120px;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  color: white;
}

.share-btn-social.twitter {
  background: #1DA1F2;
}

.share-btn-social.twitter:hover {
  background: #0d8bd9;
}

.share-btn-social.facebook {
  background: #4267B2;
}

.share-btn-social.facebook:hover {
  background: #365899;
}

.share-btn-social.whatsapp {
  background: #25D366;
}

.share-btn-social.whatsapp:hover {
  background: #128C7E;
}

.mapboxgl-popup.segment-tooltip .mapboxgl-popup-content {
  background-color: rgba(0, 0, 0, 0.9);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.mapboxgl-popup.segment-tooltip .mapboxgl-popup-tip {
  border-top-color: rgba(0, 0, 0, 0.9);
}

.elevation-profile {
  margin-top: 8px;
  padding: 8px;
  background: linear-gradient(135deg, #E6F3E6 0%, #B8D4B8 100%);
  border-radius: 4px;
  border: 1px solid #8FBC8F;
}

.elevation-profile h4 {
  margin: 0 0 4px 0;
  color: #333;
  font-size: 12px;
  text-align: center;
  display: none;
}

.elevation-chart {
  position: relative;
  height: 60px;
  background: linear-gradient(to top, #6B8E23 0%, #8FBC8F 20%, #E6F3E6 100%);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 3px;
}

.elevation-point {
  position: absolute;
  bottom: 0;
  width: 2px;
  min-height: 5px;
  border-radius: 1px 1px 0 0;
  cursor: pointer;
  transition: opacity 0.2s;
}

.elevation-point:hover {
  opacity: 0.8;
}

.elevation-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #666;
  margin-top: 2px;
}

.search-container {
  position: absolute;
  top: 25px;
  right: 25px;
  z-index: 1000;
  display: flex;
  gap: 8px;
  align-items: center;
}

@media (max-width: 768px) {
  .search-container {
    top: 15px;
    right: 15px;
    gap: 6px;
    flex-direction: row;
    flex-wrap: nowrap;
  }
}

.top-controls {
  position: absolute;
  top: 52px;
  right: 0px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  width: auto;
  z-index: 1000;
}

@media (max-width: 768px) {
  .top-controls {
    top: 40px;
    right: 0px;
    gap: 4px;
  }
}

.search-input-group {
  display: flex;
  gap: 0;
  width: 250px;
  /* flex-shrink: 0; */
}

@media (max-width: 768px) {
  .search-input-group {
    position: absolute;
    right: 0px;
    top: 0px;
    width: 200px;
  }
}

.control-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  width: auto;
}

@media (max-width: 768px) {
  .control-buttons {
    gap: 4px;
  }
}

.control-btn {
  background: #f8f8f8;
  color: #333;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 20px;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  min-width: 50px;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .control-btn {
    padding: 6px 8px;
    font-size: 12px;
    min-height: 36px;
    min-width: 50px;
    touch-action: manipulation;
    white-space: nowrap;
  }
}

.gpx-download-button {
  font-size: 14px;
}

.control-btn:hover:not(:disabled) {
  background: #e0e0e0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.control-btn:disabled {
  background: #dddddd;
  cursor: not-allowed;
  box-shadow: none;
}

#location-search {
  flex: 1;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 4px;
  border-right: none;
  font-size: 14px;
  transition: border-color 0.2s;
  max-width: 250px;
  /* Limit width of the search box */
}

@media (max-width: 768px) {
  #location-search {
    padding: 6px 4px;
    font-size: 12px;
    min-height: 36px;
  }
}

#location-search:focus {
  outline: none;
  border-color: #2196F3;
}

#search-btn {
  background: #4682B4;
  color: white;
  border: 2px solid #4682B4;
  border-left: none;
  padding: 10px 12px;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  font-size: 12px;
  /* Reduced search button size */
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(70, 130, 180, 0.3);
  /* Reduced shadow */
}

@media (max-width: 768px) {
  #search-btn {
    padding: 6px 8px;
    min-width: 36px;
    min-height: 36px;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
  }
}

#search-btn:hover {
  background: #5F9EA0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(70, 130, 180, 0.4);
  /* Reduced shadow */
}

.leaflet-interactive {
  outline: none !important;
}

.leaflet-interactive:focus {
  outline: none !important;
}

h3 {
  color: #333;
  margin-top: 5px;
  margin-bottom: 10px;
  font-size: 1.2em;
  font-weight: 600;
}

/* Location warning modal styles */
.location-warning-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-in;
}

.location-warning-modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideIn 0.3s ease-out;
}

.location-warning-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 10px 20px;
  border-bottom: 1px solid #eee;
}

.location-warning-modal-header h3 {
  margin: 0;
  color: #ff9800;
  font-size: 1.3em;
  font-weight: 600;
}

.location-warning-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.location-warning-modal-close:hover {
  background: #f5f5f5;
  color: #666;
}

.location-warning-modal-body {
  padding: 20px;
}

.location-warning-modal-body p {
  margin: 0 0 15px 0;
  color: #333;
  line-height: 1.5;
  font-size: 16px;
}

/* Search location highlighting animation */
@keyframes searchPulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.7;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.search-location-marker {
  cursor: pointer;
}

.location-warning-modal-body p:last-child {
  margin-bottom: 0;
  font-size: 14px;
  color: #666;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#route-description {
  background: #4682B4;
  color: white;
  padding: 10px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
}

.file-upload-container {
  background: #F8F8F8;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  padding: 20px;
  margin-bottom: 20px;
  text-align: center;
}

#kml-file {
  margin-bottom: 10px;
  padding: 10px;
  border: 2px dashed #ddd;
  border-radius: 8px;
  width: 100%;
  cursor: pointer;
}

#kml-file:hover {
  border-color: #2196F3;
}

.supporting-buttons {
  position: absolute;
  top: 25px;
  right: 250px;
  /* Adjust as needed */
  z-index: 1000;
  display: flex;
  gap: 8px;
}

.supporting-buttons button {
  background: #f8f8f8;
  color: #333;
  border: none;
  padding: 6px 10px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.supporting-buttons button:hover {
  background: #e0e0e0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.elevation-and-description {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  text-align: center;
}

/* Left bottom route description panel */
.route-description-panel {
  position: absolute;
  bottom: 25px;
  left: 25px;
  width: 300px;
  max-height: 200px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 4px;
  padding: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  text-align: right;
  overflow-y: auto;
  direction: rtl;
}

/* Hide panel when no segments are selected */
.route-description-panel.empty {
  display: none;
}

@media (max-width: 768px) {
  .route-description-panel {
    bottom: 15px;
    left: 15px;
    right: 15px;
    width: auto;
    max-height: 150px;
    font-size: 13px;
  }
}

.mobile-only-text {
  display: none;
}

@media (max-width: 768px) {
  .mobile-only-text {
    display: inline;
  }
}

/* Move the route list inside the download modal */
/* No CSS changes needed, just structural changes in the React component */
@media (max-width: 480px) {
  .tutorial-modal {
    max-width: 280px;
    min-width: 240px;
  }
}

.about-code {
  font-size: 12px;
  line-height: 1.4;
  color: #666;
}

@media (max-width: 768px) {
  .about-code {
    font-size: 11px;
  }
}

/* Export modal styles */
.export-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  direction: ltr;
}

.export-modal-content {
  background: white;
  padding: 0;
  border-radius: 8px;
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

.export-modal-header {
  background: #f5f5f5;
  padding: 15px 20px;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.export-modal-header h3 {
  margin: 0;
  color: #333;
  font-size: 18px;
}

.export-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.export-modal-close:hover {
  background: #e0e0e0;
  color: #333;
}

.export-modal-body {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}

.json-container {
  margin: 15px 0;
}

.json-textarea {
  width: 100%;
  height: 300px;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  resize: vertical;
  background: #f9f9f9;
  color: #333;
}

.export-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.copy-json-btn, .clear-operations-btn {
  padding: 10px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: background-color 0.2s;
}

.copy-json-btn {
  background: #4682B4;
  color: white;
}

.copy-json-btn:hover {
  background: #357abd;
}

.clear-operations-btn {
  background: #f44336;
  color: white;
}

.clear-operations-btn:hover {
  background: #d32f2f;
}

/* Reset modal styles */
.reset-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  direction: rtl;
}

/* Route point markers */
.route-point-marker {
  transition: all 0.2s ease;
}

.route-point-marker:hover {
  transform: scale(1.1);
  z-index: 1000;
}

.route-point-marker:active {
  transform: scale(0.95);
}

.point-number {
  font-family: Arial, sans-serif;
  font-weight: bold;
  font-size: 12px;
  color: white;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
}

/* Improved cursor states for dragging */
.route-point-marker.dragging {
  cursor: grabbing !important;
  transform: scale(1.1);
  z-index: 1001;
}
footer {
  background: #2c3e50;
  color: white;
  padding: 20px 0;
  margin-top: 40px;
  text-align: center;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-content p {
  margin: 5px 0;
  font-size: 14px;
}

.footer-content p:first-child {
  font-weight: bold;
}