/* MeasureUp — Artificial Grass Canterbury */
/* Brand: Green #7DC539 + Navy #0D3361 */

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0D3361;
  color: #fff;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

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

/* Top bar */
#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #0a264f;
  border-bottom: 1px solid #1a3d6f;
  min-height: 48px;
  z-index: 10;
}

.app-title {
  font-weight: 700;
  font-size: 16px;
  color: #7DC539;
  letter-spacing: 0.5px;
}

#job-name {
  font-size: 14px;
  color: #aac4e0;
  flex: 1;
  text-align: center;
  padding: 0 12px;
  cursor: pointer;
}

#job-name:empty::after {
  content: 'Tap to name job';
  color: #666;
  font-style: italic;
}

#btn-menu {
  background: none;
  border: none;
  color: #7DC539;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
}

/* Canvas */
#canvas {
  flex: 1;
  background: #f5f5f0;
  cursor: crosshair;
  touch-action: none;
}

/* Dimension input popup */
#dimension-input {
  position: absolute;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%);
  background: #0D3361;
  border: 2px solid #7DC539;
  border-radius: 12px;
  padding: 8px;
  display: flex;
  gap: 8px;
  z-index: 20;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

#dimension-input.hidden { display: none; }

#dim-value {
  width: 120px;
  padding: 8px 12px;
  border: 1px solid #1a3d6f;
  border-radius: 8px;
  background: #0a264f;
  color: #fff;
  font-size: 18px;
  text-align: center;
  outline: none;
}

#dim-value:focus { border-color: #7DC539; }

#dim-confirm {
  padding: 8px 16px;
  background: #7DC539;
  color: #0D3361;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

#dim-confirm:active { background: #6ab52e; }

.lock-btn {
  background: none;
  border: 1px solid #1a3d6f;
  border-radius: 8px;
  font-size: 18px;
  padding: 6px 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.lock-btn.locked {
  background: rgba(125, 197, 57, 0.2);
  border-color: #7DC539;
}

/* Toolbar */
#toolbar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-wrap: wrap;
  padding: 4px 4px;
  background: #0a264f;
  border-top: 1px solid #1a3d6f;
  min-height: 56px;
  z-index: 10;
  gap: 2px;
}

#toolbar button {
  background: none;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 20px;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#toolbar button.active {
  background: rgba(125, 197, 57, 0.15);
  border-color: #7DC539;
}

#toolbar button:active {
  background: rgba(125, 197, 57, 0.3);
}

/* Zone picker */
#zone-picker {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #0D3361;
  border: 2px solid #7DC539;
  border-radius: 16px;
  padding: 20px;
  z-index: 30;
  min-width: 260px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

#zone-picker.hidden { display: none; }

#zone-picker h3 {
  text-align: center;
  margin-bottom: 16px;
  color: #7DC539;
  font-size: 16px;
}

.zone-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 4px;
}

.zone-option:active { background: rgba(255,255,255,0.1); }

.zone-swatch {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.3);
}

.zone-label {
  font-size: 16px;
  font-weight: 500;
}

/* Notes panel */
#notes-panel {
  position: absolute;
  right: 0;
  top: 48px;
  bottom: 56px;
  width: 280px;
  background: #0D3361;
  border-left: 1px solid #1a3d6f;
  z-index: 25;
  padding: 16px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

#notes-panel.open { transform: translateX(0); }

#notes-panel h3 {
  color: #7DC539;
  margin-bottom: 12px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.note-item {
  background: #0a264f;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.4;
}

.note-item .note-time {
  color: #666;
  font-size: 11px;
  margin-top: 4px;
}

/* Voice recording indicator */
#voice-indicator {
  position: absolute;
  left: 50%;
  top: 60px;
  transform: translateX(-50%);
  background: #e53935;
  color: #fff;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  z-index: 25;
  animation: pulse 1s infinite;
}

#voice-indicator.hidden { display: none; }

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

/* Summary panel */
#summary-panel {
  position: absolute;
  left: 8px;
  top: 56px;
  background: rgba(13, 51, 97, 0.92);
  border-radius: 10px;
  padding: 12px;
  z-index: 15;
  min-width: 160px;
  font-size: 13px;
  border: 1px solid #1a3d6f;
}

#summary-panel.hidden { display: none; }

.summary-zone {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.summary-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.summary-total {
  border-top: 1px solid #1a3d6f;
  padding-top: 6px;
  margin-top: 6px;
  font-weight: 700;
  color: #7DC539;
}

/* Options panel */
#options-panel {
  position: absolute;
  right: 0;
  top: 48px;
  bottom: 56px;
  width: 280px;
  background: #0D3361;
  border-left: 1px solid #1a3d6f;
  z-index: 25;
  padding: 16px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

#options-panel.open { transform: translateX(0); }

#options-panel h3 {
  color: #7DC539;
  margin-bottom: 12px;
}

.option-card {
  background: #0a264f;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.option-card h4 {
  color: #7DC539;
  font-size: 14px;
  margin-bottom: 8px;
}

.option-zones {
  font-size: 13px;
  line-height: 1.6;
}

.option-total {
  font-weight: 700;
  color: #fff;
  font-size: 16px;
  margin-top: 6px;
}

/* Menu overlay */
#menu-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

#menu-overlay.hidden { display: none; }

.menu-btn {
  width: 220px;
  padding: 14px;
  border: 2px solid #7DC539;
  border-radius: 12px;
  background: #0D3361;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.menu-btn:active {
  background: #7DC539;
  color: #0D3361;
}

.menu-btn.danger {
  border-color: #e53935;
  color: #e53935;
}

/* Scale indicator */
#scale-indicator {
  position: absolute;
  left: 8px;
  bottom: 62px;
  background: rgba(13, 51, 97, 0.85);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  color: #aac4e0;
  z-index: 5;
}

/* Photo thumbnails */
#photo-strip {
  position: absolute;
  left: 8px;
  bottom: 62px;
  display: flex;
  gap: 6px;
  z-index: 5;
}

.photo-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  border: 2px solid #7DC539;
  object-fit: cover;
  cursor: pointer;
}

/* Toast */
#toast {
  position: absolute;
  left: 50%;
  top: 60px;
  transform: translateX(-50%) translateY(-20px);
  background: #7DC539;
  color: #0D3361;
  padding: 10px 24px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  z-index: 60;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Delete UI ─── */
#delete-ui {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 100;
}
.delete-btn {
  background: #e53935;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(229,57,53,0.4);
}
.delete-btn.cancel {
  background: #555;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ─── Parallel Dialog ─── */
.parallel-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.parallel-inner {
  background: #1a1a2e;
  padding: 24px;
  border-radius: 12px;
  min-width: 280px;
}
.parallel-inner h3 {
  margin: 0 0 8px;
  color: #7DC539;
}
.parallel-inner p {
  color: #aaa;
  margin: 0 0 12px;
  font-size: 13px;
}
.parallel-inner label {
  color: #ccc;
  font-size: 13px;
  display: block;
  margin-bottom: 4px;
}
.parallel-inner input {
  width: 100%;
  padding: 10px;
  font-size: 18px;
  border: 2px solid #0D3361;
  border-radius: 6px;
  background: #111;
  color: white;
  margin-bottom: 12px;
}
.parallel-btns {
  display: flex;
  gap: 8px;
}
.parallel-btns button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.parallel-btns #parallel-create { background: #7DC539; color: #000; }
.parallel-btns #parallel-flip { background: #0D3361; color: #fff; }
.parallel-btns .cancel { background: #444; color: #fff; }

/* ─── Toolbar parallel button ─── */
#btn-parallel { font-weight: 700; }

/* ─── Parallel Offset Bar ─── */
.parallel-bar {
  position: fixed;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26,26,46,0.95);
  padding: 10px 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 100;
  border: 1px solid #0D3361;
  pointer-events: auto;
  touch-action: manipulation;
}
.parallel-label {
  color: #ccc;
  font-size: 13px;
  white-space: nowrap;
}
.parallel-bar input {
  width: 80px;
  padding: 6px 8px;
  font-size: 15px;
  border: 2px solid #0D3361;
  border-radius: 5px;
  background: #111;
  color: white;
  text-align: center;
}
.parallel-bar button {
  padding: 6px 12px;
  background: #7DC539;
  color: #000;
  border: none;
  border-radius: 5px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}
.parallel-bar button#parallel-flip {
  background: #0D3361;
  color: #fff;
  min-width: 36px;
}
.parallel-bar button:hover { opacity: 0.85; }

/* Remove old parallel dialog styles */
.parallel-dialog { display: none; }
.parallel-inner { display: none; }
