/* ===== Custom Workspace Dropdown (top bar) ===== */

.ws-dropdown {
  position: relative;
  display: inline-block;
}

.ws-dropdown-trigger {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}
.ws-dropdown-trigger:hover {
  background: var(--chip-bg);
}
.ws-dropdown-trigger .chevron {
  font-size: 10px;
  color: var(--text-dim);
}
.ws-trigger-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}
.ws-trigger-base {
  font-size: 9px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ws-trigger-name {
  font-size: 13px;
  font-weight: 600;
}

.ws-dropdown-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 260px;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
  z-index: 1000;
  overflow: hidden;
  padding: 4px 0;
}

.ws-dropdown-group + .ws-dropdown-group .ws-dropdown-item:first-child {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 12px;
}

.ws-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background 0.12s ease;
}
.ws-dropdown-item + .ws-dropdown-item {
  border-top: 1px solid var(--border);
}
.ws-dropdown-item:hover {
  background: var(--chip-bg);
}
.ws-dropdown-item.base {
  font-weight: 600;
  font-size: 13px;
}
.ws-dropdown-item.child {
  justify-content: flex-end;
  padding-left: 36px;
  font-weight: 500;
  font-size: 12.5px;
  color: var(--text);
}
.ws-dropdown-item.selected {
  background: var(--accent-subtle);
  color: var(--accent);
}
.ws-dropdown-item .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ws-dropdown-item .check {
  flex-shrink: 0;
  min-width: 12px;
  text-align: center;
  font-size: 11px;
  color: var(--accent);
  opacity: 0.9;
}
.ws-dropdown-item.base .check {
  margin-left: auto;
}

/* ===== Workspaces Section Panel ===== */

.workspaces-panel {
  display: none;
  padding: 24px 32px;
  overflow-y: auto;
  max-width: 800px;
}

/* Tab bar */
.ws-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.ws-tab {
  padding: 8px 0;
  font-size: 16px;
  color: var(--text-dim);
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: inherit;
  border-bottom: 2px solid transparent;
}
.ws-tab:hover {
  color: var(--text);
}
.ws-tab.active {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* Section header */
.ws-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.ws-header h3 {
  margin: 0;
  font-size: 20px;
}
.ws-header p {
  margin: 4px 0 0;
  font-size: 15px;
  color: var(--text-dim);
}

/* Primary action button */
.ws-btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.ws-btn-primary:hover {
  filter: brightness(1.1);
}

/* Secondary button */
.ws-btn-secondary {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
}
.ws-btn-secondary:hover {
  background: var(--chip-bg);
}

/* Danger button */
.ws-btn-danger {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  opacity: 0.7;
}
.ws-btn-danger:hover {
  opacity: 1;
}

/* Success / create button (green) */
.ws-btn-success {
  background: #1f9d55;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.ws-btn-success:hover {
  filter: brightness(1.1);
}

/* Header actions — allow multiple buttons side by side */
.ws-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* Workspace card */
.ws-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.ws-card-info h4 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}
.ws-card-info p {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text-dim);
}
.ws-card-info .base-label {
  color: var(--accent);
}
.ws-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Empty state */
.ws-empty {
  margin-top: 24px;
  padding: 20px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  text-align: center;
  color: var(--text-dim);
  font-size: 15px;
}

/* Inline hint below a tab header */
.ws-hint {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: var(--surface2);
  color: var(--text-dim);
  font-size: 15px;
  border-radius: 4px;
}
.ws-hint em {
  font-style: normal;
  color: var(--text);
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
}

/* Error message */
.ws-error {
  color: var(--error);
  font-size: 15px;
  margin-top: 8px;
}

/* ===== Create/Edit Form ===== */

.ws-form-back {
  font-size: 15px;
  color: var(--accent);
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: inherit;
  padding: 0;
  margin-bottom: 16px;
}
.ws-form-back:hover {
  text-decoration: underline;
}

.ws-form label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.ws-form input[type="text"],
.ws-form select {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}
.ws-form input[type="text"]:focus,
.ws-form select:focus {
  outline: none;
  border-color: var(--accent);
}

.ws-form-field {
  margin-bottom: 16px;
}
.ws-form-field:last-of-type {
  margin-bottom: 24px;
}

/* Skill list header — label + Select all / Deselect all */
.ws-skill-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.ws-skill-list-header label {
  margin: 0;
}
.ws-skill-toggle-all {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  font-family: inherit;
}
.ws-skill-toggle-all:hover {
  text-decoration: underline;
}

/* Skill checkbox list — two-column grid to use horizontal space */
.ws-skill-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
}
.ws-skill-item {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 15px;
  font-weight: normal;
  color: var(--text);
  border-radius: 4px;
  min-width: 0;
}
.ws-skill-item:hover {
  background: var(--chip-bg);
}
.ws-skill-item input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
}
.ws-skill-item > div {
  min-width: 0;
}
.ws-skill-item .skill-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-skill-item .skill-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ===== CLAUDE.md editor ===== */
.ws-claudemd-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 8px;
  cursor: pointer;
}
.ws-claudemd-toggle input[type="checkbox"] {
  margin: 0;
  flex-shrink: 0;
}
.ws-claudemd-toggle span {
  margin-left: 2px;
}
.ws-claudemd-body {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  background: var(--surface);
}
.ws-claudemd-body textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 240px;
  resize: vertical;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: 14px;
  line-height: 1.5;
}
.ws-claudemd-body textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.ws-claudemd-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.ws-claudemd-actions button {
  font-size: 14px;
  padding: 6px 10px;
}

.ws-form-hint {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 6px;
}
.ws-form-hint em {
  font-style: italic;
}

.ws-form-actions {
  display: flex;
  gap: 12px;
}

/* ===== My Skills Tab ===== */

.ws-skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.ws-skill-card h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
}
.ws-skill-card p {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--text-dim);
}
.ws-skill-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ws-env-warn {
  color: var(--warn, #b45309);
  font-weight: 500;
}

/* ===== Env config modal ===== */

.env-modal {
  min-width: 460px;
  max-width: 560px;
  padding: 20px 24px;
}
.env-modal h3 {
  margin: 0 0 4px;
  font-size: 18px;
}
.env-intro {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text-dim);
}
.env-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}
.env-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.env-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
}
.env-label code {
  font-family: var(--mono, monospace);
  font-size: 14px;
  font-weight: 600;
}
.env-desc {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.4;
}
.env-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 15px;
  font-family: var(--mono, monospace);
  color: var(--text);
}
.env-input:focus {
  outline: none;
  border-color: var(--accent, #2563eb);
}

/* ===== My MCPs Tab ===== */

.ws-mcp-type-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--chip-bg);
  color: var(--text-dim);
  vertical-align: middle;
  margin-left: 4px;
}

.ws-mcp-config-preview {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: 13px;
  color: var(--text-dim);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 4px 0 0 0;
}

.ws-mcp-add-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.ws-mcp-add-form h4 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
}
.ws-mcp-add-form textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 80px;
  resize: vertical;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: 14px;
  line-height: 1.5;
}
.ws-mcp-add-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.ws-mcp-add-form input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}
.ws-mcp-add-form input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

.ws-mcp-add-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.ws-mcp-preview {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.ws-mcp-preview h4 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}
.ws-mcp-preview pre {
  margin: 4px 0 0;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.4;
  overflow-x: auto;
  color: var(--text);
}

/* Auth section in MCP preview */
.ws-auth-section {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid #1f9d55;
  border-radius: 6px;
}
.ws-auth-section.is-oauth {
  border-left-color: #3b82f6;
}
.ws-auth-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text);
}
.ws-auth-hint {
  font-size: 14px;
  color: var(--text-dim);
  margin: 0 0 8px;
  line-height: 1.4;
}
.ws-auth-field {
  margin-top: 8px;
}
.ws-auth-field label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text);
}
.ws-auth-field .ws-auth-field-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 4px;
}
.ws-auth-field input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: 14px;
}
.ws-auth-field input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
}

/* Upload button styled as label */
.ws-upload-label {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  display: inline-block;
}
.ws-upload-label:hover {
  filter: brightness(1.1);
}
.ws-upload-label input[type="file"] {
  display: none;
}
