/* ============================================================
   Vortex Playground — CSS Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── Color Tokens ─────────────────────────────────────────── */
:root {
  --bg-base:       #0d0e14;
  --bg-surface:    #13141d;
  --bg-overlay:    #1a1c28;
  --bg-hover:      #222435;
  --border:        #2a2d3e;
  --border-subtle: #1e2030;

  --text-primary:   #e2e4f0;
  --text-secondary: #8b8fa8;
  --text-muted:     #5a5e77;

  --accent:         #6366f1;
  --accent-hover:   #7c7ff5;
  --accent-subtle:  rgba(99, 102, 241, 0.12);

  --green:          #22c55e;
  --green-subtle:   rgba(34, 197, 94, 0.12);
  --red:            #f87171;
  --red-subtle:     rgba(248, 113, 113, 0.12);
  --amber:          #fbbf24;
  --amber-subtle:   rgba(251, 191, 36, 0.12);
  --sky:            #38bdf8;

  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);

  --header-height: 52px;
  --status-height: 28px;
}

[data-theme="light"] {
  --bg-base:       #f5f6fa;
  --bg-surface:    #ffffff;
  --bg-overlay:    #eef0f8;
  --bg-hover:      #e4e6f0;
  --border:        #d4d7e8;
  --border-subtle: #e0e2ef;

  --text-primary:   #1a1c2e;
  --text-secondary: #5a5e80;
  --text-muted:     #9b9fb8;

  --accent:         #4f52e5;
  --accent-hover:   #3b3ec2;
  --accent-subtle:  rgba(79, 82, 229, 0.1);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  background: var(--bg-base);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Layout ─────────────────────────────────────────────────── */
.playground-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.playground-main {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.playground-main.layout-side-by-side {
  flex-direction: row;
}

.playground-main.layout-stacked {
  flex-direction: column;
}

.playground-main.resizing-col {
  cursor: col-resize;
  user-select: none;
}

.playground-main.resizing-row {
  cursor: row-resize;
  user-select: none;
}

.editor-pane {
  flex: 1;
  min-width: 240px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Horizontal Splitter (Editor <-> Output in Side-by-Side) ── */
.resizer-horizontal {
  width: 6px;
  background: var(--border-subtle);
  cursor: col-resize;
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s, box-shadow 0.15s;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.resizer-horizontal:hover,
.resizer-horizontal.active {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

.resizer-handle-grip {
  width: 2px;
  height: 24px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.2);
  transition: background 0.15s;
}

.resizer-horizontal:hover .resizer-handle-grip,
.resizer-horizontal.active .resizer-handle-grip {
  background: rgba(255, 255, 255, 0.9);
}

/* ── Vertical Splitter (Editor <-> Output in Stacked Mode) ── */
.resizer-stacked {
  height: 6px;
  background: var(--border-subtle);
  cursor: row-resize;
  position: relative;
  flex-shrink: 0;
  width: 100%;
  transition: background 0.15s, box-shadow 0.15s;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.resizer-stacked:hover,
.resizer-stacked.active {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

.resizer-stacked .resizer-handle-line {
  width: 36px;
  height: 2px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.2);
  transition: background 0.15s;
}

.resizer-stacked:hover .resizer-handle-line,
.resizer-stacked.active .resizer-handle-line {
  background: rgba(255, 255, 255, 0.9);
}

.output-pane {
  min-width: 200px;
  min-height: 100px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  overflow: hidden;
}

#monaco-container {
  flex: 1;
  min-height: 0;
  width: 100%;
}

/* ── Layout Controls in Header ────────────────────────────── */
.layout-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.layout-select {
  padding-right: 22px;
  font-size: 11.5px;
}

/* ── Header ─────────────────────────────────────────────────── */
.header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.header-brand-logo {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: white;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.header-brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.header-brand-name span {
  color: var(--accent);
}

.header-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  flex-wrap: wrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 12px;
  height: 30px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.45);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-ghost {
  background: var(--bg-overlay);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-icon {
  width: 30px;
  padding: 0;
  justify-content: center;
}

/* ── Select / Input ──────────────────────────────────────────── */
.select {
  height: 30px;
  padding: 0 8px;
  background: var(--bg-overlay);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8fa8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 26px;
}

.select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}

.select-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* ── Output Pane ─────────────────────────────────────────────── */
.output-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 40px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.output-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  border: none;
  background: none;
  font-family: inherit;
  transition: all 0.15s;
}

.output-tab:hover { color: var(--text-secondary); background: var(--bg-overlay); }
.output-tab.active { color: var(--text-primary); background: var(--bg-hover); }

.output-body {
  flex: 1;
  overflow: auto;
  padding: 14px;
}

.output-terminal {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.output-stdout { color: var(--text-primary); }
.output-stderr { color: var(--red); }
.output-compile-error { color: var(--amber); }
.output-asm { color: #a5d6a7; }

.output-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  gap: 10px;
}

.output-empty-icon { font-size: 36px; opacity: 0.4; }

/* ── Status Bar ──────────────────────────────────────────────── */
.status-bar, footer.status-bar, footer.status-bar.idle, footer.status-bar.running, footer.status-bar.success, footer.status-bar.error {
  height: var(--status-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
}

footer.status-bar.error {
  background: #2a1515;
  color: #ff9b9b;
  border-top-color: #5a2020;
}

footer.status-bar.success {
  background: #112519;
  color: #7ee7a4;
  border-top-color: #1b4b2c;
}

footer.status-bar.running {
  background: #1e1b38;
  color: #c4b5fd;
  border-top-color: #4338ca;
}

.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-dot-idle {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.status-sep {
  color: var(--border);
  font-weight: 300;
}

.status-engine {
  color: var(--text-muted);
}

.status-shortcut {
  color: var(--text-muted);
  font-size: 10.5px;
}

.status-shortcut kbd {
  padding: 1px 4px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: inherit;
  font-size: 10px;
  color: var(--text-secondary);
}

/* ── Share Modal ─────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.15s ease;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  width: 480px;
  max-width: 90vw;
  animation: slide-up 0.2s ease;
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
}

.modal-url-box {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.modal-url-input {
  flex: 1;
  height: 36px;
  padding: 0 10px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  outline: none;
}

.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg-overlay);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  margin-left: auto;
}

.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── Spinner ─────────────────────────────────────────────────── */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.badge-green  { background: var(--green-subtle);  color: var(--green); }
.badge-red    { background: var(--red-subtle);    color: var(--red);   }
.badge-amber  { background: var(--amber-subtle);  color: var(--amber); }
.badge-accent { background: var(--accent-subtle); color: var(--accent); }

/* ── Keyframes ───────────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Stdin Panel & Vertical Resizer ────────────────────────── */
.stdin-panel {
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  position: relative;
}

.resizer-vertical {
  height: 6px;
  background: var(--border-subtle);
  cursor: row-resize;
  position: relative;
  width: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, box-shadow 0.15s;
}

.resizer-vertical:hover,
.resizer-vertical.active {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

.resizer-handle-line {
  width: 32px;
  height: 2px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.2);
  transition: background 0.15s;
}

.resizer-vertical:hover .resizer-handle-line,
.resizer-vertical.active .resizer-handle-line {
  background: rgba(255, 255, 255, 0.9);
}

.stdin-header {
  height: 28px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  background: var(--bg-overlay);
  border-bottom: 1px solid transparent;
  transition: background 0.15s;
}

.stdin-header:hover {
  background: var(--bg-hover);
}

.stdin-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stdin-toggle-icon {
  font-size: 10px;
  color: var(--text-muted);
  width: 12px;
  text-align: center;
  transition: transform 0.15s;
}

.stdin-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.stdin-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.stdin-badge {
  font-size: 9px;
  padding: 1px 6px;
  margin-left: 4px;
}

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

.btn-clear-stdin {
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.btn-clear-stdin:hover {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-subtle);
}

.stdin-hint {
  font-size: 10px;
  color: var(--text-muted);
}

.stdin-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-base);
}

.stdin-textarea {
  flex: 1;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  resize: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-primary);
  outline: none;
}

.stdin-textarea::placeholder {
  color: var(--text-muted);
  font-style: italic;
}
