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

:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --surface2:  #22263a;
  --border:    #2e3349;
  --accent:    #6366f1;
  --accent-h:  #818cf8;
  --success:   #22c55e;
  --warning:   #f59e0b;
  --error:     #ef4444;
  --text:      #e2e8f0;
  --text-dim:  #94a3b8;
  --text-faint:#4b5563;
  --radius:    8px;
  --shadow:    0 4px 24px rgba(0,0,0,.45);
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--accent-h); }

/* ─── Header ───────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { font-size: 28px; }
.brand h1 { font-size: 20px; font-weight: 700; letter-spacing: -.4px; }
.brand-sub { font-size: 12px; color: var(--text-dim); }

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

.stats-bar {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  white-space: nowrap;
}
.stats-bar strong { color: var(--text); }

/* ─── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s, opacity .15s;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:not(:disabled):hover { filter: brightness(1.15); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-admin   { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost   { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }

/* ─── Controls ─────────────────────────────────────────── */
.controls {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
}
.controls-inner { max-width: 1600px; margin: 0 auto; }
.lang-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.lang-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 180px;
  max-width: 320px;
}
.lang-block label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-dim); }
.lang-block select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  width: 100%;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%2394a3b8' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.lang-block select:focus { border-color: var(--accent); }
.lang-block select:disabled { opacity: .5; cursor: not-allowed; }

.vs-badge {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-faint);
  letter-spacing: 1px;
  padding-top: 18px;
}

.notice {
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(245,158,11,.08);
  border: 1px solid rgba(245,158,11,.3);
  border-radius: var(--radius);
  color: var(--warning);
  font-size: 13px;
}

/* ─── Workspace ────────────────────────────────────────── */
.workspace {
  display: flex;
  height: calc(100vh - 64px - 66px);
  overflow: hidden;
}

/* ─── Task Panel ───────────────────────────────────────── */
.task-panel {
  width: 280px;
  min-width: 220px;
  max-width: 360px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.task-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.badge {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}
.task-search {
  margin: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
  width: calc(100% - 24px);
}
.task-search:focus { border-color: var(--accent); }
.task-search::placeholder { color: var(--text-faint); }

.task-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 12px;
}
.task-list::-webkit-scrollbar { width: 5px; }
.task-list::-webkit-scrollbar-track { background: transparent; }
.task-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.task-item {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  transition: background .1s, color .1s;
  border-left: 3px solid transparent;
}
.task-item:hover { background: var(--surface2); color: var(--text); }
.task-item.active {
  background: rgba(99,102,241,.15);
  color: var(--accent-h);
  border-left-color: var(--accent);
  font-weight: 600;
}

.task-empty, .task-loading {
  padding: 20px 16px;
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
}

/* ─── Split View ───────────────────────────────────────── */
.split-view {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}
.frame-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.frame-label {
  padding: 8px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-dim);
}
.sol-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
}
.frame-divider {
  width: 4px;
  background: var(--border);
  flex-shrink: 0;
}

.split-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-faint);
  font-size: 15px;
  line-height: 1.8;
  pointer-events: none;
  background: var(--bg);
}
.split-placeholder.hidden { display: none; }

/* ─── Admin Modal ──────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 520px;
  max-width: 95vw;
  padding: 28px;
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-header h2 { font-size: 18px; }
.close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.close-btn:hover { background: var(--surface2); color: var(--text); }

.modal-desc {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 18px;
}
.modal-footer {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.status-block {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--surface2);
  border: 1px solid var(--border);
  min-height: 44px;
}
.status-idle     { color: var(--text-dim); }
.status-running  { color: var(--warning); }
.status-completed{ color: var(--success); }
.status-error    { color: var(--error); }

.progress-wrap { margin-top: 14px; }
.progress-wrap.hidden { display: none; }
.progress-track {
  height: 8px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-h));
  border-radius: 99px;
  transition: width .4s ease;
  width: 0%;
}
.progress-label {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

/* ─── Utilities ────────────────────────────────────────── */
.hidden { display: none !important; }
