/* NashmiC Playground — Dark theme with Jordanian-inspired accents */

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

:root {
  --bg: #0a0b0f;
  --bg-elevated: #111318;
  --bg-code: #0d0e14;
  --surface: #181a22;
  --border: #1e2130;
  --border-subtle: #14161e;
  --text: #e2e4ed;
  --text-dim: #8b8fa4;
  --text-muted: #5c5f73;
  --gold: #d4a04a;
  --gold-dim: #b8893f;
  --gold-glow: rgba(212, 160, 74, 0.08);
  --gold-glow-strong: rgba(212, 160, 74, 0.15);
  --green: #007a3d;
  --green-bright: #2ea85d;
  --red: #ce1126;
  --red-dim: #a3152b;
  --kw: #d4a04a;
  --fn: #7eb6c9;
  --str: #8fbf7a;
  --num: #c9917e;
  --comment: #5c5f73;
  --type: #b895d6;
  --font-display: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --header-h: 60px;
  --radius: 8px;
  --radius-lg: 12px;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

::selection {
  background: var(--gold-glow-strong);
  color: var(--gold);
}

::-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);
}

/* ---- HEADER ---- */
.header {
  height: var(--header-h);
  background: rgba(10, 11, 15, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.logo-area img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
}

.logo-text {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.logo-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--gold);
  background: var(--gold-glow);
  border: 1px solid rgba(212, 160, 74, 0.12);
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 4px;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-links a:hover {
  color: var(--gold);
}

.header-links svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ---- HERO ---- */
.hero {
  text-align: center;
  padding: 40px 24px 32px;
  border-bottom: 1px solid var(--border-subtle);
}

.tagline {
  font-size: 16px;
  color: var(--text-dim);
  font-weight: 400;
  margin-bottom: 8px;
}

.tagline em {
  font-style: normal;
  color: var(--gold);
}

.hero-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ---- TOOLBAR ---- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 12px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.example-select {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  cursor: pointer;
  min-width: 200px;
  outline: none;
  transition: border-color 0.2s;
}

.example-select:hover,
.example-select:focus {
  border-color: var(--gold-dim);
}

.example-select option {
  background: var(--surface);
  color: var(--text);
}

.btn {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  padding: 8px 20px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-run {
  background: var(--green);
  color: #fff;
}

.btn-run:hover {
  background: var(--green-bright);
  box-shadow: 0 0 20px rgba(0, 122, 61, 0.3);
}

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

.btn-run .btn-icon {
  font-size: 16px;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  color: var(--text);
  border-color: var(--gold-dim);
}

.btn-secondary.active {
  color: var(--gold);
  border-color: var(--gold-dim);
  background: var(--gold-glow);
}

/* ---- PLAYGROUND LAYOUT ---- */
.playground {
  display: flex;
  height: calc(100vh - var(--header-h) - 125px - 52px);
  min-height: 400px;
}

.pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pane-left {
  border-right: 1px solid var(--border-subtle);
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

.pane-header .file-name {
  font-family: var(--font-mono);
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  font-weight: 400;
}

.output-tabs {
  display: flex;
  gap: 0;
}

.output-tab {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.output-tab:hover {
  color: var(--text-dim);
}

.output-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* ---- CODE EDITOR ---- */
.code-editor {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.code-editor textarea {
  width: 100%;
  height: 100%;
  background: var(--bg-code);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  padding: 16px 20px;
  border: none;
  outline: none;
  resize: none;
  tab-size: 4;
  -moz-tab-size: 4;
  white-space: pre;
  overflow: auto;
}

.code-editor textarea::placeholder {
  color: var(--text-muted);
}

/* ---- OUTPUT PANEL ---- */
.output-content {
  flex: 1;
  background: var(--bg-code);
  overflow: auto;
  position: relative;
}

.output-text {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  padding: 16px 20px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  min-height: 100%;
}

.output-text.placeholder {
  color: var(--text-muted);
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--font-display);
  font-size: 14px;
  padding: 40px 20px;
}

.output-text.running {
  color: var(--green-bright);
}

.output-text.error {
  color: var(--red);
}

.output-text .error-line {
  color: var(--red);
}

/* ---- CUSTOM CODE NOTICE ---- */
.custom-notice {
  background: var(--gold-glow);
  border: 1px solid rgba(212, 160, 74, 0.15);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 16px 20px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}

.custom-notice code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--gold);
}

/* ---- GET STARTED SECTION ---- */
.get-started {
  border-top: 1px solid var(--border-subtle);
  padding: 48px 24px;
  background: var(--bg-elevated);
}

.get-started-inner {
  max-width: 900px;
  margin: 0 auto;
}

.get-started h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text);
}

.get-started h2 span {
  color: var(--gold);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.2s;
  text-decoration: none;
  color: var(--text);
  display: block;
}

.card:hover {
  border-color: var(--gold-dim);
  background: var(--gold-glow);
}

.card-icon {
  font-size: 28px;
  margin-bottom: 12px;
}

.card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.card p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

.card code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--gold);
}

/* ---- FOOTER ---- */
.footer {
  text-align: center;
  padding: 24px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 13px;
}

.footer a {
  color: var(--gold-dim);
  text-decoration: none;
}

.footer a:hover {
  color: var(--gold);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 12px;
}

/* ---- ANIMATION ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.output-text.animate {
  animation: fadeIn 0.3s ease-out;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.running-indicator {
  animation: pulse 0.6s ease-in-out;
}

/* ---- RESIZE HANDLE ---- */
.resize-handle {
  width: 4px;
  background: var(--border-subtle);
  cursor: col-resize;
  flex-shrink: 0;
  transition: background 0.2s;
}

.resize-handle:hover,
.resize-handle.active {
  background: var(--gold-dim);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .header {
    padding: 0 16px;
  }

  .header-links .link-text {
    display: none;
  }

  .hero {
    padding: 28px 16px 24px;
  }

  .tagline {
    font-size: 14px;
  }

  .toolbar {
    padding: 10px 16px;
  }

  .example-select {
    min-width: 150px;
  }

  .playground {
    flex-direction: column;
    height: auto;
    min-height: 0;
  }

  .pane {
    min-height: 280px;
  }

  .pane-left {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .resize-handle {
    display: none;
  }

  .get-started {
    padding: 32px 16px;
  }

  .cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .logo-text {
    font-size: 17px;
  }

  .logo-badge {
    display: none;
  }

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

  .toolbar-left,
  .toolbar-right {
    justify-content: center;
  }

  .example-select {
    width: 100%;
  }
}

/* ---- WASM Status Indicator ---- */

.wasm-status {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.wasm-status.loading {
  color: var(--gold);
  background: rgba(212, 160, 74, 0.1);
  border: 1px solid rgba(212, 160, 74, 0.2);
}

.wasm-status.ready {
  color: var(--green-bright);
  background: rgba(46, 168, 93, 0.1);
  border: 1px solid rgba(46, 168, 93, 0.2);
}

.wasm-status.failed {
  color: var(--text-muted);
  background: rgba(92, 95, 115, 0.1);
  border: 1px solid rgba(92, 95, 115, 0.2);
}
