/* ===================================================
   PyLearn — Playground (Code Editor) Styles
   =================================================== */

.playground {
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 2px solid rgba(255,107,53,0.3);
  box-shadow: var(--shadow);
}

/* ─── Playground Header ──────────────────────────── */
.playground-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1e1e2e;
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.playground-title {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: rgba(255,255,255,0.8);
  font-size: 0.88rem;
  font-weight: 700;
  font-family: var(--font-body);
}
.playground-title .py-badge {
  background: var(--orange);
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: var(--r-full);
}

.playground-dots { display: flex; gap: 6px; }
.playground-dots span {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: block;
}
.playground-dots span:nth-child(1) { background: #FF5F56; }
.playground-dots span:nth-child(2) { background: #FFBD2E; }
.playground-dots span:nth-child(3) { background: #27C93F; }

/* ─── Editor Area ────────────────────────────────── */
.playground-editor-wrap {
  position: relative;
  display: flex;
  background: #181825;
}

.editor-line-nums {
  padding: var(--sp-4) var(--sp-3);
  background: #181825;
  color: #6c7086;
  font-family: var(--font-code);
  font-size: 0.88rem;
  line-height: 1.75;
  user-select: none;
  text-align: right;
  border-right: 1px solid rgba(255,255,255,0.05);
  min-width: 44px;
  white-space: pre;
}

.playground-editor {
  flex: 1;
  background: #1e1e2e;
  color: #cdd6f4;
  border: none;
  outline: none;
  padding: var(--sp-4) var(--sp-5);
  font-family: var(--font-code);
  font-size: 0.92rem;
  line-height: 1.75;
  resize: none;
  min-height: 180px;
  tab-size: 4;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}

.playground-editor:focus { background: #1a1a2e; }
.playground-editor::selection { background: rgba(255,107,53,0.35); }

/* ─── Toolbar ────────────────────────────────────── */
.playground-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  background: #181825;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-wrap: wrap;
}

.run-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.55rem 1.4rem;
  background: var(--orange);
  color: white;
  border: none;
  border-radius: var(--r-full);
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--ease-bounce);
}
.run-btn:hover { background: var(--orange-dark); transform: scale(1.05); }
.run-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.run-btn .run-icon { font-size: 1rem; }

.reset-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.55rem 1.2rem;
  background: transparent;
  color: rgba(255,255,255,0.6);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: var(--r-full);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--ease);
}
.reset-btn:hover { border-color: rgba(255,255,255,0.4); color: white; }

.playground-status {
  margin-left: auto;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #27C93F;
}
.status-dot.loading {
  background: var(--yellow);
  animation: pulse-ring 1s infinite;
}
.status-dot.error { background: #FF5F56; }

/* ─── Output Panel ───────────────────────────────── */
.playground-output {
  background: #11111f;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: var(--sp-4) var(--sp-5);
  min-height: 80px;
  position: relative;
}

.output-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--sp-2);
  font-family: var(--font-body);
}

.output-content {
  font-family: var(--font-code);
  font-size: 0.9rem;
  color: #a6e3a1;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-all;
}
.output-content.error { color: #f38ba8; }
.output-content.empty { color: rgba(255,255,255,0.25); font-style: italic; }

/* ─── Loading Overlay ────────────────────────────── */
.playground-loading {
  position: absolute;
  inset: 0;
  background: rgba(17,17,31,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  z-index: 10;
  border-radius: 0 0 var(--r-md) var(--r-md);
}
.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,107,53,0.2);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: rgba(255,255,255,0.6); font-size: 0.85rem; font-weight: 700; }

/* ─── Sarpanch Reaction ──────────────────────────── */
.playground-reaction {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: #181825;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.playground-reaction img { width: 60px; flex-shrink: 0; }
.playground-reaction .reaction-msg {
  font-weight: 700;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.8);
}
.playground-reaction.hidden { display: none; }
