/* style.css */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
  min-height: 100vh;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 30px;
  text-align: center;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

header p {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* ДВУХКОЛОНОЧНЫЙ МАКЕТ */
.main-layout {
  display: flex;
  flex-direction: row;
  height: calc(100vh - 200px); /* Высота окна - верхние элементы */
  min-height: 500px;
}

/* ОБЛАСТЬ КАРТЫ */
.map-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: #f8f9fa;
  overflow: hidden;
}

/* КОНТЕЙНЕР КАРТЫ */
.canvas-container {
  position: relative;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
}

canvas {
  display: block;
  background: #f8f9fa;
}

.canvas-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-text {
  margin-top: 15px;
  font-size: 1.2rem;
  color: #667eea;
  font-weight: 600;
}

/* ПАНЕЛЬ УПРАВЛЕНИЯ */
.control-panel {
  width: 350px; /* Фиксированная ширина панели */
  background: white;
  border-left: 2px solid #e0e0e0;
  padding: 20px;
  overflow-y: auto; /* Прокрутка при большом количестве элементов */
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-group label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  color: #555;
}

.label-text {
  min-width: 100px;
  font-size: 0.95rem;
}

.control-group input[type="number"],
.control-group input[type="range"] {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.control-group input[type="number"]:focus,
.control-group input[type="range"]:focus {
  outline: none;
  border-color: #667eea;
}

.control-group input[type="range"] {
  height: 8px;
  border-radius: 4px;
  background: #e0e0e0;
  outline: none;
  transition: background 0.3s;
}

.control-group input[type="range"]::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  border: none;
  transition: transform 0.2s;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.value-display {
  min-width: 40px;
  text-align: right;
  font-weight: bold;
  color: #667eea;
}

.primary-btn {
  padding: 14px 28px;
  font-size: 1.1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  width: 100%;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

.secondary-btn {
  padding: 10px 16px;
  background: #e0e0e0;
  color: #555;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.secondary-btn:hover {
  background: #d0d0d0;
  transform: scale(1.05);
}

.status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 1.1rem;
}

.status-icon {
  font-size: 1.5rem;
}

.debug {
  margin-top: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.9rem;
  max-height: 200px;
  overflow-y: auto;
  color: #555;
}

footer {
  background: #f8f9fa;
  padding: 20px;
  text-align: center;
  color: #666;
  font-size: 0.9rem;
}

footer a {
  color: #667eea;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* АДАПТИВНОСТЬ */
@media (max-width: 1024px) {
  .main-layout {
    flex-direction: column;
    height: auto;
  }

  .control-panel {
    width: 100%;
    border-left: none;
    border-top: 2px solid #e0e0e0;
  }
}

.layer-selector {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 2px solid #e0e0e0;
}

.layer-selector h3 {
  font-size: 1.1rem;
  margin-bottom: 15px;
}

.layer-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  cursor: pointer;
}

.layer-option input[type="radio"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.layer-option label {
  cursor: pointer;
  font-weight: 500;
  color: #555;
}

.layer-option:hover label {
  color: #667eea;
}

.info-panel {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: white;
  border: 2px solid #667eea;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  z-index: 100;
  display: none;
  transform: translateY(20px);
  transition:
    opacity 0.3s,
    transform 0.3s;
}

.info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.info-header h3 {
  color: #667eea;
  margin: 0;
  font-size: 1.2rem;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #667eea;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: #f0f0f0;
  border-radius: 50%;
}

.info-content {
  font-size: 0.95rem;
  line-height: 1.6;
}

.info-content p {
  margin: 5px 0;
}

.info-content strong {
  color: #555;
}
