/* ========================================
   Горизонт — Страница карты
   Современный зелёный дизайн
   ======================================== */

:root {
  --green-dark: #1b5e20;
  --green-main: #2e7d32;
  --green-light: #4caf50;
  --green-soft: #66bb6a;
  --green-pale: #e8f5e9;
  --sidebar-bg: #1b5e20;
  --sidebar-hover: #2e7d32;
  --panel-bg: #ffffff;
  --text: #1a1a1a;
  --text-light: #ffffff;
  --shadow: 0 2px 12px rgba(0,0,0,0.12);
  --radius: 10px;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  height: 100vh;
  overflow: hidden;
  background: #f5f5f5;
}

/* ===== Header ===== */
.header {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  z-index: 50;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--green-main);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.2s;
}

.back-btn:hover {
  background: var(--green-pale);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--green-main);
  text-decoration: none;
}

.logo:hover {
  opacity: 0.85;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--green-main), var(--green-light));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

/* ===== Layout ===== */
.app {
  display: flex;
  height: calc(100vh - 60px);
}

/* ===== Sidebar ===== */
.sidebar {
  width: 100px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 6px;
  gap: 6px;
  z-index: 40;
}

.sidebar-btn {
  width: 88px;
  height: 62px;
  background: transparent;
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  color: var(--text-light);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s;
}

.sidebar-btn:hover,
.sidebar-btn.active {
  background: var(--sidebar-hover);
  border-color: var(--green-soft);
}

.sidebar-btn .icon {
  font-size: 1.6rem;
}

.sidebar-btn .btn-text {
  font-size: 0.65rem;
  line-height: 1.2;
  text-align: center;
}

/* ===== Side Panel (выпадающая панель) ===== */
.side-panel {
  width: 0;
  background: var(--panel-bg);
  border-right: 1px solid #e0e0e0;
  overflow: hidden;
  transition: width 0.3s ease;
  box-shadow: 2px 0 8px rgba(0,0,0,0.06);
  z-index: 30;
}

.side-panel.open {
  width: 480px;
}

.panel-inner {
  width: 480px;
  height: 100%;
  padding: 20px;
  overflow-y: auto;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.panel-header h3 {
  color: var(--green-main);
  font-size: 1.1rem;
}

.panel-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #888;
}

.panel-content {
  color: #444;
  font-size: 0.95rem;
  line-height: 1.5;
}

.panel-content p {
  margin-bottom: 12px;
}

/* ===== Map Area ===== */
.map-area {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

/* ===== Map Controls (слои) ===== */
.map-controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 12px 16px;
  z-index: 20;
  min-width: 180px;
}

.map-controls h4 {
  font-size: 0.85rem;
  color: var(--green-main);
  margin-bottom: 10px;
  font-weight: 600;
}

.layer-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.88rem;
  cursor: pointer;
}

.layer-option input {
  accent-color: var(--green-main);
}

/* ===== Поиск (лупа) ===== */
.search-toggle {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  z-index: 26;
  transition: background 0.2s;
}

.search-toggle:hover {
  background: var(--green-pale);
}

.search-box {
  position: absolute;
  top: 16px;
  right: 74px;
  z-index: 25;
  width: 0;
  overflow: hidden;
  transition: width 0.25s ease;
}

.search-box.open {
  width: 280px;
}

#search-input {
  width: 280px;
  padding: 10px 16px;
  border: none;
  border-radius: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  font-size: 0.95rem;
  outline: none;
}

#search-input:focus {
  box-shadow: 0 2px 16px rgba(46, 125, 50, 0.25);
}

.search-results {
  margin-top: 6px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  max-height: 280px;
  overflow-y: auto;
  display: none;
}

.search-results.show {
  display: block;
}

.search-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 1px solid #f0f0f0;
}

.search-item:hover {
  background: var(--green-pale);
}

.search-item:last-child {
  border-bottom: none;
}
.zoom-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  z-index: 10;
  pointer-events: none;
}

/* ===== Участки ===== */
.plots-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.plots-toolbar button,
.plots-toolbar label.btn-upload {
  background: var(--green-main);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  display: inline-block;
}

.plots-toolbar button:hover,
.plots-toolbar label.btn-upload:hover {
  background: var(--green-dark);
}

.plots-toolbar button.secondary {
  background: #666;
}

.plots-toolbar input[type="file"] {
  display: none;
}

.plot-item {
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.plot-item input,
.plot-item textarea {
  width: 100%;
  padding: 6px 8px;
  margin: 4px 0;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
}

.plot-item textarea {
  resize: vertical;
  min-height: 50px;
}

.plot-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.plot-actions button {
  padding: 4px 10px;
  font-size: 0.8rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.plot-actions .zoom-btn { background: #4caf50; color: white; }
.plot-actions .delete-btn { background: #e53935; color: white; }

.draw-hint {
  background: #fff3e0;
  border: 1px solid #ffcc80;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 12px;
  font-size: 0.88rem;
  display: none;
}

.draw-hint.show {
  display: block;
}

.plot-item.editing {
  border-color: var(--green-main);
  background: #f1f8e9;
}

.plot-actions .edit-btn { background: #ff9800; color: white; }
.plot-actions .save-btn { background: #2e7d32; color: white; }

.plot-item input[readonly],
.plot-item textarea[readonly] {
  background: #f5f5f5;
  border-color: transparent;
  cursor: default;
}

/* ===== Кнопки панелей ===== */
.panel-btn {
  background: var(--green-main);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s, transform 0.1s;
}

.panel-btn:hover {
  background: var(--green-dark);
}

.panel-btn:active {
  transform: scale(0.98);
}

/* ===== Карточка участка (режим просмотра) ===== */
.plot-view {
  margin-bottom: 8px;
}

.plot-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--green-dark);
  margin-bottom: 2px;
}

.plot-area {
  font-size: 0.85rem;
  color: var(--green-main);
  font-weight: 500;
}

.plot-desc {
  font-size: 0.88rem;
  color: #555;
  margin-top: 4px;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.plot-meta {
  font-size: 0.85rem;
  color: #666;
  margin: 4px 0;
}

.plot-actions .export-btn {
  background: #1976d2;
  color: white;
}

.plot-style-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 6px 0;
  font-size: 0.85rem;
}

.plot-style-row input[type="color"] {
  width: 36px;
  height: 28px;
  border: none;
  padding: 0;
  cursor: pointer;
}

.plot-style-row input[type="range"] {
  width: 80px;
}

.plot-visible {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: #555;
}

.fields-toggle-btn {
  width: 100%;
  padding: 8px;
  background: var(--green-main);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
}

.fields-toggle-btn:hover {
  background: var(--green-dark);
}

.plot-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.plot-header .plot-name {
  flex: 1;
  margin-bottom: 0;
}

.plot-header .plot-area {
  font-size: 0.85rem;
  color: var(--green-main);
  font-weight: 500;
  white-space: nowrap;
}

.plot-header .plot-visible {
  margin-bottom: 0;
}

.opacity-value {
  font-size: 0.85rem;
  color: #666;
  min-width: 36px;
}

.cadastr-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.cadastr-row input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
}

.cadastr-row button {
  background: var(--green-main);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

/* ===== Легенда крутизны ===== */
.slope-legend {
  background: #f5f5f5;
  padding: 12px;
  border-radius: 8px;
  margin-top: 12px;
}

.slope-legend h4 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: #333;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  margin: 4px 0;
}

.legend-color {
  width: 20px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid #ccc;
}

.plots-total {
  background: var(--green-pale);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.95rem;
  color: var(--green-dark);
}
