.tools-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  min-width: 300px;
  max-width: 50%;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  min-height: 45px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 600;
}

.tool-count {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.refresh-button {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.refresh-button:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.refresh-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.refresh-button.refreshing svg {
  animation: spin 0.8s linear infinite;
}

.tools-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tools-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: var(--text-muted);
  text-align: center;
}

.tools-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.tools-list {
  width: 200px;
  min-width: 200px;
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
}

.tool-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

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

.tool-item.selected {
  background: var(--bg-tertiary);
}

.tool-item.selected .tool-chevron {
  transform: rotate(90deg);
  color: var(--accent-blue);
}

.tool-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  margin-top: 2px;
  transition: transform 0.15s;
}

.tool-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.tool-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.tool-description {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tool-detail-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.tool-detail-header h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.tool-detail-header p {
  font-size: 13px;
  color: var(--text-secondary);
}

.tool-params {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.params-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.json-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
}

.json-editor {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    monospace;
  font-size: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px;
  color: var(--text-primary);
  resize: vertical;
}

.json-editor:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.params-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.param-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.param-field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.param-field .required {
  color: var(--accent-red);
  margin-left: 2px;
}

.param-description {
  font-size: 11px;
  color: var(--text-muted);
}

.param-field input,
.param-field select {
  width: 100%;
}

.no-params {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

.tool-actions {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.tool-actions button {
  width: 100%;
  justify-content: center;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

@media (max-width: 1200px) {
  .tools-panel {
    max-width: none;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
}

/* Mobile styles */
@media (max-width: 768px) {
  .tools-panel {
    min-width: 0;
    max-width: none;
  }

  .tools-layout {
    flex-direction: column;
  }

  .tools-list {
    width: 100%;
    min-width: 0;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
  }

  .tool-item {
    padding: 12px 16px;
  }

  .tool-detail {
    min-height: 300px;
  }

  .tool-detail-header {
    padding: 12px 16px;
  }

  .tool-params {
    padding: 12px 16px;
  }

  .tool-actions {
    padding: 12px 16px;
  }

  .param-field input,
  .param-field select {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 10px 12px;
  }

  .json-editor {
    font-size: 14px;
    min-height: 120px;
  }
}
