/**
 * Main Layout & Design System
 * Tailored for school Chromebook screens (1366x768), touchscreens, and desktop browsers.
 */

:root {
  --bg-color: #f0f4f8;
  --topbar-bg: #4c97ff;
  --topbar-dark: #3373cc;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  
  --lego-yellow: #ffcf00;
  --lego-red: #e53935;
  --lego-blue: #1e88e5;
  --lego-green: #43a047;
  --lego-dark: #0f172a;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Top Navigation Toolbar */
.wedo-toolbar {
  height: 48px;
  background: linear-gradient(90deg, #3373cc, #4c97ff);
  color: white;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  z-index: 100;
  flex-shrink: 0;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.brand-badge {
  background: var(--lego-yellow);
  color: #78350f;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.project-name-input {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.35);
  color: white;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  width: 170px;
  transition: all 0.15s;
}

.project-name-input:focus {
  background: white;
  color: var(--text-main);
  border-color: white;
}

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

.btn-flag {
  background: #22c55e;
  color: white;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transition: transform 0.1s, background-color 0.15s;
}

.btn-flag:hover {
  background: #16a34a;
  transform: scale(1.08);
}
.btn-flag:active { transform: scale(0.95); }

.btn-flag.is-running {
  background: #15803d;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.4), 0 0 12px #22c55e;
  animation: pulseRunning 1.2s infinite alternate ease-in-out;
}

@keyframes pulseRunning {
  from { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.4), 0 0 6px #22c55e; }
  to { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0.7), 0 0 16px #4ade80; }
}

.btn-stop-all {
  background: #ef4444;
  color: white;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transition: transform 0.1s, background-color 0.15s;
}

.btn-stop-all:hover {
  background: #dc2626;
  transform: scale(1.08);
}
.btn-stop-all:active { transform: scale(0.95); }

.btn-speed-toggle {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: white;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-speed-toggle:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: scale(1.04);
}

.btn-speed-toggle.is-slow {
  background: #f59e0b;
  border-color: #d97706;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-hub-status {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-hub-status:hover {
  background: rgba(255,255,255,0.28);
}

.btn-hub-status.connected {
  background: #10b981;
  border-color: #10b981;
}

.hub-status-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ef4444;
}

.btn-hub-status.connected .hub-status-indicator {
  background: #ffffff;
  box-shadow: 0 0 6px white;
}

.btn-tool {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-tool:hover {
  background: rgba(255,255,255,0.28);
}

.lang-select {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: white;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
}

.lang-select:hover, .lang-select:focus {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.6);
}

.lang-select option {
  background: #1e293b;
  color: #f8fafc;
}

.poc-link {
  color: rgba(255,255,255,0.85);
  font-size: 0.75rem;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 4px;
}
.poc-link:hover {
  color: white;
  background: rgba(255,255,255,0.15);
}

/* Main 3-Section App Layout */
.wedo-app-main {
  flex: 1;
  display: flex;
  height: calc(100vh - 48px);
  overflow: hidden;
  position: relative;
}

.workspace-column {
  flex: 1;
  display: flex;
  flex-direction: row;
  position: relative;
  overflow: hidden;
  background: #ffffff;
}

.stage-column {
  width: 360px;
  background: #f1f5f9;
  border-left: 2px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

@media (max-width: 1050px) {
  .stage-column {
    width: 320px;
  }
}
