@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

* {
  font-family: 'Poppins', sans-serif;
  box-sizing: border-box; /* LISÄTTY: Varmistaa yhteensopivuus */
}

body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  margin: 0; /* LISÄTTY: Poistaa default marginit */
  padding: 0;
  /* iOS Safari scroll fix */
  -webkit-overflow-scrolling: touch;
}
 .flag-button-en {
  position: fixed;
  top: 20px;
  right: 80px; /* Muutettu: siirretään vasemmalle */
  z-index: 1000;
  background: white;
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
  font-size: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  animation: wave 2s ease-in-out infinite;
}

.flag-button-en:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.flag-button {
  position: fixed;
  top: 20px;
  right: 20px; /* Pidetään oikeassa reunassa */
  z-index: 1000;
  background: white;
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
  font-size: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  animation: wave 2s ease-in-out infinite;
}

.flag-button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
    
	@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(5deg); }
  75% { transform: rotate(-5deg); }
}

.hero-section {
  background: linear-gradient(135deg, 
    rgba(102, 126, 234, 0.9) 0%, 
    rgba(118, 75, 162, 0.9) 50%,
    rgba(255, 94, 77, 0.8) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px); /* LISÄTTY: Safari tuki */
  position: relative;
  overflow: hidden;
}

.hero-section::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 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
  pointer-events: none;
}

.search-container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px); /* LISÄTTY: Safari tuki */
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.input-container {
  position: relative;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  z-index: 10;
  /* LISÄTTY: Touch optimization */
  -webkit-tap-highlight-color: transparent;
}

.input-container:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.input-container.focused {
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
  z-index: 110;
}

.input-container.focused .suggestions {
  z-index: 120;
}

.location-input {
  width: 100%;
  padding: 20px 60px 20px 20px;
  border: none;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 500;
  background: transparent;
  outline: none;
  color: #1f2937;
  /* LISÄTTY: Mobile optimizations */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  /* Prevent iOS zoom on input focus */
  font-size: max(16px, 1rem);
}

.location-input::placeholder {
  color: #9ca3af;
}

.input-icon {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  color: #667eea;
  pointer-events: none; /* LISÄTTY: Estää klikkausta */
}

.search-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 18px 40px;
  border-radius: 16px;
  color: white;
  font-weight: 600;
  font-size: 18px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
  /* LISÄTTY: Touch optimization */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.search-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(102, 126, 234, 0.5);
}

.search-btn:active {
  transform: translateY(-1px);
}

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border-radius: 0 0 16px 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  margin-top: -1px;
  /* LISÄTTY: iOS scroll optimization */
  -webkit-overflow-scrolling: touch;
}

.suggestion-item {
  padding: 16px 20px;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* LISÄTTY: Touch optimization */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.suggestion-item:hover {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
}

.suggestion-item.best-match {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(16, 185, 129, 0.1));
  border-left: 4px solid #22c55e;
}

.api-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0; /* LISÄTTY: Estää kutistumisen */
}

.api-waltti { 
  background: linear-gradient(135deg, #3b82f6, #1d4ed8); 
  color: white; 
}

.api-hsl { 
  background: linear-gradient(135deg, #10b981, #059669); 
  color: white; 
}

.api-vayla { 
  background: linear-gradient(135deg, #f59e0b, #d97706); 
  color: white; 
}

/* BLUR BACKGROUND - KORJATTU */
.blur-background {
  filter: blur(8px) !important;
  pointer-events: none !important;
  transition: filter 0.3s ease !important;
  /* LISÄTTY: Safari compatibility */
  -webkit-filter: blur(8px) !important;
}

/* MODAL STYLES - KORJATTU KOKO JA SCROLLAUS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  display: flex;
  align-items: flex-start; /* MUUTETTU: center -> flex-start */
  justify-content: center;
  padding: 20px;
  padding-top: 5vh; /* LISÄTTY: Ylemmäs sijoitus */
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  overflow-y: auto; /* LISÄTTY: Mahdollistaa scrollauksen */
  -webkit-overflow-scrolling: touch; /* iOS optimization */
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: white;
  border-radius: 24px;
  width: 100%;
  max-width: 900px;
  /* KORJATTU: Poistettu max-height rajoitus */
  min-height: auto; /* LISÄTTY */
  max-height: none; /* MUUTETTU: 90vh -> none */
  overflow: visible; /* MUUTETTU: hidden -> visible */
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
  position: relative;
  z-index: 10000;
  filter: none !important;
  margin-bottom: 20px; /* LISÄTTY: Varmistaa tilaa alareunaan */
}

.modal-overlay.active .modal-container {
  transform: scale(1) translateY(0);
}

.modal-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 30px;
  text-align: center;
  position: relative;
  border-radius: 24px 24px 0 0; /* LISÄTTY: Varmistaa border-radius */
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  /* LISÄTTY: Touch optimization */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* KORJATTU: Modal content - poistettu korkeus rajoitukset */
.modal-content {
  padding: 0;
  /* POISTETTU: max-height rajoitukset */
  overflow: visible !important; /* MUUTETTU: overflow-y auto -> visible */
  overflow-x: hidden;
}

/* KORJATTU: Route list - poistettu korkeus rajoitukset */
.route-list {
  overflow: visible !important;
  max-height: none !important;
  padding-bottom: 30px;
}

.loading-section {
  padding: 60px 40px;
  text-align: center;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid #e5e7eb;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 30px;
}

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

.progress-steps {
  margin-top: 30px;
}

.progress-step {
  padding: 15px 0;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  gap: 15px;
  opacity: 0.4;
  transition: all 0.3s ease;
}

.progress-step.active {
  opacity: 1;
  background: #f8fafc;
}

.progress-step.completed {
  opacity: 0.7;
  color: #10b981;
}

.progress-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  flex-shrink: 0; /* LISÄTTY: Estää kutistumisen */
}

.progress-step.active .progress-icon {
  background: #667eea;
  color: white;
  animation: pulse 2s infinite;
}

.progress-step.completed .progress-icon {
  background: #10b981;
  color: white;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ROUTE CARD STYLES - KORJATTU */
.route-card {
  background: white;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  overflow: visible !important;
  margin-bottom: 30px !important;
}

.route-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.route-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 30px;
  position: relative;
  overflow: hidden;
  border-radius: 20px 20px 0 0; /* LISÄTTY: Varmistaa border-radius */
}

.route-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: rotate(45deg);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
  100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

/* STEP CONTAINER - KORJATTU */
.step-container {
  padding: 24px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  gap: 20px;
  transition: all 0.3s ease;
  overflow: visible !important;
  word-wrap: break-word;
  word-break: break-word; /* LISÄTTY: Parempi tekstin rivitys */
}

.step-container:hover {
  background: #f8fafc;
}

.step-container:last-child {
  margin-bottom: 20px !important;
  padding-bottom: 30px !important;
  border-bottom: none;
}

.step-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  flex-shrink: 0;
}

.step-walk .step-icon {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.step-bus .step-icon {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
}

.step-content {
  flex: 1;
  overflow: visible !important;
  word-wrap: break-word;
  word-break: break-word; /* LISÄTTY: Parempi tekstin rivitys */
  min-width: 0;
}

.step-title {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 8px;
}

.step-details {
  color: #6b7280;
  line-height: 1.6;
}

.bus-badge {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  display: inline-block;
  margin: 8px 0;
}

.time-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.time-item {
  background: #f8fafc;
  padding: 12px;
  border-radius: 12px;
  text-align: center;
}

.time-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.time-value {
  font-weight: 600;
  color: #1f2937;
}

.auto-selected-indicator {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  margin-top: 8px;
  display: inline-block;
}

.alternative-route {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  /* LISÄTTY: Touch optimization */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.alternative-route:hover {
  border-color: #667eea;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.alternative-route.recommended {
  border-color: #10b981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(5, 150, 105, 0.05));
}

.recommended-badge {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.new-search-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  padding: 15px 30px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 30px;
  width: calc(100% - 60px);
  /* LISÄTTY: Touch optimization */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.new-search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.error-section {
  padding: 40px;
  text-align: center;
}

.error-icon {
  font-size: 60px;
  margin-bottom: 20px;
}

.alternative-date-btn {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  /* LISÄTTY: Touch optimization */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.alternative-date-btn:hover {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.alternative-date-btn:active {
  transform: translateY(0);
}

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

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

.slide-in {
  animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* SHARE BUTTONS STYLES */
.share-buttons {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.9);
  color: #1f2937;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px); /* LISÄTTY: Safari tuki */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  /* LISÄTTY: Touch optimization */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 1);
}

.whatsapp-btn .share-icon {
  color: #25D366;
}

.maps-btn:hover {
  background: linear-gradient(135deg, #4285F4, #34A853);
  color: white;
}

.share-icon {
  font-size: 16px;
}

/* RESPONSIVE KORJAUKSET - PARANNETTU */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 10px;
    padding-top: 2vh; /* VÄHENNETTY: Enemmän tilaa pienille näytöille */
    align-items: flex-start;
  }
  
  .modal-container {
    max-width: 100%;
    min-height: auto;
    max-height: none; /* KORJATTU: Poistettu korkeus rajoitus */
    margin-bottom: 10px;
    border-radius: 20px; /* VÄHENNETTY: Pienempi border-radius */
  }
  
  .modal-header {
    padding: 20px;
    border-radius: 20px 20px 0 0;
  }
  
  .modal-content {
    max-height: none; /* KORJATTU: Poistettu korkeus rajoitus */
    overflow: visible !important;
  }
  
  .step-container {
    flex-direction: column;
    gap: 15px;
    padding: 20px;
  }
  
  .step-icon {
    align-self: flex-start;
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  
  .route-header {
    padding: 20px;
  }
  
  .time-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
  }
  
  .share-buttons {
    margin-top: 1rem;
  }
  
  .share-btn {
    padding: 10px 16px;
    font-size: 13px;
  }
  
  .new-search-btn {
    margin: 20px;
    width: calc(100% - 40px);
    padding: 12px 24px;
  }
}

/* LISÄTTY: Extra small devices (iPhone SE, etc.) */
@media (max-width: 480px) {
  .modal-overlay {
    padding: 5px;
    padding-top: 1vh;
  }
  
  .modal-container {
    border-radius: 16px;
  }
  
  .modal-header {
    padding: 16px;
    border-radius: 16px 16px 0 0;
  }
  
  .modal-header h2 {
    font-size: 1.5rem; /* LISÄTTY: Pienempi otsikko */
  }
  
  .step-container {
    padding: 16px;
  }
  
  .route-header {
    padding: 16px;
  }
  
  .time-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  
  .time-item {
    padding: 8px;
  }
  
  .share-btn {
    padding: 8px 12px;
    font-size: 12px;
    gap: 6px;
  }
}

/* LISÄTTY: Landscape orientation fix for mobile */
@media (max-height: 600px) and (orientation: landscape) {
  .modal-overlay {
    padding: 5px;
    padding-top: 1vh;
  }
  
  .modal-container {
    max-height: none;
  }
  
  .modal-header {
    padding: 16px;
  }
  
  .loading-section {
    padding: 30px 20px;
  }
}

/* Feedback Modal Styles - KORJATTU */
.feedback-trigger-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
  /* LISÄTTY: Touch optimization */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.feedback-trigger-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
  background: linear-gradient(135deg, #d97706, #b45309);
}

.feedback-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px); /* LISÄTTY: Safari tuki */
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  padding: 20px;
  overflow-y: auto; /* LISÄTTY: Scrollaus tuki */
  -webkit-overflow-scrolling: touch;
}

.feedback-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.feedback-modal-container {
  background: white;
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* LISÄTTY: iOS optimization */
  transform: scale(0.9) translateY(20px);
  transition: all 0.3s ease;
}

.feedback-modal-overlay.active .feedback-modal-container {
  transform: scale(1) translateY(0);
}

.feedback-modal-header {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  padding: 24px;
  border-radius: 20px 20px 0 0;
  position: relative;
}

.feedback-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.2s ease;
  /* LISÄTTY: Touch optimization */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.feedback-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.feedback-form {
  padding: 24px;
}

.feedback-select,
.feedback-input,
.feedback-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 14px;
  transition: border-color 0.2s ease;
  font-family: inherit;
  /* LISÄTTY: Mobile optimizations */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  /* Prevent iOS zoom on input focus */
  font-size: max(16px, 1rem);
}

.feedback-select:focus,
.feedback-input:focus,
.feedback-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.feedback-textarea {
  resize: vertical;
  min-height: 100px;
}

.feedback-submit-btn {
  background: linear-gradient(135deg, #10b981, #047857);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  /* LISÄTTY: Touch optimization */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.feedback-submit-btn:hover {
  background: linear-gradient(135deg, #047857, #065f46);
  transform: translateY(-1px);
}

.feedback-submit-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
}

.feedback-cancel-btn {
  background: #6b7280;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  /* LISÄTTY: Touch optimization */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.feedback-cancel-btn:hover {
  background: #4b5563;
  transform: translateY(-1px);
}

.feedback-success {
  padding: 40px 24px;
  text-align: center;
}

.feedback-success.hidden {
  display: none;
}

/* LISÄTTY: iOS Safari viewport height fix */
@supports (-webkit-touch-callout: none) {
  .modal-overlay {
    height: -webkit-fill-available;
  }
}

/* LISÄTTY: Prevent text selection on buttons */
.search-btn,
.share-btn,
.alternative-route,
.alternative-date-btn,
.new-search-btn,
.feedback-trigger-btn,
.feedback-submit-btn,
.feedback-cancel-btn,
.modal-close-btn,
.feedback-modal-close {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* LISÄTTY: Better scrollbar styling for webkit browsers */
.modal-content::-webkit-scrollbar,
.suggestions::-webkit-scrollbar,
.feedback-modal-container::-webkit-scrollbar {
  width: 6px;
}

.modal-content::-webkit-scrollbar-track,
.suggestions::-webkit-scrollbar-track,
.feedback-modal-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb,
.suggestions::-webkit-scrollbar-thumb,
.feedback-modal-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb:hover,
.suggestions::-webkit-scrollbar-thumb:hover,
.feedback-modal-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* LISÄTTY: Firefox scrollbar styling */
.modal-content,
.suggestions,
.feedback-modal-container {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f1f5f9;
}

@media (max-width: 640px) {
  .feedback-modal-container {
    margin: 20px;
    max-height: calc(100vh - 40px);
    border-radius: 16px;
  }
  
  .feedback-modal-header {
    padding: 20px;
    border-radius: 16px 16px 0 0;
  }
  
  .feedback-form,
  .feedback-success {
    padding: 20px;
  }
  
  .feedback-select,
  .feedback-input,
  .feedback-textarea {
    padding: 10px 14px;
    font-size: 16px; /* LISÄTTY: Estää iOS zoom */
  }
  
  .feedback-submit-btn,
  .feedback-cancel-btn {
    padding: 10px 20px;
    font-size: 14px;
  }
}
.gps-help-text {
  text-align: center;
  color: #6b7280;
  font-size: 14px;
  margin-top: 8px;
  margin-bottom: 0;
  font-weight: 500;
  opacity: 0.8;
}
.gps-button {
  width: 100%;
  margin-bottom: 0px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
  position: relative;
  overflow: hidden;
}

.gps-button:hover:not(.loading):not(.success):not(.error) {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.gps-button.loading {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  cursor: not-allowed;
  animation: pulse-bg 2s ease-in-out infinite;
}

.gps-button.success {
  background: linear-gradient(135deg, #10b981, #059669);
  cursor: pointer;
}

.gps-button.error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  cursor: pointer;
}

.gps-icon {
  font-size: 18px;
  transition: all 0.3s ease;
}

.gps-button.loading .gps-icon {
  animation: spin 2s linear infinite;
}

.gps-text {
  font-weight: 600;
  letter-spacing: 0.025em;
}

.progress-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: 8px;
}

.progress-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  animation: progress-dots 1.5s ease-in-out infinite;
}

.progress-dot:nth-child(1) { animation-delay: 0s; }
.progress-dot:nth-child(2) { animation-delay: 0.3s; }
.progress-dot:nth-child(3) { animation-delay: 0.6s; }

.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: white;
  padding: 20px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
  z-index: 10000;
  transform: translateY(100%);
  transition: transform 0.4s ease-in-out;
  backdrop-filter: blur(10px);
}

.cookie-banner.show {
  transform: translateY(0);
}

.cookie-banner-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.cookie-text {
  flex: 1;
  min-width: 300px;
}

.cookie-text h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #fbbf24;
}

.cookie-text p {
  font-size: 14px;
  line-height: 1.5;
  opacity: 0.95;
}

.cookie-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.cookie-btn {
    width: 100%;
    max-width: 250px;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.cookie-btn-accept {
  background: #10b981;
  color: white;
}

.cookie-btn-accept:hover {
  background: #059669;
  transform: translateY(-2px);
}

.cookie-btn-reject {
  background: transparent;
  color: white;
  border: 2px solid rgba(255,255,255,0.3);
}

.cookie-btn-reject:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.5);
}

.cookie-btn-settings {
  background: transparent;
  color: #fbbf24;
  border: 2px solid #fbbf24;
  text-decoration: none;
  display: inline-block;
}

.cookie-btn-settings:hover {
  background: #fbbf24;
  color: #1e3a8a;
}

@media (max-width: 768px) {
  .cookie-banner-content {
    flex-direction: column;
    text-align: center;
  }
  
  .cookie-buttons {
    justify-content: center;
    width: 100%;
  }
  
  .cookie-btn {
    flex: 1;
    min-width: 120px;
  }
}

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

@keyframes pulse-bg {
  0%, 100% { 
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
  }
  50% { 
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 6px 25px rgba(59, 130, 246, 0.5);
  }
}

@keyframes progress-dots {
  0%, 80%, 100% { 
    opacity: 0.3;
    transform: scale(0.8);
  }
  40% { 
    opacity: 1;
    transform: scale(1.2);
  }
}
.arrow-container {
  display: flex;
  justify-content: center;
  margin: 10px 0;
}

.swap-arrows {
  font-size: 24px;
  color: #666;
  cursor: pointer;
  transition: color 0.3s ease;
  user-select: none;
}

.swap-arrows:hover {
  color: #007bff;
}

/* LISÄTTY: High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .loading-spinner {
    border-width: 3px;
  }
  
  .api-badge {
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
}

/* LISÄTTY: Dark mode support (jos käyttäjällä on dark mode) */
@media (prefers-color-scheme: dark) {
  /* Tämä voidaan ottaa käyttöön myöhemmin jos halutaan dark mode tuki */
}

/* LISÄTTY: Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .loading-spinner {
    animation: none;
    border-top: 4px solid #667eea;
  }
  
  .route-header::before {
    animation: none;
  }
}

/* LISÄTTY: Print styles */
@media print {
  .modal-overlay,
  .search-container,
  .hero-section {
    display: none;
  }
  
  .route-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #e5e7eb;
  }
  
  .route-header {
    background: #f8fafc !important;
    color: #1f2937 !important;
  }
}