﻿/* ============================================================
   code-runner.css â€” Embedded "Edit & Run" widget styles
   Plugs into the existing .button-backdrop / .code-container.
   ============================================================ */

/* â”€â”€ "Edit & Run" button in the .button-backdrop bar â”€â”€ */
.cr-try-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
  flex-shrink: 0;
}

.cr-try-btn:hover {
  background: rgba(240, 154, 15, 0.18);
  color: #f09a0f;
  border-color: rgba(240, 154, 15, 0.35);
}

.cr-try-btn--active,
.cr-try-btn--active:hover {
  background: rgba(240, 154, 15, 0.15);
  color: #f09a0f;
  border-color: rgba(240, 154, 15, 0.4);
}

.cr-try-btn svg {
  stroke: currentColor;
  flex-shrink: 0;
}

/* â”€â”€ Runner body â€” hidden by default, shown in edit mode â”€â”€ */
.cr-runner-body {
  background: #1e1e2e;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0 0 14px 14px;
}

/* â”€â”€ Accessible label (visually hidden) â”€â”€ */
.cr-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* â”€â”€ Editable textarea â”€â”€ */
.cr-textarea {
  display: block;
  width: 100%;
  min-height: 120px;
  padding: 18px 22px;
  font-family: 'Menlo', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 14.5px;
  line-height: 1.75;
  color: #cdd6f4;
  background: #1e1e2e;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  outline: none;
  resize: vertical;
  tab-size: 2;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
  transition: background 0.15s;
}

.cr-textarea:focus {
  background: #22223a;
  outline: none;
}

/* Custom scrollbar inside textarea â€” matches code block */
.cr-textarea::-webkit-scrollbar { height: 6px; width: 6px; }
.cr-textarea::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); }
.cr-textarea::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.16); border-radius: 3px; }
.cr-textarea::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

/* â”€â”€ Action row (Run + Reset) â”€â”€ */
.cr-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #16161e;
  border-top: 1px solid rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-wrap: wrap;
}

/* â”€â”€ Buttons â”€â”€ */
.cr-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.18s, transform 0.1s;
  white-space: nowrap;
}

.cr-btn:active { transform: scale(0.97); }

.cr-btn-run {
  background: #f09a0f;
  color: #fff;
}

.cr-btn-run:hover { background: #d4870c; }

.cr-btn-reset {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.cr-btn-reset:hover {
  background: rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.85);
}

/* â”€â”€ Results area â”€â”€ */
.cr-results {
  padding: 12px 16px 14px;
  background: #0f0f1a;
  border-radius: 0 0 14px 14px;
}

/* â”€â”€ Output (console) â”€â”€ */
.cr-output {
  margin: 0;
  padding: 10px 14px;
  background: #111;
  color: #00e000;
  border: 1px solid #1a3a1a;
  border-radius: 6px;
  font-family: 'Menlo', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 8px;
}

/* â”€â”€ Error â”€â”€ */
.cr-error {
  margin: 0;
  padding: 10px 14px;
  background: #1a0a0a;
  color: #ff4d4f;
  border: 1px solid #3a1010;
  border-radius: 6px;
  font-family: 'Menlo', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Hidden iframe (JS mode) ── */
.cr-iframe { display: none !important; }

/* ── HTML preview iframe ── */
.cr-results--preview {
  padding: 12px 16px 14px;
  background: #0f0f1a;
  border-radius: 0 0 14px 14px;
}

.cr-preview {
  display: block;
  width: 100%;
  height: 220px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: #ffffff;
  resize: vertical;
  overflow: auto;
}

/* ── Mobile ── */
@media (max-width: 576px) {
  .cr-try-btn {
    font-size: 10.5px;
    padding: 3px 8px;
  }

  .cr-textarea {
    font-size: 0.85em;
    padding: 14px 16px;
  }

  .cr-actions {
    padding: 8px 12px;
    gap: 6px;
  }

  .cr-btn {
    width: 100%;
    justify-content: center;
    font-size: 12px;
  }

  .cr-results {
    padding: 10px 12px 12px;
  }
}
/* playground-specific styles are self-contained in playground.html */
