/* Skill Viewer - Layout */
.sk-container {
  display: flex;
  height: calc(100vh - var(--header-height));
  margin-top: var(--header-height);
}

.sk-sidebar {
  width: 320px;
  min-width: 320px;
  min-height: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: width 0.2s, min-width 0.2s;
}

.sk-sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  border-right: none;
  padding: 0;
}

.sk-sidebar.collapsed > *:not(.sk-resize-handle) {
  display: none;
}

/* Resize handle */
.sk-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
  z-index: 10;
  transition: background 0.15s;
}

.sk-resize-handle:hover,
.sk-resize-handle:active {
  background: var(--accent);
}

.sk-sidebar.collapsed .sk-resize-handle {
  display: none;
}

.sk-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sk-sidebar-header .back-link {
  margin-bottom: 0;
}

/* Search */
.sk-search-wrap {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}

.sk-search {
  width: 100%;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.sk-search:focus {
  border-color: var(--accent);
}

/* Skill list */
.sk-skill-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 0;
}

.sk-skill-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.sk-skill-item:hover {
  background: var(--bg-tertiary);
}

.sk-skill-item.active {
  background: var(--bg-tertiary);
  border-left-color: var(--accent);
}

.sk-skill-emoji {
  font-size: 20px;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.sk-skill-info {
  flex: 1;
  min-width: 0;
}

.sk-skill-name {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sk-skill-desc {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Source badges */
.sk-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 500;
  line-height: 1.5;
  flex-shrink: 0;
}

.sk-badge.bundled {
  background: rgba(88, 166, 255, 0.15);
  color: #58a6ff;
}

.sk-badge.workspace {
  background: rgba(63, 185, 80, 0.15);
  color: #3fb950;
}

/* Main area */
.sk-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.sk-detail {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
}

.sk-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  gap: 12px;
}

.sk-empty-icon {
  font-size: 48px;
  opacity: 0.3;
}

/* Detail header */
.sk-detail-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.sk-detail-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.sk-detail-emoji {
  font-size: 32px;
}

.sk-detail-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.sk-detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.sk-detail-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 8px;
}

/* Requirements section */
.sk-requires {
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.sk-requires-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.sk-requires-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sk-requires-item {
  display: inline-block;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text);
  font-family: 'SFMono-Regular', Consolas, monospace;
}

/* File tree section */
.sk-files {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.sk-files-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.sk-files-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sk-files-list li {
  font-size: 13px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  color: var(--text);
  padding: 3px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sk-file-icon {
  color: var(--text-secondary);
  font-size: 12px;
}

/* Markdown content */
.sk-content {
  word-break: break-word;
  line-height: 1.6;
}

.sk-content p { margin: 0 0 0.8em; }
.sk-content p:last-child { margin-bottom: 0; }
.sk-content h1, .sk-content h2, .sk-content h3,
.sk-content h4, .sk-content h5, .sk-content h6 {
  margin: 1em 0 0.4em;
  line-height: 1.3;
  color: var(--text);
}
.sk-content h1 { font-size: 1.4em; }
.sk-content h2 { font-size: 1.2em; }
.sk-content h3 { font-size: 1.1em; }
.sk-content ul, .sk-content ol { margin: 0.4em 0; padding-left: 1.6em; }
.sk-content li { margin: 0.2em 0; }
.sk-content a { color: var(--accent); text-decoration: none; }
.sk-content a:hover { text-decoration: underline; }
.sk-content code {
  background: var(--bg-secondary);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: 'SFMono-Regular', Consolas, monospace;
}
.sk-content pre {
  margin: 0.6em 0;
  background: var(--bg-secondary);
  border-radius: 6px;
  overflow: auto;
  line-height: 1.4;
}
.sk-content pre code {
  display: block;
  padding: 10px 12px;
  background: none;
  border-radius: 0;
  font-size: 12px;
  white-space: pre;
  overflow-x: auto;
}
.sk-content blockquote {
  margin: 0.5em 0;
  padding: 2px 12px;
  border-left: 3px solid var(--border);
  color: var(--text-secondary);
}
.sk-content table {
  border-collapse: collapse;
  margin: 0.5em 0;
  font-size: 0.95em;
}
.sk-content th, .sk-content td {
  border: 1px solid var(--border);
  padding: 5px 10px;
}
.sk-content th { background: var(--bg-secondary); font-weight: 600; }

/* Login prompt (reuse session-viewer pattern) */
.sk-login {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 20px;
  color: var(--text-secondary);
}

.sk-login-icon {
  font-size: 64px;
  opacity: 0.3;
}

.sk-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s;
}

.sk-login-btn:hover {
  opacity: 0.85;
}

/* Loading spinner */
.sk-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-secondary);
}

.sk-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: sk-spin 0.8s linear infinite;
  margin-right: 12px;
}

@keyframes sk-spin {
  to { transform: rotate(360deg); }
}

/* Mobile back button (hidden on desktop) */
.sk-mobile-back {
  display: none;
}

/* Responsive */
@media (max-width: 900px) {
  .sk-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.3s;
  }

  .sk-sidebar.open {
    transform: translateX(0);
  }

  .sk-mobile-back {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    color: var(--accent);
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
  }

  .sk-mobile-back:hover {
    background: var(--bg-tertiary);
  }

  .sk-detail {
    padding: 16px;
  }
}

@media (max-width: 600px) {
  .sk-sidebar { width: 280px; min-width: 280px; }
  .sk-detail { padding: 12px; }
}
