/* ─────────────────────────────────────────────
   React Playground – Scoped Component Styles
   ───────────────────────────────────────────── */

.rp-hero {
  min-height: 50vh;
  padding-bottom: 2rem;
}

.rp-hero-desc {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin: 1rem 0 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.rp-react-icon {
  color: #61dafb;
  font-size: 1.2rem;
}

/* ── Section ── */
.rp-section {
  padding: 2rem 1rem 4rem;
}

.rp-container {
  max-width: 1400px;
  margin: 0 auto;
}

/* ── Toolbar ── */
.rp-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: var(--dark-surface);
  border: 1px solid var(--glass-border);
  border-radius: 12px 12px 0 0;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.rp-toolbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.rp-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rp-label {
  font-family: Orbitron, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #61dafb;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.rp-select {
  background: var(--dark-card);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: Poppins, sans-serif;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
}

.rp-select:focus {
  border-color: #61dafb;
}

.rp-run-btn {
  background: linear-gradient(135deg, #61dafb 0%, #7c3aed 100%);
  color: #000;
  font-weight: 700;
  padding: 0.45rem 1.25rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

.rp-icon-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 0.85rem;
}

.rp-icon-btn:hover {
  color: #61dafb;
  border-color: #61dafb;
}

/* ── Toggle ── */
.rp-mode-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rp-toggle-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.rp-toggle-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.rp-toggle-switch {
  width: 36px;
  height: 20px;
  background: var(--dark-card);
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: background 0.2s ease;
  border: 1px solid var(--glass-border);
  display: block;
}

.rp-toggle-switch::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--text-secondary);
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: all 0.2s ease;
}

.rp-toggle-input:checked + .rp-toggle-switch {
  background: #61dafb;
  border-color: #61dafb;
}

.rp-toggle-input:checked + .rp-toggle-switch::after {
  left: 18px;
  background: #000;
}

/* ── Split Pane ── */
.rp-split {
  display: flex;
  height: 500px;
  border: 1px solid var(--glass-border);
  border-top: none;
  background: var(--dark-bg);
  overflow: hidden;
}

.rp-editor-pane,
.rp-preview-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.rp-pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--dark-surface);
  border-bottom: 1px solid var(--glass-border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.rp-lang-badge {
  font-family: "Fira Code", monospace;
  font-size: 0.7rem;
  color: #61dafb;
  background: rgba(97, 218, 251, 0.1);
  border: 1px solid rgba(97, 218, 251, 0.3);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.rp-status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.rp-status-ready {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.rp-status-running {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.rp-status-error {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ── Editor ── */
.rp-editor-wrap {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
  background: #0d1117;
}

.rp-line-numbers {
  width: 44px;
  background: var(--dark-surface);
  border-right: 1px solid var(--glass-border);
  padding: 1rem 0.5rem;
  text-align: right;
  font-family: "Fira Code", monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-secondary);
  user-select: none;
  pointer-events: none;
  overflow: hidden;
  white-space: pre;
  flex-shrink: 0;
}

.rp-editor {
  flex: 1;
  background: #0d1117;
  color: #e6edf3;
  font-family: "Fira Code", Consolas, Monaco, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 1rem 1.25rem;
  border: none;
  outline: none;
  resize: none;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  caret-color: #61dafb;
}

.rp-editor::selection {
  background: rgba(97, 218, 251, 0.2);
}

/* ── Divider ── */
.rp-divider {
  width: 4px;
  background: var(--glass-border);
  cursor: col-resize;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.rp-divider:hover,
.rp-divider.dragging {
  background: #61dafb;
}

/* ── Preview ── */
.rp-preview {
  flex: 1;
  border: none;
  background: #fff;
  width: 100%;
}

/* ── Console ── */
.rp-console {
  border: 1px solid var(--glass-border);
  border-top: none;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}

.rp-console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--dark-surface);
  border-bottom: 1px solid var(--glass-border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.rp-console-clear {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: Poppins, sans-serif;
  transition: color 0.2s ease;
}

.rp-console-clear:hover {
  color: #ef4444;
}

.rp-console-body {
  min-height: 80px;
  max-height: 160px;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  background: #0d1117;
  font-family: "Fira Code", monospace;
  font-size: 0.8rem;
  line-height: 1.6;
}

.rp-console-placeholder {
  color: var(--text-secondary);
  font-style: italic;
}

.rp-log { color: #e6edf3; }
.rp-log-error { color: #ef4444; }
.rp-log-warn { color: #f59e0b; }
.rp-log-info { color: #61dafb; }
.rp-log-success { color: #22c55e; }

.rp-console-line {
  display: block;
  padding: 0.1rem 0;
}

.rp-console-line::before {
  content: "› ";
  color: var(--text-secondary);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .rp-split {
    flex-direction: column;
    height: auto;
  }

  .rp-editor-pane {
    height: 300px;
  }

  .rp-divider {
    width: 100%;
    height: 4px;
    cursor: row-resize;
  }

  .rp-preview-pane {
    height: 300px;
  }

  .rp-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .rp-toolbar-right {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .rp-label {
    font-size: 0.75rem;
  }

  .rp-select {
    font-size: 0.8rem;
  }
}

/* ── Focus ── */
.rp-editor:focus-visible,
.rp-icon-btn:focus-visible,
.rp-run-btn:focus-visible {
  outline: 2px solid #61dafb;
  outline-offset: 2px;
}

/* ── Print ── */
@media print {
  .rp-toolbar,
  .rp-console,
  .navbar,
  .footer {
    display: none !important;
  }
}
