/*
=========================================================
 Polymath Supply Chain Studio
 AI Architected Autonomous Supply Chain Simulator
 Version 2.0

 simulator.css
 Part 1: Foundation, Header, Workspace Tabs, Layout
=========================================================
*/

/* ------------------------------
   1. Design tokens
------------------------------ */

:root {
  --aisc-bg: #ffffff;
  --aisc-surface: #ffffff;
  --aisc-surface-soft: #f8fafc;
  --aisc-surface-muted: #f1f5f9;

  --aisc-border: #dbe3ea;
  --aisc-border-soft: #e2e8f0;

  --aisc-text: #0f172a;
  --aisc-text-muted: #64748b;
  --aisc-text-soft: #94a3b8;

  --aisc-green-dark: #064e3b;
  --aisc-green: #047857;
  --aisc-green-soft: #dcfce7;

  --aisc-blue: #2563eb;
  --aisc-cyan: #06b6d4;
  --aisc-purple: #7c3aed;
  --aisc-orange: #f97316;
  --aisc-red: #dc2626;

  --aisc-shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.06);
  --aisc-shadow-md: 0 8px 24px rgba(15, 23, 42, 0.10);
  --aisc-shadow-lg: 0 18px 45px rgba(15, 23, 42, 0.18);

  --aisc-radius-sm: 8px;
  --aisc-radius-md: 12px;
  --aisc-radius-lg: 18px;
  --aisc-radius-xl: 24px;

  --aisc-font: Arial, Helvetica, sans-serif;
}

/* ------------------------------
   2. Base reset
------------------------------ */

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--aisc-bg);
  color: var(--aisc-text);
  font-family: var(--aisc-font);
}

body {
  overflow-x: hidden;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

button,
select,
input,
textarea {
  font-family: var(--aisc-font);
}

button,
select {
  cursor: pointer;
}

/* ------------------------------
   3. Studio shell
------------------------------ */

#aisc-studio {
  width: 100%;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(220, 252, 231, 0.55), transparent 32%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: var(--aisc-text);
}

/* ------------------------------
   4. Header
------------------------------ */

.studio-header {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  align-items: stretch;
  padding: 22px 24px;
  border-radius: var(--aisc-radius-xl);
  background: linear-gradient(135deg, #064e3b 0%, #065f46 52%, #0f766e 100%);
  color: #ffffff;
  box-shadow: var(--aisc-shadow-md);
  margin-bottom: 14px;
}

.eyebrow {
  margin-bottom: 8px;
  color: #bbf7d0;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.studio-header h1 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.08;
  font-weight: 900;
}

.studio-header p {
  margin: 10px 0 0;
  color: #dcfce7;
  font-size: 15px;
}

/* ------------------------------
   5. Header status cards
------------------------------ */

.header-status {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.header-status div {
  padding: 10px 12px;
  border: 1px solid rgba(220, 252, 231, 0.28);
  border-radius: var(--aisc-radius-md);
  background: rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(8px);
}

.header-status span {
  display: block;
  margin-bottom: 4px;
  color: #bbf7d0;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-status strong {
  display: block;
  color: #ffffff;
  font-size: 13px;
  line-height: 1.25;
}

/* ------------------------------
   6. Workspace tabs
------------------------------ */

.workspace-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 10px;
  border: 1px solid var(--aisc-border);
  border-radius: var(--aisc-radius-lg);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--aisc-shadow-sm);
}

.workspace-tab {
  border: 1px solid var(--aisc-border-soft);
  border-radius: 999px;
  padding: 9px 14px;
  background: var(--aisc-surface-soft);
  color: var(--aisc-text-muted);
  font-size: 12px;
  font-weight: 900;
  transition:
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.workspace-tab:hover {
  transform: translateY(-1px);
  background: #eef2ff;
  border-color: #c7d2fe;
  color: var(--aisc-text);
}

.workspace-tab.active {
  background: var(--aisc-green-soft);
  border-color: #22c55e;
  color: #065f46;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.16);
}

/* ------------------------------
   7. Main board grid
------------------------------ */

.studio-board {
  display: grid;
  grid-template-columns: 15% 50% 35%;
  grid-template-areas:
    "who where how"
    "who where which"
    "who where details";
  gap: 18px;
  align-items: stretch;
  margin-top: 20px;
}

#whoPanel {
  grid-area: who;
  min-height: 850px;
  max-height: 850px;
}

#wherePanel {
  grid-area: where;
  min-height: 850px;
  max-height: 850px;
}

#howPanel {
  grid-area: how;
  min-height: 250px;
  max-height: 250px;
}

#whichPanel {
  grid-area: which;
  min-height: 280px;
  max-height: 280px;
}

#detailsPanel {
  grid-area: details;
  min-height: 284px;
  max-height: 284px;
}
.studio-panel {
  display: flex;
  flex-direction: column;
  min-height: 760px;
  max-height: 760px;
  padding: 14px;
  border: 1px solid var(--aisc-border);
  border-radius: var(--aisc-radius-lg);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--aisc-shadow-sm);
  overflow: hidden;
}

.studio-panel.wide {
  min-width: 0;
}

.panel-kicker {
  margin-bottom: 5px;
  color: var(--aisc-text-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.studio-panel h2 {
  margin: 0 0 12px;
  color: var(--aisc-text);
  font-size: 16px;
  line-height: 1.2;
  font-weight: 900;
}

.panel-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

/* ------------------------------
   8. Scrollbar polish
------------------------------ */

.panel-body::-webkit-scrollbar,
.knowledge-body::-webkit-scrollbar {
  width: 8px;
}

.panel-body::-webkit-scrollbar-track,
.knowledge-body::-webkit-scrollbar-track {
  background: transparent;
}

.panel-body::-webkit-scrollbar-thumb,
.knowledge-body::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #cbd5e1;
}

.panel-body::-webkit-scrollbar-thumb:hover,
.knowledge-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ------------------------------
   9. Empty state
------------------------------ */

.empty-state {
  padding: 14px;
  border: 1px dashed var(--aisc-border);
  border-radius: var(--aisc-radius-md);
  background: var(--aisc-surface-soft);
  color: var(--aisc-text-muted);
  font-size: 13px;
  line-height: 1.45;
}

/* ------------------------------
   10. Responsive shell
------------------------------ */

@media (max-width: 1300px) {
  .studio-board {
    grid-template-columns: 0.9fr 1.6fr 1fr;
  }

  #whichPanel,
  #detailsPanel {
    min-height: 420px;
    max-height: 420px;
  }
}

@media (max-width: 900px) {
  #aisc-studio {
    padding: 14px;
  }

  .studio-header {
    grid-template-columns: 1fr;
  }

  .header-status {
    grid-template-columns: 1fr 1fr;
  }

  .studio-board {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .studio-panel,
  #whichPanel,
  #detailsPanel {
    min-height: 420px;
    max-height: none;
  }
}

@media (max-width: 600px) {
  .header-status {
    grid-template-columns: 1fr;
  }

  .workspace-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .workspace-tab {
    white-space: nowrap;
  }
}
/*
=========================================================
 Part 2: Floating Control Panel
=========================================================
*/

.control-panel {
  position: fixed;
  top: 118px;
  right: 28px;
  z-index: 9999;
  width: 310px;
  padding: 12px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: var(--aisc-radius-lg);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--aisc-shadow-lg);
  backdrop-filter: blur(12px);
}

.drag-handle {
  margin: -2px -2px 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--aisc-green-dark);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: move;
  user-select: none;
}

.control-label {
  display: block;
  margin: 8px 0 5px;
  color: var(--aisc-text-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#workspaceSelect,
#speedSelect {
  width: 100%;
  border: 1px solid var(--aisc-border);
  border-radius: 10px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--aisc-text);
  font-size: 12px;
  font-weight: 800;
}

.control-status {
  margin: 10px 0;
  padding: 10px;
  border: 1px solid var(--aisc-border-soft);
  border-radius: 12px;
  background: var(--aisc-surface-soft);
}

.control-status span {
  display: block;
  margin-bottom: 4px;
  color: var(--aisc-text-muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.control-status strong {
  display: block;
  color: var(--aisc-green-dark);
  font-size: 13px;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.control-grid button {
  border: 1px solid #94a3b8;
  border-radius: 10px;
  padding: 8px 9px;
  background: #ecfdf5;
  color: var(--aisc-text);
  font-size: 12px;
  font-weight: 900;
}

.control-grid button:hover {
  background: #d1fae5;
}

.control-grid button:nth-child(5),
.control-grid button:nth-child(6),
.control-grid button:nth-child(7),
.control-grid button:nth-child(8),
.control-grid button:nth-child(9) {
  grid-column: span 2;
}

.control-panel.dragging {
  opacity: 0.88;
  transform: scale(1.01);
}

@media (max-width: 900px) {
  .control-panel {
    position: static;
    width: 100%;
    margin: 0 0 16px;
  }
}