/* ═══════════════════════════════════════════════════════════════════
   CLAUDE SKILLS PLAYGROUND
   A developer-focused interface with IDE-inspired aesthetics
   ═══════════════════════════════════════════════════════════════════ */

:root {
  /* Core palette - warm dark with electric accents */
  --bg-base: #0c0c0e;
  --bg-elevated: #141416;
  --bg-surface: #1a1a1d;
  --bg-hover: #222225;
  --bg-active: #2a2a2e;

  --border-subtle: #2a2a2e;
  --border-default: #363639;
  --border-active: #4a4a4f;

  --text-primary: #f5f5f5;
  --text-secondary: #a0a0a5;
  --text-muted: #6a6a70;

  --accent: #10b981;
  --accent-dim: rgba(16, 185, 129, 0.15);
  --accent-bright: #34d399;

  --orange: #f97316;
  --orange-dim: rgba(249, 115, 22, 0.15);

  --error: #ef4444;
  --warning: #eab308;

  /* Typography */
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --font-sans: 'Space Grotesk', -apple-system, sans-serif;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

/* ─────────────────────────────────────────────────────────────────────
   RESET & BASE
   ───────────────────────────────────────────────────────────────────── */

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: 13px;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ─────────────────────────────────────────────────────────────────────
   TOP BAR
   ───────────────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 var(--space-md);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
}

.brand {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.topbar-center.hidden {
  opacity: 0.3;
  pointer-events: none;
}

.key-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0 var(--space-sm);
  transition: border-color 0.15s;
}

.key-input-wrap:focus-within {
  border-color: var(--accent);
}

.key-prefix {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  user-select: none;
}

.key-input-wrap input {
  width: 180px;
  padding: 6px var(--space-sm);
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.key-input-wrap input::placeholder {
  color: var(--text-muted);
}

.key-input-wrap input:focus {
  outline: none;
}

.btn-save {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-save:hover {
  background: var(--accent);
  color: var(--bg-base);
}

.btn-clear {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-clear:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--error);
  color: var(--error);
}

.topbar-links {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.topbar-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  transition: all 0.15s;
}

.topbar-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* ─────────────────────────────────────────────────────────────────────
   WORKSPACE (3-COLUMN LAYOUT)
   ───────────────────────────────────────────────────────────────────── */

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 240px 1fr 220px;
  overflow: hidden;
}

/* Panel base */
.panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-elevated);
}

.panel-header {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 var(--space-md);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.panel-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────────────
   LEFT PANEL: SKILLS
   ───────────────────────────────────────────────────────────────────── */

.panel-skills {
  border-right: 1px solid var(--border-subtle);
}

.import-box {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-sm);
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-subtle);
}

.import-box input {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
}

.import-box input::placeholder {
  color: var(--text-muted);
}

.import-box input:focus {
  outline: none;
  border-color: var(--orange);
}

.btn-import {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--orange-dim);
  border: 1px solid var(--orange);
  border-radius: var(--radius-sm);
  color: var(--orange);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-import:hover:not(:disabled) {
  background: var(--orange);
  color: var(--bg-base);
}

.btn-import:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.skills-scroll {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
}

.skill-group {
  margin-bottom: var(--space-md);
}

.skill-group-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--space-xs) var(--space-sm);
  margin-bottom: var(--space-xs);
}

.skill-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.skill-card {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.1s;
}

.skill-card:hover {
  background: var(--bg-hover);
}

.skill-card.selected {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.skill-card.imported {
  border-style: dashed;
}

.skill-card.imported.selected {
  border-color: var(--orange);
  background: var(--orange-dim);
}

.skill-card-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.skill-card-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.skill-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.skill-card-repo {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Community Repo Cards */
.repo-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.repo-card {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.repo-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: all 0.1s;
}

.repo-header:hover {
  background: var(--bg-hover);
}

.repo-expand {
  font-size: 8px;
  color: var(--text-muted);
  width: 12px;
  flex-shrink: 0;
}

.repo-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.repo-meta {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
}

.repo-card.expanded {
  background: var(--bg-hover);
  border-color: var(--border-subtle);
}

.repo-card.expanded .repo-header {
  border-bottom: 1px solid var(--border-subtle);
}

.repo-skills {
  padding: var(--space-xs);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.skill-card.community {
  border-style: dashed;
  border-color: var(--border-subtle);
  margin-left: var(--space-md);
}

.skill-card.community:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.skill-card.community.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* ─────────────────────────────────────────────────────────────────────
   CENTER PANEL: CHAT
   ───────────────────────────────────────────────────────────────────── */

.panel-chat {
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
}

.chat-skill-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 var(--space-lg);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.selected-skill {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.selected-icon {
  font-size: 18px;
}

.selected-name {
  font-weight: 600;
  font-size: 14px;
}

.skill-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.model-select-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.model-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.model-select {
  padding: var(--space-xs) var(--space-sm);
  padding-right: var(--space-lg);
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  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 24 24' fill='none' stroke='%236a6a70' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  transition: border-color 0.15s;
}

.model-select:hover {
  border-color: var(--border-default);
}

.model-select:focus {
  outline: none;
  border-color: var(--accent);
}

.source-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.source-btn:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

/* Examples bar */
.examples-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-lg);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  overflow-x: auto;
}

.examples-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  flex-shrink: 0;
}

.examples-chips {
  display: flex;
  gap: var(--space-sm);
}

.example-chip {
  padding: var(--space-xs) var(--space-md);
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: 100px;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.example-chip:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Messages */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
}

.empty-graphic {
  font-size: 48px;
  margin-bottom: var(--space-lg);
  opacity: 0.3;
}

.empty-state p {
  font-size: 13px;
  line-height: 1.6;
}

.message {
  max-width: 100%;
}

.message-user {
  align-self: flex-end;
  max-width: 80%;
  padding: var(--space-md) var(--space-lg);
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-lg);
}

.message-assistant {
  align-self: flex-start;
  max-width: 90%;
  padding: var(--space-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm) var(--radius-lg) var(--radius-lg) var(--radius-lg);
}

.message-content {
  font-size: 13px;
  line-height: 1.7;
  word-wrap: break-word;
}

.message-content p {
  margin: 0 0 var(--space-sm) 0;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content code.inline {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-surface);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--accent-bright);
}

.message-content .code-block {
  position: relative;
  margin: var(--space-md) 0;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.message-content .code-block .code-lang {
  position: absolute;
  top: 0;
  right: 0;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-hover);
  border-bottom-left-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.message-content .code-block pre {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg) var(--space-md) var(--space-md);
  margin: 0;
  overflow-x: auto;
}

.message-content .code-block pre code {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-primary);
  background: none;
  padding: 0;
}

.typing-indicator {
  display: inline-block;
  color: var(--text-muted);
  animation: typing 1.4s ease-in-out infinite;
  letter-spacing: 2px;
}

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

.message-meta {
  margin-top: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* Input area */
.input-area {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.input-area textarea {
  flex: 1;
  padding: var(--space-md);
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  transition: border-color 0.15s;
}

.input-area textarea::placeholder {
  color: var(--text-muted);
}

.input-area textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.input-area textarea:disabled {
  opacity: 0.5;
}

.btn-send {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  color: var(--bg-base);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  align-self: flex-end;
}

.btn-send:hover:not(:disabled) {
  background: var(--accent-bright);
  transform: translateX(2px);
}

.btn-send:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ─────────────────────────────────────────────────────────────────────
   RIGHT PANEL: INFO
   ───────────────────────────────────────────────────────────────────── */

.panel-info {
  border-left: 1px solid var(--border-subtle);
}

/* Tab Header */
.panel-header-tabs {
  display: flex;
  gap: 0;
  padding: 0;
}

.panel-tab {
  flex: 1;
  height: 32px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.panel-tab:hover {
  color: var(--text-secondary);
  background: var(--bg-hover);
}

.panel-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--bg-elevated);
}

.info-content {
  flex: 1;
  padding: var(--space-md);
  overflow-y: auto;
  overflow-x: hidden;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.info-content p {
  margin: 0 0 var(--space-md) 0;
}

.info-content p:last-child {
  margin-bottom: 0;
}

.info-content .info-section {
  margin-bottom: var(--space-lg);
}

.info-content .info-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
}

.info-content .info-category {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
}

.info-hint {
  color: var(--text-muted);
  font-style: italic;
}

/* Prompt Tab Styles */
#prompt-content {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.7;
}

#prompt-content .prompt-text {
  white-space: pre-wrap;
  color: var(--text-primary);
}

#prompt-content h1,
#prompt-content h2,
#prompt-content h3 {
  color: var(--accent);
  font-size: 12px;
  margin: var(--space-md) 0 var(--space-sm) 0;
  font-weight: 600;
}

#prompt-content h1:first-child,
#prompt-content h2:first-child,
#prompt-content h3:first-child {
  margin-top: 0;
}

#prompt-content code {
  background: var(--bg-base);
  padding: 1px 4px;
  border-radius: 2px;
  color: var(--orange);
  font-size: 10px;
}

#prompt-content pre {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  overflow-x: auto;
  margin: var(--space-sm) 0;
}

#prompt-content pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
}

#prompt-content ul,
#prompt-content ol {
  margin: var(--space-sm) 0;
  padding-left: var(--space-lg);
}

#prompt-content li {
  margin-bottom: var(--space-xs);
}

#prompt-content strong {
  color: var(--text-primary);
}

/* Preview Tab Styles */
#preview-content {
  padding: 0;
  display: flex;
  flex-direction: column;
}

.preview-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.preview-frame-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.preview-toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.preview-type {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.preview-toolbar-right {
  display: flex;
  gap: var(--space-xs);
}

.preview-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 11px;
}

.preview-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.preview-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
  min-height: 200px;
}

.preview-code {
  flex: 1;
  overflow: auto;
  background: var(--bg-base);
  padding: var(--space-sm);
}

.preview-code pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ─────────────────────────────────────────────────────────────────────
   UTILITIES
   ───────────────────────────────────────────────────────────────────── */

.spin {
  display: inline-block;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ─────────────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────────────── */

@media (max-width: 1000px) {
  .workspace {
    grid-template-columns: 200px 1fr;
  }

  .panel-info {
    display: none;
  }
}

@media (max-width: 700px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .panel-skills {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    max-height: 35vh;
  }

  .skills-scroll {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .skill-list {
    flex-direction: row;
  }

  .skill-card {
    flex-shrink: 0;
  }

  .topbar-center {
    display: none;
  }

  .brand {
    font-size: 12px;
  }
}

/* ─────────────────────────────────────────────────────────────────────
   SCROLLBAR STYLING
   ───────────────────────────────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-default);
}
