/* ============================================
   GEOMETRY BOARD - STYLES
   ============================================ */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f8f9fa;
  color: #1f2937;
  overflow: hidden;
}

/* ============================================
   HEADER
   ============================================ */

.geometry-header {
  height: 60px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.back-btn {
  color: #6b7280;
  text-decoration: none;
  font-size: 14px;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.back-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

#board-title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  outline: none;
  padding: 0.5rem;
  border-radius: 4px;
  min-width: 200px;
  transition: background 0.2s;
}

#board-title:hover {
  background: #f9fafb;
}

#board-title:focus {
  background: #f3f4f6;
}

.header-right {
  display: flex;
  gap: 0.75rem;
}

.header-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid #e5e7eb;
  background: white;
  color: #374151;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.header-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

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

.header-btn.primary:hover {
  background: #2563eb;
  border-color: #2563eb;
}

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

/* ============================================
   MAIN LAYOUT
   ============================================ */

.geometry-main {
  display: grid;
  grid-template-columns: 200px 1fr 280px;
  grid-template-rows: 1fr;
  height: calc(100vh - 60px - 80px); /* header - footer */
  gap: 0;
}

/* ============================================
   TOOLBAR
   ============================================ */

.toolbar {
  background: white;
  border-right: 1px solid #e5e7eb;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.tool-section {
  margin-bottom: 1.5rem;
}

.tool-section h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin-bottom: 0.75rem;
}

.tool-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: none;
  background: transparent;
  color: #374151;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 0.25rem;
}

.tool-btn:hover:not(:disabled) {
  background: #f3f4f6;
  color: #111827;
}

.tool-btn.active {
  background: #eff6ff;
  color: #3b82f6;
}

.tool-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tool-btn svg {
  flex-shrink: 0;
}

.tool-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 0.5rem 0;
}

.tool-info {
  font-size: 12px;
  color: #9ca3af;
  padding: 0.5rem;
  line-height: 1.5;
}

/* ============================================
   CANVAS CONTAINER
   ============================================ */

.canvas-container {
  position: relative;
  background: #ffffff;
  overflow: hidden;
}

.canvas-info {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.95);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 12px;
  color: #6b7280;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  z-index: 10;
  pointer-events: none;
}

.canvas-info span {
  font-family: 'Courier New', monospace;
}

.canvas-nav-controls {
  position: absolute;
  bottom: 2rem;
  left: 1rem;
  display: flex;
  gap: 12px;
  z-index: 20;
}

.nav-pan-cluster {
  background: white;
  padding: 4px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: grid;
  grid-template-columns: 40px 40px 40px;
  grid-template-rows: 40px 40px 40px;
  gap: 2px;
}

.nav-zoom-cluster {
  background: white;
  padding: 4px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: #374151;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.nav-btn:active {
  background: #e5e7eb;
  transform: scale(0.95);
}

.nav-btn svg {
  width: 20px;
  height: 20px;
}

/* Position buttons in game-controller style */
#nav-up {
  grid-column: 2;
  grid-row: 1;
}

#nav-left {
  grid-column: 1;
  grid-row: 2;
}

#nav-right {
  grid-column: 3;
  grid-row: 2;
}

#nav-down {
  grid-column: 2;
  grid-row: 3;
}

#geometry-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

#geometry-canvas.panning {
  cursor: grab;
}

#geometry-canvas.panning:active {
  cursor: grabbing;
}

.canvas-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  background: white;
  padding: 2rem 3rem;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   AI PANEL
   ============================================ */

.ai-panel {
  background: white;
  border-left: 1px solid #e5e7eb;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.ai-panel h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #111827;
}

#ai-command {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s;
}

#ai-command:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ai-submit-btn {
  margin-top: 0.75rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.ai-submit-btn:hover {
  background: #2563eb;
}

.ai-submit-btn:active {
  background: #1d4ed8;
}

.ai-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #eff6ff;
  border-radius: 8px;
  margin-top: 0.75rem;
  font-size: 14px;
  color: #1e40af;
}

.spinner-small {
  width: 16px;
  height: 16px;
  border: 2px solid #bfdbfe;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.ai-history-section {
  margin-top: 2rem;
  flex-grow: 1;
}

.ai-history-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 0.75rem;
}

.ai-history {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ai-history-empty {
  font-size: 13px;
  color: #9ca3af;
  text-align: center;
  padding: 2rem 1rem;
}

.ai-history-item {
  padding: 0.75rem;
  background: #f9fafb;
  border-radius: 6px;
  font-size: 13px;
  color: #4b5563;
  line-height: 1.5;
  cursor: pointer;
  transition: background 0.2s;
}

.ai-history-item:hover {
  background: #f3f4f6;
}

.ai-history-item-time {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 0.25rem;
}

/* ============================================
   PROPERTIES PANEL
   ============================================ */

.properties-panel {
  height: 80px;
  background: white;
  border-top: 1px solid #e5e7eb;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  overflow-x: auto;
}

.properties-panel h3 {
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.properties-content {
  flex-grow: 1;
  display: flex;
  align-items: center;
}

.properties-empty {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: #9ca3af;
  font-size: 13px;
}

.properties-empty svg {
  opacity: 0.5;
}

/* ============================================
   SVG ELEMENTS (will be enhanced in Phase 1+)
   ============================================ */

/* Grid lines */
.grid-line {
  stroke: #e5e7eb;
  stroke-width: 0.02;
}

.grid-line-major {
  stroke: #d1d5db;
  stroke-width: 0.03;
}

/* Axes */
.axis-line {
  stroke: #6b7280;
  stroke-width: 0.05;
}

.axis-arrow {
  fill: #6b7280;
}

.axis-label {
  fill: #6b7280;
  font-size: 0.5px;
  font-family: Arial, sans-serif;
}

/* Points (Phase 1) */
.geometry-point {
  fill: #ef4444;
  stroke: #dc2626;
  stroke-width: 0.05;
}

/* Lines (Phase 1) */
.geometry-line {
  stroke: #3b82f6;
  stroke-width: 0.06;
  fill: none;
}

/* Circles (Phase 1) */
.geometry-circle {
  stroke: #10b981;
  stroke-width: 0.06;
  fill: none;
}

/* ============================================
   RESPONSIVE (Mobile - View Only)
   ============================================ */

@media (max-width: 1024px) {
  .geometry-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }

  .toolbar {
    display: none; /* Hide toolbar on mobile for now */
  }

  .ai-panel {
    border-left: none;
    border-top: 1px solid #e5e7eb;
    max-height: 40vh;
  }
}

/* ============================================
   UTILITIES
   ============================================ */

.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================
   AI RESPONSE
   ============================================ */

.ai-response {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 6px;
  background: #f3f4f6;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
}

.ai-response.text-green-700 {
  background: #d1fae5;
  color: #065f46;
}

.ai-response.text-yellow-700 {
  background: #fef3c7;
  color: #92400e;
}

.ai-response.text-red-700 {
  background: #fee2e2;
  color: #991b1b;
}


/* ============================================
   AI AGENT STATUS DISPLAY (Phase 10)
   ============================================ */

.ai-agent-status {
  margin-top: 16px;
  padding: 12px;
  background: #f8f9fc;
  border: 1px solid #e1e4e8;
  border-radius: 8px;
  font-size: 12px;
}

.agent-phase {
  margin-bottom: 12px;
  padding: 10px;
  background: white;
  border-radius: 6px;
  border-left: 3px solid #3b82f6;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.agent-phase.success {
  border-left-color: #10b981;
}

.agent-phase.error {
  border-left-color: #ef4444;
}

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

.phase-icon {
  font-size: 16px;
}

.phase-title {
  font-weight: 600;
  color: #374151;
  flex: 1;
}

.phase-status {
  font-size: 11px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 10px;
}

.phase-details {
  margin-top: 8px;
  padding-left: 24px;
  font-size: 11px;
  color: #6b7280;
  line-height: 1.5;
}

.task-list {
  margin-top: 8px;
  padding-left: 24px;
}

.task-item {
  padding: 6px 8px;
  margin-bottom: 4px;
  background: #f9fafb;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.task-item.active {
  background: #eff6ff;
  border-left: 2px solid #3b82f6;
}

.task-item.complete {
  background: #f0fdf4;
  border-left: 2px solid #10b981;
}

.task-item.error {
  background: #fef2f2;
  border-left: 2px solid #ef4444;
}

.task-icon {
  flex-shrink: 0;
}

.task-description {
  flex: 1;
  color: #374151;
}

.task-time {
  font-size: 10px;
  color: #9ca3af;
}

.completion-status {
  padding: 12px;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: pulse 0.5s ease-out;
}

@keyframes pulse {
  0% { transform: scale(0.95); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.completion-icon {
  font-size: 20px;
}

.completion-text {
  font-weight: 600;
  color: #10b981;
  flex: 1;
}

.completion-time {
  font-size: 11px;
  color: #6b7280;
}

/* Loading spinner for agent status */
.spinner-small {
  width: 14px;
  height: 14px;
  border: 2px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
