* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  min-height: 100vh;
  min-height: 100dvh;
}

#app {
  max-width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Ecran principal */
#main-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  position: relative;
}

/* Recherche */
.search-container {
  position: relative;
  padding: 12px;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  z-index: 1000;
}

#search-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

#search-input:focus {
  border-color: #3b82f6;
}

.suggestions {
  position: absolute;
  top: 100%;
  left: 12px;
  right: 12px;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-height: 250px;
  overflow-y: auto;
  z-index: 1001;
}

.suggestions.hidden {
  display: none;
}

.suggestion-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.suggestion-item:hover {
  background: #f5f5f5;
}

.suggestion-item::before {
  content: '📍';
}

/* Carte */
#map {
  flex: 1;
  min-height: 300px;
}

/* Resultat */
.result {
  padding: 20px;
  text-align: center;
  background: white;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

.result.hidden {
  display: none;
}

#result-text {
  font-size: 24px;
  font-weight: 700;
  display: inline-block;
  padding: 12px 24px;
  border-radius: 12px;
  color: white;
}

.result-hors-zone #result-text {
  background: #6b7280;
}

/* Bouton config */
.config-btn {
  position: absolute;
  bottom: 100px;
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  z-index: 999;
  transition: transform 0.2s, box-shadow 0.2s;
}

.config-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* Ecrans overlay */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

.screen.hidden {
  display: none;
}

/* PIN */
.pin-container {
  background: white;
  padding: 32px;
  border-radius: 16px;
  text-align: center;
  width: 100%;
  max-width: 320px;
}

.pin-container h2 {
  margin-bottom: 8px;
  color: #333;
}

.pin-container p {
  color: #666;
  margin-bottom: 20px;
}

#pin-input {
  width: 100%;
  padding: 14px;
  font-size: 20px;
  text-align: center;
  letter-spacing: 4px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 20px;
}

#pin-input:focus {
  outline: none;
  border-color: #3b82f6;
}

.pin-buttons {
  display: flex;
  gap: 12px;
}

.error {
  color: #ef4444;
  margin-top: 12px;
  font-size: 14px;
}

.error.hidden {
  display: none;
}

/* Boutons */
.btn-primary, .btn-secondary {
  flex: 1;
  padding: 12px 20px;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  font-weight: 600;
  transition: opacity 0.2s;
}

.btn-primary {
  background: #3b82f6;
  color: white;
}

.btn-secondary {
  background: #e5e7eb;
  color: #374151;
}

.btn-primary:hover, .btn-secondary:hover {
  opacity: 0.9;
}

/* Config */
.config-container {
  background: white;
  padding: 24px;
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
}

.config-container h2 {
  margin-bottom: 20px;
  color: #333;
}

.config-section {
  margin-bottom: 24px;
}

.config-section h3 {
  font-size: 14px;
  color: #666;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.config-section input[type="text"] {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 8px;
}

.config-section input[type="text"]:focus {
  outline: none;
  border-color: #3b82f6;
}

.origin-search {
  position: relative;
}

.origin-search .suggestions {
  left: 0;
  right: 0;
}

.coords {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
}

/* Zones config */
.zone-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 8px;
}

.zone-item label {
  font-weight: 600;
  min-width: 60px;
}

.zone-item input[type="number"] {
  width: 80px;
  padding: 8px;
  font-size: 16px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  text-align: center;
}

.zone-item input[type="number"]:focus {
  outline: none;
  border-color: #3b82f6;
}

.zone-item input[type="color"] {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
}

.zone-item span {
  color: #666;
  font-size: 14px;
}

.config-buttons {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* Responsive ajustements */
@media (max-width: 380px) {
  .zone-item {
    flex-wrap: wrap;
  }

  .zone-item input[type="number"] {
    width: 70px;
  }
}
