/* IrriPlanner 7.1 Modern Design System & Clean Layout */

:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --accent: #10b981;
  --bg-main: #f8fafc;
  --bg-panel: #ffffff;
  --bg-panel-hover: #f1f5f9;
  --border-color: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  user-select: none;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-main);
  color: var(--text-main);
}

#app {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
}

/* Header */
header {
  height: 56px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary), #0369a1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.logo-text {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.logo-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  margin-left: 6px;
}

.project-title-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-main);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.project-title-input {
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  outline: none;
  width: 220px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Main Layout Grid */
#main-content {
  display: flex;
  flex: 1;
  height: calc(100vh - 56px - 28px);
  position: relative;
  overflow: hidden;
}

/* Left Toolbar */
#toolbar {
  width: 240px;
  min-width: 240px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 12px;
  overflow-y: auto;
  z-index: 5;
}

.tool-section-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-panel);
  color: var(--text-main);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.tool-btn:hover {
  background: var(--bg-panel-hover);
  border-color: var(--primary);
}

.tool-btn.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

.tool-btn svg {
  width: 18px;
  height: 18px;
}

.tool-btn-full {
  grid-column: span 2;
  flex-direction: row;
  justify-content: flex-start;
  padding: 8px 10px;
  gap: 8px;
}

/* Center Canvas */
#canvas-container {
  flex: 1;
  position: relative;
  background: #ffffff;
  overflow: hidden;
}

#main-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.canvas-mode-badge {
  position: absolute;
  top: 14px;
  left: 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 4;
}

.mode-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.heatmap-toggle-container {
  position: absolute;
  top: 14px;
  right: 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 4;
}

.canvas-controls {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  padding: 4px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 4;
}

.zoom-text {
  font-size: 12px;
  font-weight: 700;
  min-width: 44px;
  text-align: center;
}

/* Right Sidebar Panel */
#sidebar {
  width: 300px;
  min-width: 300px;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  overflow-y: auto;
  z-index: 5;
}

.panel-card {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.form-select, .form-input {
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #ffffff;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
}

.form-select:focus, .form-input:focus {
  border-color: var(--primary);
}

.range-slider-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.range-slider {
  flex: 1;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Metric Display Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.metric-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px;
  text-align: center;
}

.metric-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
}

.metric-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Zone List & Accordion */
.zone-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.zone-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: all 0.15s ease;
}

.zone-card.solo-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.zone-header {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: #fafafa;
  border-left: 4px solid var(--primary);
  user-select: none;
  transition: background 0.15s;
}

.zone-header:hover {
  background: #f1f5f9;
}

.zone-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.zone-header-title {
  font-size: 11px;
  font-weight: 800;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zone-header-meta {
  font-size: 9px;
  color: #64748b;
}

.zone-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.zone-btn-action {
  padding: 3px 6px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}

.zone-btn-action:hover {
  background: #f1f5f9;
}

.zone-btn-action.active {
  background: #e0f2fe;
  color: #0284c7;
  border-color: #7dd3fc;
}

.zone-btn-action.solo {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}

.zone-btn-action.solo.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

.zone-bar {
  width: 100%;
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}

.zone-fill {
  height: 100%;
  border-radius: 2px;
}

.zone-body {
  padding: 6px 8px;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.zone-sprinkler-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  border-radius: 5px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.12s;
}

.zone-sprinkler-row:hover {
  background: #e0f2fe;
  border-color: #bae6fd;
}

.zone-sprinkler-row.selected {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.zone-sprinkler-row.selected span,
.zone-sprinkler-row.selected .sprinkler-subtext {
  color: #ffffff !important;
}

.sprinkler-subtext {
  font-size: 9px;
  color: #64748b;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
}

.btn-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #ffffff;
  cursor: pointer;
}

.btn-icon:hover {
  background: var(--bg-panel-hover);
}

/* Switch Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .2s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(16px);
}

/* Statusbar Footer */
footer#statusbar {
  height: 28px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  z-index: 10;
}

.status-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Modal Backdrops */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-backdrop.active {
  display: flex;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* BOM Table */
.bom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.bom-table th {
  background: var(--bg-main);
  padding: 8px 10px;
  text-align: left;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.bom-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-color);
}

.price-input {
  width: 70px;
  padding: 4px 6px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.bom-total-card {
  background: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.total-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
}

.total-amount {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
}

/* AI Pulse Button Animation */
@keyframes aiPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.6);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(124, 58, 237, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(124, 58, 237, 0);
  }
}

.btn-ai-pulse {
  animation: aiPulse 2.4s infinite;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn-ai-pulse:hover {
  transform: translateY(-1px) scale(1.02);
  filter: brightness(1.1);
}

.ai-step-item {
  transition: color 0.25s ease, font-weight 0.25s ease;
}


.bom-price-switch{display:flex;gap:10px;align-items:center;margin-bottom:10px;font-weight:700}.bom-help{font-size:13px;color:#526859}#modal-bom:not(.with-prices) .bom-table th:nth-child(n+3),#modal-bom:not(.with-prices) .bom-table td:nth-child(n+3),#modal-bom:not(.with-prices) .bom-price-note,#modal-bom:not(.with-prices) .bom-price-total{display:none}#modal-bom .modal-footer{flex-wrap:wrap;gap:12px}
